github_api 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README.md +1 -1
  2. data/features/cassettes/ratelimit/get.yml +64 -0
  3. data/features/cassettes/ratelimit/get_remaining.yml +64 -0
  4. data/features/cassettes/repos/contents/create.yml +60 -0
  5. data/features/cassettes/repos/contents/delete.yml +59 -0
  6. data/features/cassettes/repos/contents/update.yml +62 -0
  7. data/features/issues.feature +3 -3
  8. data/features/pagination.feature +12 -12
  9. data/features/rate_limit.feature +16 -0
  10. data/features/repos/contents.feature +39 -0
  11. data/features/support/settings.rb +5 -1
  12. data/features/support/vcr.rb +1 -0
  13. data/lib/github_api/issues.rb +2 -16
  14. data/lib/github_api/jsonable.rb +1 -0
  15. data/lib/github_api/params_hash.rb +13 -0
  16. data/lib/github_api/rate_limit.rb +8 -4
  17. data/lib/github_api/repos.rb +2 -2
  18. data/lib/github_api/repos/contents.rb +110 -0
  19. data/lib/github_api/response/raise_error.rb +2 -2
  20. data/lib/github_api/version.rb +1 -1
  21. data/spec/fixtures/repos/content_created.json +44 -0
  22. data/spec/fixtures/repos/content_deleted.json +30 -0
  23. data/spec/github/api_spec.rb +2 -0
  24. data/spec/github/issues/list_spec.rb +10 -0
  25. data/spec/github/mime_type_spec.rb +2 -0
  26. data/spec/github/normalizer_spec.rb +2 -0
  27. data/spec/github/parameter_filter_spec.rb +2 -0
  28. data/spec/github/params_hash_spec.rb +5 -0
  29. data/spec/github/repos/contents/create_spec.rb +41 -0
  30. data/spec/github/repos/contents/delete_spec.rb +55 -0
  31. data/spec/github/repos/downloads/delete_spec.rb +2 -3
  32. data/spec/github/request/jsonize_spec.rb +2 -0
  33. data/spec/github/request/oauth2_spec.rb +2 -0
  34. data/spec/github/s3_uploader_spec.rb +2 -0
  35. data/spec/github/utils/url_spec.rb +2 -0
  36. data/spec/github/validations_spec.rb +2 -0
  37. data/spec/integration/multiple_invocations_spec.rb +2 -2
  38. metadata +52 -42
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Github::Repos::Contents, '#delete' do
6
+ let(:user) { 'peter-murach' }
7
+ let(:repo) { 'github' }
8
+ let(:path) { 'hello.rb' }
9
+ let(:params) {
10
+ {
11
+ "path" => 'hello.rb',
12
+ "message" => "initial commit",
13
+ "sha" => "329688480d39049927147c162b9d2deaf885005f"
14
+ }
15
+ }
16
+ let(:request_path) { "/repos/#{user}/#{repo}/contents/#{path}" }
17
+
18
+ after { reset_authentication_for(subject) }
19
+
20
+ before do
21
+ stub_delete(request_path).with(:query => params).
22
+ to_return(:body => body, :status => status,
23
+ :headers => { :content_type => "application/json; charset=utf-8"})
24
+ end
25
+
26
+ context "resource deleted successfully" do
27
+ let(:body) { fixture('repos/content_deleted.json') }
28
+ let(:status) { 200 }
29
+
30
+ it { expect { subject.delete }.to raise_error(ArgumentError) }
31
+
32
+ it "should fail to delete without 'user/repo' parameters" do
33
+ expect { subject.delete user }.to raise_error(ArgumentError)
34
+ end
35
+
36
+ it "should fail to delete resource without 'path'" do
37
+ expect { subject.delete user, repo, path }.to raise_error(Github::Error::RequiredParams)
38
+ end
39
+
40
+ it "should delete the resource" do
41
+ subject.delete user, repo, path, params
42
+ a_delete(request_path).with(:query => params).should have_been_made
43
+ end
44
+
45
+ it "gets repository contents information" do
46
+ content = subject.delete user, repo, path, params
47
+ content.content.should be_nil
48
+ end
49
+ end
50
+
51
+ it_should_behave_like 'request failure' do
52
+ let(:requestable) { subject.delete user, repo, path, params }
53
+ end
54
+
55
+ end # delete
@@ -3,13 +3,12 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Github::Repos::Downloads, '#delete' do
6
- let(:github) { Github.new }
7
6
  let(:user) { 'peter-murach' }
8
7
  let(:repo) { 'github' }
9
8
  let(:download_id) { 1 }
10
9
  let(:request_path) { "/repos/#{user}/#{repo}/downloads/#{download_id}" }
11
10
 
12
- after { reset_authentication_for(github) }
11
+ after { reset_authentication_for(subject) }
13
12
 
14
13
  before do
15
14
  stub_delete(request_path).
@@ -34,7 +33,7 @@ describe Github::Repos::Downloads, '#delete' do
34
33
  end
35
34
 
36
35
  it "should delete the resource" do
37
- github.repos.downloads.delete user, repo, download_id
36
+ subject.delete user, repo, download_id
38
37
  a_delete(request_path).should have_been_made
39
38
  end
40
39
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::Request::Jsonize do
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::Request::OAuth2 do
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'github_api/s3_uploader'
3
5
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::Utils::Url do
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::Validations do
@@ -12,7 +12,7 @@ describe Github, 'invocations' do
12
12
  let(:request_path) { "/repos/#{user}/#{repo}/commits/#{sha}" }
13
13
 
14
14
  before {
15
- stub_get(request_path).to_return(:body => nil, :status => 200,
15
+ stub_get(request_path).to_return(:body => '{}', :status => 200,
16
16
  :headers => {:content_type => "application/json; charset=utf-8"})
17
17
  }
18
18
 
@@ -29,7 +29,7 @@ describe Github, 'invocations' do
29
29
  let(:request_path) { "/orgs/#{org}" }
30
30
 
31
31
  before {
32
- stub_get(request_path).to_return(:body => nil, :status => 200,
32
+ stub_get(request_path).to_return(:body => '{}', :status => 200,
33
33
  :headers => {:content_type => "application/json; charset=utf-8"})
34
34
  }
35
35
 
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.10.1
4
+ version: 0.10.2
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: 2013-05-21 00:00:00.000000000Z
12
+ date: 2013-06-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
16
- requirement: &2154241560 !ruby/object:Gem::Requirement
16
+ requirement: &2152015820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154241560
24
+ version_requirements: *2152015820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hashie
27
- requirement: &2154240960 !ruby/object:Gem::Requirement
27
+ requirement: &2151930220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '1.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154240960
35
+ version_requirements: *2151930220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
38
- requirement: &2154240280 !ruby/object:Gem::Requirement
38
+ requirement: &2151913460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.8.1
43
+ version: 0.8.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2154240280
46
+ version_requirements: *2151913460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &2154239600 !ruby/object:Gem::Requirement
49
+ requirement: &2151910760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '1.4'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2154239600
57
+ version_requirements: *2151910760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: oauth2
60
- requirement: &2154238640 !ruby/object:Gem::Requirement
60
+ requirement: &2151909400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,21 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2154238640
68
+ version_requirements: *2151909400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
- requirement: &2154237880 !ruby/object:Gem::Requirement
71
+ requirement: &2151903160 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: 1.5.2
76
+ version: 1.6.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2154237880
79
+ version_requirements: *2151903160
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2154236840 !ruby/object:Gem::Requirement
82
+ requirement: &2151901180 !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: *2154236840
90
+ version_requirements: *2151901180
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: cucumber
93
- requirement: &2154235860 !ruby/object:Gem::Requirement
93
+ requirement: &2151895660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,32 +98,32 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2154235860
101
+ version_requirements: *2151895660
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: webmock
104
- requirement: &2154234980 !ruby/object:Gem::Requirement
104
+ requirement: &2151889260 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 1.9.0
109
+ version: 1.11.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *2154234980
112
+ version_requirements: *2151889260
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: vcr
115
- requirement: &2154234380 !ruby/object:Gem::Requirement
115
+ requirement: &2151884320 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
- - - ~>
118
+ - - ! '>='
119
119
  - !ruby/object:Gem::Version
120
- version: 2.4.0
120
+ version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *2154234380
123
+ version_requirements: *2151884320
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: simplecov
126
- requirement: &2154233420 !ruby/object:Gem::Requirement
126
+ requirement: &2151881100 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,21 +131,21 @@ dependencies:
131
131
  version: 0.7.1
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2154233420
134
+ version_requirements: *2151881100
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: coveralls
137
- requirement: &2154232320 !ruby/object:Gem::Requirement
137
+ requirement: &2151878740 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
141
141
  - !ruby/object:Gem::Version
142
- version: 0.5.8
142
+ version: 0.6.7
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2154232320
145
+ version_requirements: *2151878740
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: guard
148
- requirement: &2154231940 !ruby/object:Gem::Requirement
148
+ requirement: &2151877260 !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: *2154231940
156
+ version_requirements: *2151877260
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: guard-rspec
159
- requirement: &2154231480 !ruby/object:Gem::Requirement
159
+ requirement: &2151874940 !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: *2154231480
167
+ version_requirements: *2151874940
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: guard-cucumber
170
- requirement: &2154231060 !ruby/object:Gem::Requirement
170
+ requirement: &2151871800 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2154231060
178
+ version_requirements: *2151871800
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rake
181
- requirement: &2154230580 !ruby/object:Gem::Requirement
181
+ requirement: &2151865660 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2154230580
189
+ version_requirements: *2151865660
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: bundler
192
- requirement: &2154230160 !ruby/object:Gem::Requirement
192
+ requirement: &2151858620 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,7 +197,7 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2154230160
200
+ version_requirements: *2151858620
201
201
  description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
202
202
  200). It''s build in a modular way, that is, you can either instantiate the whole
203
203
  api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
@@ -326,11 +326,16 @@ files:
326
326
  - features/cassettes/pull_requests/comments/list_repo.yml
327
327
  - features/cassettes/pull_requests/get.yml
328
328
  - features/cassettes/pull_requests/list.yml
329
+ - features/cassettes/ratelimit/get.yml
330
+ - features/cassettes/ratelimit/get_remaining.yml
329
331
  - features/cassettes/repos/branch.yml
330
332
  - features/cassettes/repos/branches.yml
331
333
  - features/cassettes/repos/contents/archive.yml
334
+ - features/cassettes/repos/contents/create.yml
335
+ - features/cassettes/repos/contents/delete.yml
332
336
  - features/cassettes/repos/contents/get.yml
333
337
  - features/cassettes/repos/contents/readme.yml
338
+ - features/cassettes/repos/contents/update.yml
334
339
  - features/cassettes/repos/create.yml
335
340
  - features/cassettes/repos/forks/list.yml
336
341
  - features/cassettes/repos/forks/list_sort.yml
@@ -385,6 +390,7 @@ files:
385
390
  - features/pagination.feature
386
391
  - features/pull_requests/comments.feature
387
392
  - features/pull_requests.feature
393
+ - features/rate_limit.feature
388
394
  - features/README.rdoc
389
395
  - features/repos/contents.feature
390
396
  - features/repos/forks.feature
@@ -572,6 +578,8 @@ files:
572
578
  - spec/fixtures/repos/commit_comparison.json
573
579
  - spec/fixtures/repos/commits.json
574
580
  - spec/fixtures/repos/content.json
581
+ - spec/fixtures/repos/content_created.json
582
+ - spec/fixtures/repos/content_deleted.json
575
583
  - spec/fixtures/repos/contribs.json
576
584
  - spec/fixtures/repos/contributors.json
577
585
  - spec/fixtures/repos/download.json
@@ -785,6 +793,8 @@ files:
785
793
  - spec/github/repos/commits/get_spec.rb
786
794
  - spec/github/repos/commits/list_spec.rb
787
795
  - spec/github/repos/contents/archive_spec.rb
796
+ - spec/github/repos/contents/create_spec.rb
797
+ - spec/github/repos/contents/delete_spec.rb
788
798
  - spec/github/repos/contents/get_spec.rb
789
799
  - spec/github/repos/contents/readme_spec.rb
790
800
  - spec/github/repos/contributors_spec.rb