Skip to content

Commit a58d76b

Browse files
committed
Change ssl docs, move actions documentation and drop api listings.
1 parent b15cb2d commit a58d76b

File tree

1 file changed

+34
-82
lines changed

1 file changed

+34
-82
lines changed

README.md

Lines changed: 34 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ gem "github_api"
5959
* [1.4.2 Response Headers](#142-response-headers)
6060
* [1.4.3 Response Success](#143-response-success)
6161
* [2. Configuration](#2-configuration)
62-
* [2.1 Basic](#21-configuration)
63-
* [2.2 Advanced](#22-configuration)
62+
* [2.1 Basic](#21-basic)
63+
* [2.2 Advanced](#22-advanced)
64+
* [2.3 SSL](#23-ssl)
6465
* [3. Authentication](#3-authentication)
6566
* [3.1 Basic](#31-basic)
6667
* [3.2 Application OAuth](#32-application-oauth)
6768
* [3.3 Authorizations API](#33-authorizations-api)
68-
* [5. SSL](#5-ssl)
69-
* [6. API](#6-api)
7069
* [7. Media Types](#7-media-types)
7170
* [8. Hypermeida](#8-hypermedia)
7271
* [10. Pagination](#10-pagination)
@@ -122,6 +121,13 @@ github.users.followers.list 'peter-murach'
122121

123122
The code base has been extensively documented with examples of how to use each method. Please refer to the [documentation](http://rubydoc.info/github/peter-murach/github/master/frames) under the `Github::Client` class name.
124123

124+
Alternatively, you can find out which methods are supported by an api by calling `actions` on a class or instance. For example, in order to find out available endpoints for `Github::Client::Repos::Contents` api call `actions` method:
125+
126+
```ruby
127+
Github::Client::Repos::Contents.actions
128+
=> [:archive, :create, :delete, :find, :get, :readme, :update]
129+
```
130+
125131
### 1.2 Modularity
126132

127133
The code base is modular. This means that you can work specifically with a given part of GitHub API. If you want to only work with activity starring API do the following:
@@ -313,7 +319,26 @@ Github.new do |c|
313319
end
314320
```
315321

322+
### 2.3 SSL
323+
324+
By default requests over SSL are set to OpenSSL::SSL::VERIFY_PEER. However, you can turn off peer verification by
325+
326+
```ruby
327+
github = Github.new ssl: { verify: false }
328+
```
316329

330+
If your client fails to find CA certs, you can pass other SSL options to specify exactly how the information is sourced
331+
332+
```ruby
333+
ssl: {
334+
client_cert: "/usr/local/www.example.com/client_cert.pem"
335+
client_key: "/user/local/www.example.com/client_key.pem"
336+
ca_file: "example.com.cert"
337+
ca_path: "/etc/ssl/"
338+
}
339+
```
340+
341+
For instance, download CA root certificates from Mozilla [cacert](http://curl.haxx.se/ca/cacert.pem) and point ca_file at your certificate bundle location. This will allow the client to verify the github.com ssl certificate as authentic.
317342

318343
## 3 Authentication
319344

@@ -393,93 +418,20 @@ github.oauth.app.delete 'client-id', 'access-token'
393418
You can check OAuth scopes you have by:
394419

395420
```ruby
396-
github = Github.new :oauth_token => 'token'
397-
github.scopes.list # => ['repo']
421+
github = Github.new :oauth_token => 'token'
422+
github.scopes.list # => ['repo']
398423
```
399424

400425
To list the scopes that the particular GitHub API action checks for do:
401426

402427
```ruby
403-
repos = Github::Repos.new
404-
res = repos.list :user => 'peter-murach'
405-
res.headers.accepted_oauth_scopes # => ['delete_repo', 'repo', 'public_repo', 'repo:status']
428+
repos = Github::Client::Repos.new
429+
response = repos.list user: 'peter-murach'
430+
response.headers.accepted_oauth_scopes # => ['delete_repo', 'repo', 'public_repo']
406431
```
407432

408433
To understand what each scope means refer to [documentation](http://developer.github.com/v3/oauth/#scopes)
409434

410-
## 5 SSL
411-
412-
By default requests over SSL are set to OpenSSL::SSL::VERIFY_PEER. However, you can turn off peer verification by
413-
414-
```ruby
415-
Github.new ssl: { verify: false }
416-
```
417-
418-
If your client fails to find CA certs, you can pass other SSL options to specify exactly how the information is sourced
419-
420-
```ruby
421-
ssl: {
422-
client_cert: "/usr/local/www.example.com/client_cert.pem"
423-
client_key: "/user/local/www.example.com/client_key.pem"
424-
ca_file: "example.com.cert"
425-
ca_path: "/etc/ssl/"
426-
}
427-
```
428-
429-
For instance, download CA root certificates from Mozilla [cacert](http://curl.haxx.se/ca/cacert.pem) and point ca_file at your certificate bundle location.
430-
This will allow the client to verify the github.com ssl certificate as authentic.
431-
432-
## 6 API
433-
434-
Main API methods are grouped into the following classes that can be instantiated on their own
435-
436-
```ruby
437-
Github - full API access
438-
439-
Github::Gists Github::GitData Github::Repos Github::Search
440-
Github::Orgs Github::Issues Github::Authorizations
441-
Github::PullRequests Github::Users Github::Activity
442-
```
443-
444-
Some parts of GitHub API v3 require you to be authenticated, for instance the following are examples of APIs only for the authenticated user
445-
446-
```ruby
447-
Github::Users::Emails
448-
Github::Users::Keys
449-
```
450-
451-
All method calls form Ruby like sentences and allow for intuitive API navigation, for instance
452-
453-
```ruby
454-
github = Github.new :oauth_token => '...'
455-
github.users.followers.following 'wycats' # => returns users that 'wycats' is following
456-
github.users.followers.following? 'wycats' # => returns true if following, otherwise false
457-
```
458-
459-
For specifications on all available methods, go to http://developer.github.com/v3/ or
460-
read the rdoc. All methods are documented there with examples of usage.
461-
462-
Alternatively, you can find out which methods are supported by calling `actions` on a class instance in your `irb`:
463-
464-
```ruby
465-
>> Github::Repos.actions >> github.issues.actions
466-
--- ---
467-
|--> all |--> all
468-
|--> branches |--> comments
469-
|--> collaborators |--> create
470-
|--> commits |--> edit
471-
|--> contribs |--> events
472-
|--> contributors |--> find
473-
|--> create |--> get
474-
|--> downloads |--> labels
475-
|--> edit |--> list
476-
|--> find |--> list_repo
477-
|--> forks |--> list_repository
478-
|--> get |--> milestones
479-
|--> hooks ...
480-
...
481-
```
482-
483435
## 7 Media Types
484436

485437
You can specify custom media types to choose the format of the data you wish to receive. To make things easier you can specify the following shortcuts

0 commit comments

Comments
 (0)