File: usage.md

package info (click to toggle)
ruby-gitlab 6.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,824 kB
  • sloc: ruby: 12,742; makefile: 7; sh: 4; javascript: 3
file content (29 lines) | stat: -rw-r--r-- 597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!-- THIS DOCUMENT IS PUBLISHED ON https://narkoz.github.io/gitlab -->
# Usage

## ObjectifiedHash

Gitlab returns `Gitlab::ObjectifiedHash` for items, which gives you object-like
access to the parsed JSON response

```rb
user = Gitlab.user
user.email #=> "john@example.com"
```

You can access the original hash by calling `to_h` or `to_hash` on the
`Gitlab::ObjectifiedHash` instance

```rb
user = Gitlab.user
hash = user.to_h
```

## Pagination

Use `page` (page number) and `per_page` (number of results per page) in the
options to paginate collections

```rb
Gitlab.projects(per_page: 5)
```