github_api 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -5
- data/Rakefile +2 -0
- data/features/repos/statuses.feature +12 -12
- data/lib/github_api/api.rb +1 -1
- data/lib/github_api/authorizations.rb +3 -3
- data/lib/github_api/events.rb +7 -7
- data/lib/github_api/gists.rb +7 -7
- data/lib/github_api/gists/comments.rb +4 -4
- data/lib/github_api/git_data/blobs.rb +2 -3
- data/lib/github_api/git_data/commits.rb +2 -3
- data/lib/github_api/git_data/references.rb +10 -17
- data/lib/github_api/git_data/tags.rb +2 -3
- data/lib/github_api/git_data/trees.rb +2 -3
- data/lib/github_api/issues.rb +4 -6
- data/lib/github_api/issues/assignees.rb +5 -4
- data/lib/github_api/issues/comments.rb +5 -10
- data/lib/github_api/issues/events.rb +2 -3
- data/lib/github_api/issues/labels.rb +11 -20
- data/lib/github_api/issues/milestones.rb +5 -8
- data/lib/github_api/orgs.rb +2 -2
- data/lib/github_api/orgs/members.rb +7 -7
- data/lib/github_api/orgs/teams.rb +13 -13
- data/lib/github_api/page_iterator.rb +3 -1
- data/lib/github_api/pull_requests.rb +8 -16
- data/lib/github_api/pull_requests/comments.rb +5 -10
- data/lib/github_api/repos.rb +27 -8
- data/lib/github_api/repos/collaborators.rb +4 -7
- data/lib/github_api/repos/commits.rb +9 -16
- data/lib/github_api/repos/downloads.rb +5 -7
- data/lib/github_api/repos/forks.rb +3 -3
- data/lib/github_api/repos/hooks.rb +10 -13
- data/lib/github_api/repos/keys.rb +5 -8
- data/lib/github_api/repos/pub_sub_hubbub.rb +4 -4
- data/lib/github_api/repos/starring.rb +4 -4
- data/lib/github_api/repos/statuses.rb +2 -2
- data/lib/github_api/repos/watching.rb +4 -4
- data/lib/github_api/users/followers.rb +3 -3
- data/lib/github_api/users/keys.rb +3 -3
- data/lib/github_api/validations/presence.rb +16 -17
- data/lib/github_api/version.rb +1 -1
- data/spec/fixtures/repos/repos_sorted_by_pushed.json +56 -0
- data/spec/github/git_data_spec.rb +5 -7
- data/spec/github/issues_spec.rb +12 -12
- data/spec/github/orgs_spec.rb +2 -4
- data/spec/github/pull_requests_spec.rb +1 -1
- data/spec/github/repos/branch_spec.rb +48 -0
- data/spec/github/repos/branches_spec.rb +62 -0
- data/spec/github/repos/contributors_spec.rb +62 -0
- data/spec/github/repos/create_spec.rb +77 -0
- data/spec/github/repos/delete_spec.rb +43 -0
- data/spec/github/repos/downloads_spec.rb +51 -45
- data/spec/github/repos/edit_spec.rb +66 -0
- data/spec/github/repos/forks/create_spec.rb +49 -0
- data/spec/github/repos/forks/list_spec.rb +65 -0
- data/spec/github/repos/get_spec.rb +57 -0
- data/spec/github/repos/languages_spec.rb +61 -0
- data/spec/github/repos/list_spec.rb +99 -0
- data/spec/github/repos/tags_spec.rb +59 -0
- data/spec/github/repos/teams_spec.rb +59 -0
- data/spec/github/repos_spec.rb +13 -578
- data/spec/github/validations/presence_spec.rb +23 -4
- metadata +48 -42
- data/spec/github/repos/forks_spec.rb +0 -106
@@ -6,13 +6,32 @@ describe Github::Validations::Presence do
|
|
6
6
|
|
7
7
|
let(:validator) { Class.new.extend(described_class) }
|
8
8
|
|
9
|
-
context '#
|
10
|
-
it '
|
11
|
-
|
9
|
+
context '#assert_presence_of' do
|
10
|
+
it 'checks hash with nil value' do
|
11
|
+
user, repo = nil, 'github_api'
|
12
12
|
expect {
|
13
|
-
validator.
|
13
|
+
validator.assert_presence_of user, repo
|
14
14
|
}.to raise_error(ArgumentError)
|
15
15
|
end
|
16
|
+
|
17
|
+
it 'asserts array without nil value' do
|
18
|
+
user, repo = 'peter-murach', 'github_api'
|
19
|
+
expect {
|
20
|
+
validator.assert_presence_of user, repo
|
21
|
+
}.to_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'assert hash with nil value' do
|
25
|
+
args = {:user => nil, :repo => 'github_api'}
|
26
|
+
expect { validator.assert_presence_of args }.
|
27
|
+
to raise_error(Github::Error::Validations)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'asserts hash without nil value' do
|
31
|
+
args = {:user => 'peter-murach', :repo => 'github_api'}
|
32
|
+
expect { validator.assert_presence_of args }.
|
33
|
+
to_not raise_error(Github::Error::Validations)
|
34
|
+
end
|
16
35
|
end
|
17
36
|
|
18
37
|
end # Github::Validations::Presence
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154977880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154977880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154977380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154977380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154976920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.3'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154976920
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154976540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154976540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154976000 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.5.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154976000
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154975500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154975500
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154975040 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154975040
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154990960 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.8.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154990960
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &2154990500 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,21 +109,21 @@ dependencies:
|
|
109
109
|
version: 2.2.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2154990500
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
|
-
requirement: &
|
115
|
+
requirement: &2154990040 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.
|
120
|
+
version: 0.7.1
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2154990040
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: guard
|
126
|
-
requirement: &
|
126
|
+
requirement: &2154989660 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *2154989660
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: guard-rspec
|
137
|
-
requirement: &
|
137
|
+
requirement: &2154989200 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *2154989200
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: guard-cucumber
|
148
|
-
requirement: &
|
148
|
+
requirement: &2154988780 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *2154988780
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rake
|
159
|
-
requirement: &
|
159
|
+
requirement: &2154988360 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *2154988360
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: bundler
|
170
|
-
requirement: &
|
170
|
+
requirement: &2154987940 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,7 +175,7 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *2154987940
|
179
179
|
description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
|
180
180
|
200). It''s build in a modular way, that is, you can either instantiate the whole
|
181
181
|
api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
|
@@ -469,6 +469,7 @@ files:
|
|
469
469
|
- spec/fixtures/repos/repo.json
|
470
470
|
- spec/fixtures/repos/repo_comments.json
|
471
471
|
- spec/fixtures/repos/repos.json
|
472
|
+
- spec/fixtures/repos/repos_sorted_by_pushed.json
|
472
473
|
- spec/fixtures/repos/stargazers.json
|
473
474
|
- spec/fixtures/repos/starred.json
|
474
475
|
- spec/fixtures/repos/status.json
|
@@ -525,17 +526,29 @@ files:
|
|
525
526
|
- spec/github/parameter_filter_spec.rb
|
526
527
|
- spec/github/pull_requests/comments_spec.rb
|
527
528
|
- spec/github/pull_requests_spec.rb
|
529
|
+
- spec/github/repos/branch_spec.rb
|
530
|
+
- spec/github/repos/branches_spec.rb
|
528
531
|
- spec/github/repos/collaborators_spec.rb
|
529
532
|
- spec/github/repos/commits_spec.rb
|
530
533
|
- spec/github/repos/contents_spec.rb
|
534
|
+
- spec/github/repos/contributors_spec.rb
|
535
|
+
- spec/github/repos/create_spec.rb
|
536
|
+
- spec/github/repos/delete_spec.rb
|
531
537
|
- spec/github/repos/downloads_spec.rb
|
532
|
-
- spec/github/repos/
|
538
|
+
- spec/github/repos/edit_spec.rb
|
539
|
+
- spec/github/repos/forks/create_spec.rb
|
540
|
+
- spec/github/repos/forks/list_spec.rb
|
541
|
+
- spec/github/repos/get_spec.rb
|
533
542
|
- spec/github/repos/hooks_spec.rb
|
534
543
|
- spec/github/repos/keys_spec.rb
|
544
|
+
- spec/github/repos/languages_spec.rb
|
545
|
+
- spec/github/repos/list_spec.rb
|
535
546
|
- spec/github/repos/merging_spec.rb
|
536
547
|
- spec/github/repos/pub_sub_hubbub_spec.rb
|
537
548
|
- spec/github/repos/starring_spec.rb
|
538
549
|
- spec/github/repos/statuses_spec.rb
|
550
|
+
- spec/github/repos/tags_spec.rb
|
551
|
+
- spec/github/repos/teams_spec.rb
|
539
552
|
- spec/github/repos/watching_spec.rb
|
540
553
|
- spec/github/repos_spec.rb
|
541
554
|
- spec/github/request/jsonize_spec.rb
|
@@ -566,14 +579,7 @@ files:
|
|
566
579
|
homepage: https://github.com/peter-murach/github
|
567
580
|
licenses: []
|
568
581
|
post_install_message: ! "\n--------------------------------------------------------------------------------\nThank
|
569
|
-
you for installing github_api-0.7.
|
570
|
-
changes to the way github api is queried.\nThe interface has been rewritten to be
|
571
|
-
more consistent with REST verbs that\ninteract with GitHub hypermedia resources.
|
572
|
-
Thus, to list resources 'list' or 'all'\nverbs are used, to retrieve individual
|
573
|
-
resource 'get' or 'find' verbs are used.\nOther CRUDE operations on all resources
|
574
|
-
use preditable verbs as well, such as\n'create', 'delete' etc...\n\nAgain sorry
|
575
|
-
for the inconvenience but I trust that this will help in easier access to\nthe GitHub
|
576
|
-
API and library .\n\nFor more information: http://rubydoc.info/github/peter-murach/github/master/frames\n\n--------------------------------------------------------------------------------\n
|
582
|
+
you for installing github_api-0.7.1.\n\nFor more information: https://github.com/peter-murach/github\n--------------------------------------------------------------------------------\n
|
577
583
|
\ "
|
578
584
|
rdoc_options: []
|
579
585
|
require_paths:
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Github::Repos::Forks do
|
4
|
-
let(:github) { Github.new }
|
5
|
-
let(:user) { 'peter-murach' }
|
6
|
-
let(:repo) { 'github' }
|
7
|
-
|
8
|
-
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
9
|
-
|
10
|
-
describe "#list" do
|
11
|
-
it { github.repos.forks.should respond_to :all }
|
12
|
-
|
13
|
-
context "resource found" do
|
14
|
-
before do
|
15
|
-
stub_get("/repos/#{user}/#{repo}/forks").
|
16
|
-
to_return(:body => fixture('repos/forks.json'), :status => 200,
|
17
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should fail to get resource without username" do
|
21
|
-
expect { github.repos.forks.list }.to raise_error(ArgumentError)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should get the resources" do
|
25
|
-
github.repos.forks.list user, repo
|
26
|
-
a_get("/repos/#{user}/#{repo}/forks").should have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return array of resources" do
|
30
|
-
forks = github.repos.forks.list user, repo
|
31
|
-
forks.should be_an Array
|
32
|
-
forks.should have(1).items
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should be a mash type" do
|
36
|
-
forks = github.repos.forks.list user, repo
|
37
|
-
forks.first.should be_a Hashie::Mash
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should get fork information" do
|
41
|
-
forks = github.repos.forks.list user, repo
|
42
|
-
forks.first.name.should == 'Hello-World'
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should yield to a block" do
|
46
|
-
github.repos.forks.should_receive(:list).with(user, repo).and_yield('web')
|
47
|
-
github.repos.forks.list(user, repo) { |param| 'web' }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "resource not found" do
|
52
|
-
before do
|
53
|
-
stub_get("/repos/#{user}/#{repo}/forks").
|
54
|
-
to_return(:body => "", :status => [404, "Not Found"])
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should return 404 with a message 'Not Found'" do
|
58
|
-
expect {
|
59
|
-
github.repos.forks.list user, repo
|
60
|
-
}.to raise_error(Github::Error::NotFound)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end # list
|
64
|
-
|
65
|
-
describe "#create" do
|
66
|
-
let(:inputs) { {:org => 'github'} }
|
67
|
-
|
68
|
-
context "resouce created" do
|
69
|
-
before do
|
70
|
-
stub_post("/repos/#{user}/#{repo}/forks").with(inputs).
|
71
|
-
to_return(:body => fixture('repos/fork.json'), :status => 201,
|
72
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should create resource successfully" do
|
76
|
-
github.repos.forks.create(user, repo, inputs)
|
77
|
-
a_post("/repos/#{user}/#{repo}/forks").with(inputs).should have_been_made
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should return the resource" do
|
81
|
-
fork = github.repos.forks.create user, repo, inputs
|
82
|
-
fork.should be_a Hashie::Mash
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should get the fork information" do
|
86
|
-
fork = github.repos.forks.create user, repo, inputs
|
87
|
-
fork.name.should == 'Hello-World'
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
context "failed to create resource" do
|
92
|
-
before do
|
93
|
-
stub_post("/repos/#{user}/#{repo}/forks").with(inputs).
|
94
|
-
to_return(:body => fixture('repos/fork.json'), :status => 404,
|
95
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should faile to retrieve resource" do
|
99
|
-
expect {
|
100
|
-
github.repos.forks.create user, repo, inputs
|
101
|
-
}.to raise_error(Github::Error::NotFound)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end # create
|
105
|
-
|
106
|
-
end # Github::Repos::Forks
|