github_api 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/README.md +78 -59
  2. data/features/cassettes/repos/assets/delete.yml +52 -0
  3. data/features/cassettes/repos/assets/edit.yml +65 -0
  4. data/features/cassettes/repos/assets/get.yml +74 -0
  5. data/features/cassettes/repos/assets/list.yml +73 -0
  6. data/features/cassettes/repos/assets/upload.yml +66 -0
  7. data/features/cassettes/repos/list_org.yml +167 -0
  8. data/features/cassettes/repos/list_org_instance.yml +300 -0
  9. data/features/cassettes/repos/releases/create.yml +64 -0
  10. data/features/cassettes/repos/releases/delete.yml +52 -0
  11. data/features/cassettes/repos/releases/edit.yml +63 -0
  12. data/features/cassettes/repos/releases/get.yml +78 -0
  13. data/features/cassettes/repos/releases/list.yml +81 -0
  14. data/features/cassettes/search/code.yml +252 -0
  15. data/features/cassettes/search/code_query.yml +65 -0
  16. data/features/cassettes/search/issues.yml +616 -170
  17. data/features/cassettes/search/legacy/email.yml +72 -0
  18. data/features/cassettes/search/legacy/issues.yml +119 -0
  19. data/features/cassettes/search/legacy/repos.yml +394 -0
  20. data/features/cassettes/search/legacy/users.yml +72 -0
  21. data/features/cassettes/search/legacy/users_keyword.yml +63 -0
  22. data/features/cassettes/search/repos.yml +375 -364
  23. data/features/cassettes/search/users.yml +40 -22
  24. data/features/cassettes/search/users_keyword.yml +51 -56
  25. data/features/repos.feature +22 -0
  26. data/features/repos/assets.feature +59 -0
  27. data/features/repos/releases.feature +58 -0
  28. data/features/search.feature +24 -13
  29. data/features/search/legacy.feature +59 -0
  30. data/features/settings.yml +2 -5
  31. data/features/step_definitions/github_api_steps.rb +12 -0
  32. data/lib/github_api/configuration.rb +3 -1
  33. data/lib/github_api/error.rb +6 -17
  34. data/lib/github_api/error/unknown_media.rb +18 -0
  35. data/lib/github_api/params_hash.rb +20 -10
  36. data/lib/github_api/repos.rb +26 -15
  37. data/lib/github_api/repos/releases.rb +146 -0
  38. data/lib/github_api/repos/releases/assets.rb +126 -0
  39. data/lib/github_api/request.rb +14 -9
  40. data/lib/github_api/resource.rb +8 -1
  41. data/lib/github_api/search.rb +68 -27
  42. data/lib/github_api/search/legacy.rb +94 -0
  43. data/lib/github_api/ssl_certs/cacert.pem +41 -0
  44. data/lib/github_api/ssl_certs/cacerts.pem +2183 -0
  45. data/lib/github_api/version.rb +2 -2
  46. data/spec/fixtures/repos/asset.json +12 -0
  47. data/spec/fixtures/repos/assets.json +14 -0
  48. data/spec/fixtures/repos/release.json +15 -0
  49. data/spec/fixtures/repos/releases.json +17 -0
  50. data/spec/fixtures/search/code.json +76 -0
  51. data/spec/fixtures/search/issues.json +47 -16
  52. data/spec/fixtures/search/issues_legacy.json +23 -0
  53. data/spec/fixtures/search/repos.json +39 -0
  54. data/spec/fixtures/search/{repositories.json → repos_legacy.json} +0 -0
  55. data/spec/fixtures/search/users.json +15 -19
  56. data/spec/fixtures/search/users_legacy.json +24 -0
  57. data/spec/github/configuration_spec.rb +2 -0
  58. data/spec/github/error/unknown_media_spec.rb +21 -0
  59. data/spec/github/git_data/references/create_spec.rb +1 -1
  60. data/spec/github/git_data/references/get_spec.rb +6 -4
  61. data/spec/github/git_data/references/list_spec.rb +6 -16
  62. data/spec/github/pagination/iterator/number_spec.rb +2 -2
  63. data/spec/github/pagination/iterator/sha_spec.rb +2 -2
  64. data/spec/github/params_hash_spec.rb +6 -0
  65. data/spec/github/repos/assets/delete_spec.rb +40 -0
  66. data/spec/github/repos/assets/edit_spec.rb +40 -0
  67. data/spec/github/repos/assets/get_spec.rb +45 -0
  68. data/spec/github/repos/assets/list_spec.rb +55 -0
  69. data/spec/github/repos/assets/upload_spec.rb +44 -0
  70. data/spec/github/repos/downloads/upload_spec.rb +5 -5
  71. data/spec/github/repos/releases/create_spec.rb +44 -0
  72. data/spec/github/repos/releases/delete_spec.rb +40 -0
  73. data/spec/github/repos/releases/edit_spec.rb +40 -0
  74. data/spec/github/repos/releases/get_spec.rb +45 -0
  75. data/spec/github/repos/releases/list_spec.rb +54 -0
  76. data/spec/github/request/endpoint_spec.rb +1 -3
  77. data/spec/github/request/request_spec.rb +4 -8
  78. data/spec/github/request_spec.rb +3 -3
  79. data/spec/github/response_wrapper_spec.rb +3 -3
  80. data/spec/github/s3_uploader_spec.rb +2 -3
  81. data/spec/github/search/code_spec.rb +38 -0
  82. data/spec/github/search/issues_spec.rb +38 -0
  83. data/spec/github/search/legacy/email_spec.rb +34 -0
  84. data/spec/github/search/legacy/issues_spec.rb +39 -0
  85. data/spec/github/search/legacy/repos_spec.rb +36 -0
  86. data/spec/github/search/legacy/users_spec.rb +36 -0
  87. data/spec/github/search/repos_spec.rb +38 -0
  88. data/spec/github/search/users_spec.rb +38 -0
  89. data/spec/github/users/get_spec.rb +1 -1
  90. data/spec/github/validations/presence_spec.rb +2 -5
  91. data/spec/integration/repos_spec.rb +4 -0
  92. data/spec/integration/search_spec.rb +12 -0
  93. metadata +122 -62
  94. data/features/cassettes/search/email.yml +0 -99
  95. data/spec/github/search_spec.rb +0 -102
@@ -1,99 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://<BASIC_AUTH>@api.github.com/legacy/user/email/josevalim?access_token=<TOKEN>
6
- body:
7
- encoding: US-ASCII
8
- string: ""
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 404
19
- message: Not Found
20
- headers:
21
- Server:
22
- - nginx/1.0.13
23
- Date:
24
- - Sat, 09 Jun 2012 17:11:08 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- Status:
32
- - 404 Not Found
33
- X-Ratelimit-Remaining:
34
- - "4996"
35
- X-Ratelimit-Limit:
36
- - "5000"
37
- Etag:
38
- - "\"e66a7a6c91e2c26803f3f49feb7a883f\""
39
- Content-Encoding:
40
- - gzip
41
- body:
42
- encoding: ASCII-8BIT
43
- string: !binary |
44
- H4sIAAAAAAAAA6tWyk0tLk5MT1WyUvLLL1Fwyy/NS1GqBQB8+Ys1FwAAAA==
45
-
46
- http_version:
47
- recorded_at: Sat, 09 Jun 2012 17:11:08 GMT
48
- - request:
49
- method: get
50
- uri: https://<BASIC_AUTH>@api.github.com/legacy/user/email/wycats@gmail.com?access_token=<TOKEN>
51
- body:
52
- encoding: US-ASCII
53
- string: ""
54
- headers:
55
- Accept-Encoding:
56
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
- Accept:
58
- - "*/*"
59
- User-Agent:
60
- - Ruby
61
- response:
62
- status:
63
- code: 200
64
- message: OK
65
- headers:
66
- Server:
67
- - nginx/1.0.13
68
- Date:
69
- - Sat, 09 Jun 2012 17:12:35 GMT
70
- Content-Type:
71
- - application/json; charset=utf-8
72
- Transfer-Encoding:
73
- - chunked
74
- Connection:
75
- - keep-alive
76
- Status:
77
- - 200 OK
78
- X-Ratelimit-Limit:
79
- - "5000"
80
- Etag:
81
- - "\"505de2c3198e37b3dbef26a46dec7168\""
82
- X-Ratelimit-Remaining:
83
- - "4995"
84
- Content-Encoding:
85
- - gzip
86
- body:
87
- encoding: ASCII-8BIT
88
- string: !binary |
89
- H4sIAAAAAAAAAz2QzW7DIBCEXyXibCeAHf+deqpU9dj00JO1wZSgYrAA13Kj
90
- vHsXS86R2ZnZb7mTOUhPujtRHn4hgu/1QDpS8oZVNRRS1JwX5yu0NWMVb3lZ
91
- tryiLcmIcOMEdkXzRZtBZoc3K46oWxglil/yNg9weIf4l8xeQpRDDxFHnNIm
92
- pyxn7MJZVzRdUeS06ShFo3EConYWbR9gD68erNBBOBxN89Vo0Xs5uV642WIV
93
- 4/ypKx3irleszcjVOIU1txin7nRaluW4bkw/iHREeqz8dsa4RVu1B7Eu3V9m
94
- JK5TOuMzfQ/ukH7UIWxgdjZmj0ofntH63CR+pRP8suIdAZNyBG2ewotKz237
95
- 4/EPbxbN2H0BAAA=
96
-
97
- http_version:
98
- recorded_at: Sat, 09 Jun 2012 17:12:35 GMT
99
- recorded_with: VCR 2.2.0
@@ -1,102 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Github::Search do
6
- let(:keyword) { 'api' }
7
-
8
- after { reset_authentication_for(subject) }
9
-
10
- context "#issues" do
11
- let(:owner) { 'peter-murach' }
12
- let(:repo) { 'github' }
13
- let(:state) { 'closed' }
14
-
15
- before do
16
- stub_get("/legacy/issues/search/#{owner}/#{repo}/#{state}/#{keyword}").
17
- to_return(:body => fixture('search/issues.json'), :status => 200,
18
- :headers => {:content_type => "application/json; charset=utf-8"})
19
- end
20
-
21
- it "should get the resources" do
22
- subject.issues owner, repo, state, keyword
23
- a_get("/legacy/issues/search/#{owner}/#{repo}/#{state}/#{keyword}").should have_been_made
24
- end
25
-
26
- it "should get the resources through params hash" do
27
- subject.issues :owner => owner, :repo => repo, :state => state, :keyword => keyword
28
- a_get("/legacy/issues/search/#{owner}/#{repo}/#{state}/#{keyword}").should have_been_made
29
- end
30
-
31
- it "should get issue information" do
32
- issues = subject.issues :owner => owner, :repo => repo, :state => state, :keyword => keyword
33
- issues.issues.first.user.should == 'ckarbass'
34
- end
35
- end
36
-
37
- context "#repositories" do
38
- before do
39
- stub_get("/legacy/repos/search/#{keyword}").
40
- to_return(:body => fixture('search/repositories.json'), :status => 200,
41
- :headers => {:content_type => "application/json; charset=utf-8"})
42
- end
43
-
44
- it { expect { subject.repos }.to raise_error(ArgumentError) }
45
-
46
- it "should get the resources" do
47
- subject.repos keyword
48
- a_get("/legacy/repos/search/#{keyword}").should have_been_made
49
- end
50
-
51
- it "should get the resource through params hash" do
52
- subject.repos :keyword => keyword
53
- a_get("/legacy/repos/search/#{keyword}").should have_been_made
54
- end
55
-
56
- it "should get repository information" do
57
- repos = subject.repos :keyword => keyword
58
- repos.repositories.first.username.should == 'mathiasbynens'
59
- end
60
- end
61
-
62
- context "#users" do
63
- before do
64
- stub_get("/legacy/user/search/#{keyword}").
65
- to_return(:body => fixture('search/users.json'), :status => 200,
66
- :headers => {:content_type => "application/json; charset=utf-8"})
67
- end
68
-
69
- it { expect { subject.users }.to raise_error(ArgumentError) }
70
-
71
- it "should get the resources" do
72
- subject.users :keyword => keyword
73
- a_get("/legacy/user/search/#{keyword}").should have_been_made
74
- end
75
-
76
- it "should get user information" do
77
- users = subject.users :keyword => keyword
78
- users.users.first.username.should == 'techno'
79
- end
80
- end
81
-
82
- context "#email" do
83
- before do
84
- stub_get("/legacy/user/email/#{keyword}").
85
- to_return(:body => fixture('search/email.json'), :status => 200,
86
- :headers => {:content_type => "application/json; charset=utf-8"})
87
- end
88
-
89
- it { expect { subject.email }.to raise_error(Github::Error::RequiredParams) }
90
-
91
- it "should get the resources" do
92
- subject.email :email => keyword
93
- a_get("/legacy/user/email/#{keyword}").should have_been_made
94
- end
95
-
96
- it "should get user information" do
97
- user = subject.email :email => keyword
98
- user.user.username.should == 'techno'
99
- end
100
- end
101
-
102
- end # Github::Search