Implement and document a new utility method for getting tags from projects hosted on GitLab. This method supports GitLab.com as well as projects hosted on independent servers.
Unified · Split
| @@ -236,3 +236,10 @@ To make life easier, there are a few utility methods that you can use in `get_la · 235 unmodified lines | |||
| 236 | Returns the date of the most recent commit in the default branch of the given repository. | 236 | Returns the date of the most recent commit in the default branch of the given repository. |
| 237 | 237 | ||
| 238 | Example: [lib/docs/scrapers/reactivex.rb](../lib/docs/scrapers/reactivex.rb) | 238 | Example: [lib/docs/scrapers/reactivex.rb](../lib/docs/scrapers/reactivex.rb) |
| 239 | |||
| 240 | ### GitLab methods | ||
| 241 | * `get_gitlab_tags(hostname, group, project, opts)` | ||
| 242 | |||
| 243 | Returns the list of tags on the given repository ([format](https://docs.gitlab.com/ee/api/tags.html)). | ||
| 244 | |||
| 245 | Example: [lib/docs/scrapers/gtk.rb](../lib/docs/scrapers/gtk.rb) | ||
| @@ -270,5 +270,9 @@ module Docs · 269 unmodified lines | |||
| 270 | timestamp = commits[0]['commit']['author']['date'] | 270 | timestamp = commits[0]['commit']['author']['date'] |
| 271 | Date.iso8601(timestamp).to_time.to_i | 271 | Date.iso8601(timestamp).to_time.to_i |
| 272 | end | 272 | end |
| 273 | |||
| 274 | def get_gitlab_tags(hostname, group, project, opts) | ||
| 275 | fetch_json("https://#{hostname}/api/v4/projects/#{group}%2F#{project}/repository/tags", opts) | ||
| 276 | end | ||
| 273 | end | 277 | end |
| 274 | end | 278 | end |