Skip to content

Commit 7047c50

Browse files
committed
Merge and resolve conflicts.
2 parents 2642af3 + fb9b61a commit 7047c50

152 files changed

Lines changed: 1890 additions & 1401 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
0.9.0 (Feb 18, 2013)
2+
3+
* Add Pagination module to define interface for the response
4+
* Add Pagination#count_pages to return total number of pages
5+
* Add ResponeWrapper to define response returned by the client request
6+
* Add Response::Header to scope header information which fixes bug #89
7+
* Improvements to page_request method to work on api instance rather than global api configuration, allows for concurrent pagination requests
8+
* Improvements and fixes to PageIterator, mainly changed links path parsing
9+
* Fix pagination for the GitHub Enterprise
10+
* Change Configuration to call reset! method
11+
* Change Github::API to preserve current options accross instances
12+
* Remove api_client global helper to allow for thread safe behaviour accross many client instances
13+
* Change ApiFactory to be more efficient and accept blocks
14+
* Change all Api instances to accept options hash and block
15+
16+
0.8.11 (Feb 9, 2013)
17+
18+
* Fix preserving query params in page iterator next action.
19+
* Add meta api.
20+
121
0.8.10 (Feb 4, 2013)
222

323
* Fix reference validation in GitData::References.validate_reference

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
PATH
22
remote: .
33
specs:
4-
github_api (0.8.10)
4+
github_api (0.9.0)
55
faraday (~> 0.8.1)
6-
hashie (~> 1.2.0)
6+
hashie (~> 2.0)
77
multi_json (~> 1.4)
88
nokogiri (~> 1.5.2)
99
oauth2
@@ -35,7 +35,7 @@ GEM
3535
guard (>= 0.8.3)
3636
guard-rspec (0.5.7)
3737
guard (>= 0.8.4)
38-
hashie (1.2.0)
38+
hashie (2.0.0)
3939
httpauth (0.1)
4040
json (1.6.6)
4141
multi_json (1.4.0)

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ Supports all the API methods(nearly 200). It's build in a modular way, that is,
1818
* Modular design allows for working with parts of API.
1919
* Fully customizable including advanced middleware stack construction.
2020
* Its comprehensive, you can request all GitHub API resources.
21-
* Requests pagination.
22-
* Easy error handling.
21+
* Requests pagination with convenient DSL.
22+
* Easy error handling split for client and server type errors.
23+
* Supports multithreaded environment.
2324
* Custom mime types specification (Status: TODO)
2425
* Flexible arguments parsing (Status: In progress).
2526
* Request results caching (Status: TODO)
26-
* Fully tested with test coverage above 90% with over 1,300 specs and 700 features.
27+
* Fully tested with test coverage above 90% with over 1,400 specs and 700 features.
2728

2829
## Installation
2930

@@ -59,7 +60,7 @@ At this stage you can also supply various configuration parameters, such as `:us
5960
github = Github.new oauth_token: 'token'
6061
```
6162

62-
Alternatively, you can configure the Github settings by passing a block, for instance, with custom enteprise endpoint like
63+
Alternatively, you can configure the Github settings by passing a block, for instance, with custom enterprise endpoint like
6364

6465
```ruby
6566
github = Github.new do |config|
@@ -300,7 +301,7 @@ To list the scopes that the particular Github API action checks for do:
300301
```ruby
301302
repos = Github::Repos.new
302303
res = repos.list :user => 'peter-murach'
303-
res.accepted_oauth_scopes # => ['delete_repo', 'repo', 'public_repo', 'repo:status']
304+
res.header.accepted_oauth_scopes # => ['delete_repo', 'repo', 'public_repo', 'repo:status']
304305
```
305306

306307
To understand what each scope means refer to [documentation](http://developer.github.com/v3/oauth/#scopes)
@@ -324,6 +325,9 @@ If your client fails to find CA certs you can pass other SSL options to specify
324325
}
325326
```
326327

328+
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.
329+
This will allow the client to verify the github.com ssl certificate as authentic.
330+
327331
## MIME Types
328332

329333
Issues, PullRequests and few other API leverage custom mime types which are <tt>:json</tt>, <tt>:blob</tt>, <tt>:raw</tt>, <tt>:text</tt>, <tt>:html</tt>, <tt>:full</tt>. By default <tt>:raw</tt> is used.
@@ -400,11 +404,12 @@ end
400404
One can also navigate straight to specific page by:
401405

402406
```ruby
403-
res.page 5 # Requests given page if it exists, nil otherwise
404-
res.first_page
405-
res.prev_page
406-
res.next_page
407-
res.last_page
407+
res.count_pages # Number of pages
408+
res.page 5 # Requests given page if it exists, nil otherwise
409+
res.first_page # Get first page
410+
res.next_page # Get next page
411+
res.prev_page # Get previous page
412+
res.last_page # Get last page
408413
```
409414

410415
## Error Handling
@@ -431,10 +436,12 @@ Each response comes packaged with methods allowing for inspection of HTTP start
431436

432437
```ruby
433438
res = Github::Repos.new.branches 'peter-murach', 'github'
434-
res.ratelimit_limit # "5000"
435-
res.ratelimit_remainig # "4999"
436-
res.status # "200"
437-
res.content_type # "application/json; charset=utf-8"
439+
res.headers.ratelimit_limit # "5000"
440+
res.headers.ratelimit_remainig # "4999"
441+
res.headers.status # "200"
442+
res.headers.content_type # "application/json; charset=utf-8"
443+
res.headers.etag # "\"2c5dfc54b3fe498779ef3a9ada9a0af9\""
444+
res.headers.cache_control # "public, max-age=60, s-maxage=60"
438445
```
439446

440447
## Examples
@@ -476,16 +483,19 @@ A Rails controller that allows a user to authorize their GitHub account and then
476483
```ruby
477484
class GithubController < ApplicationController
478485

486+
attr_accessor :github
487+
private :github
488+
479489
def authorize
480-
github = Github.new :client_id => '...', :client_secret => '...'
481-
address = github.authorize_url :redirect_uri => 'http://...', :scope => 'repo'
490+
github = Github.new client_id: '...', client_secret: '...'
491+
address = github.authorize_url redirect_uri: 'http://...', scope: 'repo'
482492
redirect_to address
483493
end
484494

485495
def callback
486496
authorization_code = params[:code]
487-
token = github.get_token authorization_code
488-
access_token = token.token
497+
access_token = github.get_token authorization_code
498+
access_token.token # => returns token value
489499
end
490500
end
491501
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: Notifications API
2+
3+
Background:
4+
Given I have "Github::Activity::Notifications" instance
5+
6+
Scenario: List
7+
8+
Given I want to list resources
9+
And I pass the following request options:
10+
| user | repo |
11+
| wycats | handlebars.js |
12+
When I make request within a cassette named "activity/notifications/list_user"
13+
Then the response status should be 200
14+
And the response type should be JSON
15+
And the response should be empty

features/cassettes/activity/notifications/list_user.yml

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

features/cassettes/git_data/commits/get.yml

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

features/cassettes/meta/get.yml

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)