You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To start using the gem, you can either perform direct calls on `Github`
77
+
To start using the gem, you can either perform requests directly on `Github` namespace:
73
78
74
79
```ruby
75
-
Github.repos.list user:'wycats'
80
+
Github.repos.list user:'peter-murach'
76
81
```
77
82
78
-
or create a new client instance
83
+
or create a new client instance like so
79
84
80
85
```ruby
81
86
github =Github.new
82
87
```
83
88
84
-
### 1.1 Options
89
+
and then call api methods, for instance, to list a given user repositories do
85
90
86
-
At this stage, you can also supply various configuration parameters, such as
91
+
```ruby
92
+
github.repos.list user:'peter-murach'
87
93
```
88
-
adapter # http client used for performing requests
89
-
auto_pagination # false by default, set to true to traverse requests page links
90
-
oauth_token # oauth authorization token
91
-
basic_auth # login:password string
92
-
client_id # oauth client id
93
-
client_secret # oauth client secret
94
-
user # global user used in requests if none provided
95
-
repo # global repository used in requests in none provided
96
-
org # global organization used in requests if none provided
97
-
endpoint # enterprise API endpoint
98
-
site # enterprise API web endpoint
99
-
ssl # SSL settings
100
-
per_page # number of items per page- max of 100
101
-
user_agent # custom user agent name, 'Github API' by default
94
+
95
+
### 1.1 API Navigation
96
+
97
+
This gem closely mirrors the GitHub API hierarchy i.e. if you want to create a download resource, look up the GitHub API spec and issue the request as in `github.repos.downloads.create`
98
+
99
+
For example to interact with GitHub Repositories API, issue the following calls that correspond directly to the GitHub API hierarchy
You can authenticate either using OAuth authentication convenience methods (see OAuth section) or through basic authentication by passing your login and password credentials
126
+
## 2 Configuration
127
+
128
+
The **github_api** provides ability to specify global configruation options. These options will be available to all api calls.
129
+
130
+
### 2.1 Basic
131
+
132
+
The configuration options can be set by using the `configure` helper
basic_auth # Basic authentication in form login:password.
167
+
client_id # Oauth client id.
168
+
client_secret # Oauth client secret.
169
+
connection_options # Hash of connection options.
170
+
endpoint # Enterprise API endpoint. Default: 'https://api.github.com'
171
+
oauth_token # Oauth authorization token.
172
+
org # Global organization used in requests if none provided
173
+
per_page # Number of items per page. Max of 100. Default 30.
174
+
repo # Global repository used in requests in none provided
175
+
site # enterprise API web endpoint
176
+
ssl # SSL settings in hash form.
177
+
user # Global user used for requests if none provided
178
+
user_agent # Custom user agent name. Default 'Github API Ruby Gem'
144
179
```
145
180
146
-
### 1.3 Modularity
181
+
### 2.2 Advanced
147
182
148
-
The code base is modular and allows for you to work specifically with a given part of GitHub API e.g. blobs
183
+
The **github_api** will use the default middleware stack which is exposed by calling `stack` on a client instance. However, this stack can be freely modified with methods such as `insert`, `insert_after`, `delete` and `swap`. For instance, to add your `CustomMiddleware` do:
The `github_api` gem will use the default middleware stack which is exposed by calling `stack` on a client instance. However, this stack can be freely modified with methods such as `insert`, `insert_after`, `delete` and `swap`. For instance, to add your `CustomMiddleware` do
0 commit comments