github_api 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. data/README.md +3 -3
  2. data/features/cassettes/events/issue.yml +64 -32
  3. data/features/cassettes/events/network.yml +63 -32
  4. data/features/cassettes/events/org.yml +61 -31
  5. data/features/cassettes/events/performed.yml +63 -32
  6. data/features/cassettes/events/public.yml +61 -31
  7. data/features/cassettes/events/received.yml +63 -32
  8. data/features/cassettes/events/repo.yml +63 -32
  9. data/features/cassettes/gists/comments/all.yml +32 -1
  10. data/features/cassettes/gists/comments/first.yml +32 -1
  11. data/features/cassettes/gists/fork.yml +63 -31
  12. data/features/cassettes/gists/gist.yml +32 -1
  13. data/features/cassettes/gists/gists/public_all.yml +32 -1
  14. data/features/cassettes/gists/gists/starred.yml +60 -29
  15. data/features/cassettes/gists/gists/user_all.yml +87 -1
  16. data/features/cassettes/gists/star.yml +58 -27
  17. data/features/cassettes/gists/starred.yml +32 -1
  18. data/features/cassettes/gists/unstar.yml +54 -25
  19. data/features/cassettes/git_data/references/all.yml +32 -1
  20. data/features/cassettes/git_data/references/all_tags.yml +32 -1
  21. data/features/cassettes/git_data/references/one.yml +32 -1
  22. data/features/cassettes/issues/create.yml +46 -0
  23. data/features/cassettes/issues/edit.yml +44 -0
  24. data/features/cassettes/issues/get.yml +62 -0
  25. data/features/cassettes/issues/list/repo.yml +251 -0
  26. data/features/cassettes/issues/list/user.yml +44 -0
  27. data/features/cassettes/orgs/get.yml +60 -30
  28. data/features/cassettes/orgs/list/oauth_user.yml +60 -29
  29. data/features/cassettes/orgs/list/user.yml +87 -57
  30. data/features/cassettes/pagination/issues/list/first.yml +65 -33
  31. data/features/cassettes/pagination/issues/list/last.yml +66 -33
  32. data/features/cassettes/pagination/repos/commits/list.yml +32 -1
  33. data/features/cassettes/pagination/repos/commits/sha.yml +32 -1
  34. data/features/cassettes/pagination/repos/diff.yml +32 -1
  35. data/features/cassettes/pagination/repos/list.yml +32 -1
  36. data/features/cassettes/pagination/repos/per_page/first.yml +32 -1
  37. data/features/cassettes/pull_requests/get.yml +120 -0
  38. data/features/cassettes/pull_requests/list.yml +254 -0
  39. data/features/cassettes/repos/branches.yml +32 -1
  40. data/features/cassettes/repos/contents/archive.yml +95 -0
  41. data/features/cassettes/repos/contents/get.yml +226 -0
  42. data/features/cassettes/repos/contents/readme.yml +271 -0
  43. data/features/cassettes/repos/get.yml +61 -31
  44. data/features/cassettes/repos/languages.yml +61 -30
  45. data/features/cassettes/repos/list.yml +32 -1
  46. data/features/cassettes/repos/tags.yml +32 -1
  47. data/features/cassettes/search/email.yml +99 -0
  48. data/features/cassettes/search/issues.yml +180 -0
  49. data/features/cassettes/search/repos.yml +396 -0
  50. data/features/cassettes/search/users.yml +54 -0
  51. data/features/cassettes/users/emails/add.yml +61 -30
  52. data/features/cassettes/users/emails/all.yml +61 -30
  53. data/features/cassettes/users/get/oauth.yml +61 -0
  54. data/features/cassettes/users/get/user.yml +62 -0
  55. data/features/issues.feature +64 -0
  56. data/features/pull_requests.feature +27 -0
  57. data/features/repos/contents.feature +35 -0
  58. data/features/search.feature +48 -0
  59. data/features/users.feature +23 -0
  60. data/lib/github_api.rb +1 -0
  61. data/lib/github_api/api.rb +0 -15
  62. data/lib/github_api/client.rb +4 -0
  63. data/lib/github_api/constants.rb +4 -0
  64. data/lib/github_api/error.rb +1 -0
  65. data/lib/github_api/error/unknown_value.rb +18 -0
  66. data/lib/github_api/filter.rb +1 -0
  67. data/lib/github_api/gists.rb +2 -6
  68. data/lib/github_api/gists/comments.rb +2 -2
  69. data/lib/github_api/git_data/blobs.rb +1 -1
  70. data/lib/github_api/git_data/commits.rb +1 -1
  71. data/lib/github_api/git_data/references.rb +2 -2
  72. data/lib/github_api/git_data/tags.rb +1 -1
  73. data/lib/github_api/git_data/trees.rb +2 -3
  74. data/lib/github_api/issues.rb +6 -6
  75. data/lib/github_api/issues/comments.rb +2 -2
  76. data/lib/github_api/issues/labels.rb +2 -2
  77. data/lib/github_api/issues/milestones.rb +3 -3
  78. data/lib/github_api/orgs/teams.rb +4 -4
  79. data/lib/github_api/params_hash.rb +31 -0
  80. data/lib/github_api/pull_requests.rb +2 -2
  81. data/lib/github_api/pull_requests/comments.rb +2 -2
  82. data/lib/github_api/repos.rb +8 -10
  83. data/lib/github_api/repos/commits.rb +2 -2
  84. data/lib/github_api/repos/contents.rb +64 -0
  85. data/lib/github_api/repos/downloads.rb +1 -1
  86. data/lib/github_api/repos/hooks.rb +2 -2
  87. data/lib/github_api/repos/keys.rb +1 -1
  88. data/lib/github_api/result.rb +8 -0
  89. data/lib/github_api/search.rb +98 -0
  90. data/lib/github_api/users.rb +8 -6
  91. data/lib/github_api/users/emails.rb +2 -2
  92. data/lib/github_api/validations/format.rb +4 -3
  93. data/lib/github_api/validations/required.rb +5 -2
  94. data/lib/github_api/version.rb +2 -2
  95. data/spec/fixtures/repos/content.json +14 -0
  96. data/spec/fixtures/repos/readme.json +14 -0
  97. data/spec/fixtures/search/email.json +22 -0
  98. data/spec/fixtures/search/issues.json +23 -0
  99. data/spec/fixtures/search/repositories.json +29 -0
  100. data/spec/fixtures/search/users.json +24 -0
  101. data/spec/github/error/unknown_value_spec.rb +21 -0
  102. data/spec/github/repos/contents_spec.rb +65 -0
  103. data/spec/github/search_spec.rb +87 -0
  104. data/spec/github/users_spec.rb +7 -7
  105. data/spec/github/validations/format_spec.rb +6 -6
  106. data/spec/github/validations/required_spec.rb +3 -3
  107. metadata +69 -35
@@ -1,44 +1,75 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: post
5
5
  uri: https://<BASIC_AUTH>@api.github.com/user/emails?access_token=<TOKEN>
6
- body:
6
+ body:
7
7
  encoding: UTF-8
8
- string: "[\"octocat@example.com\",\"terry@example.com\"]"
9
- headers:
10
- Content-Type:
8
+ string: ! '["octocat@example.com","terry@example.com"]'
9
+ headers:
10
+ Content-Type:
11
11
  - application/json
12
- Accept:
13
- - "*/*"
14
- User-Agent:
12
+ Accept:
13
+ - ! '*/*'
14
+ User-Agent:
15
15
  - Ruby
16
- response:
17
- status:
16
+ response:
17
+ status:
18
18
  code: 201
19
19
  message: Created
20
- headers:
21
- Server:
20
+ headers:
21
+ Server:
22
22
  - nginx/1.0.13
23
- Date:
23
+ Date:
24
24
  - Sun, 20 May 2012 10:32:18 GMT
25
- Content-Type:
25
+ Content-Type:
26
26
  - application/json; charset=utf-8
27
- Connection:
27
+ Connection:
28
28
  - keep-alive
29
- Status:
29
+ Status:
30
30
  - 201 Created
31
- X-Ratelimit-Limit:
32
- - "5000"
33
- Etag:
34
- - "\"0abdbd0947127ead3e9b00aef1c145b1\""
35
- X-Ratelimit-Remaining:
36
- - "4990"
37
- Content-Length:
38
- - "59"
39
- body:
31
+ X-Ratelimit-Limit:
32
+ - '5000'
33
+ Etag:
34
+ - ! '"0abdbd0947127ead3e9b00aef1c145b1"'
35
+ X-Ratelimit-Remaining:
36
+ - '4990'
37
+ Content-Length:
38
+ - '59'
39
+ body:
40
40
  encoding: US-ASCII
41
- string: "[\"octocat@example.com\",\"terry@example.com\",\"<EMAIL>\"]"
42
- http_version:
41
+ string: ! '["octocat@example.com","terry@example.com","<EMAIL>"]'
42
+ http_version: !!null
43
43
  recorded_at: Sun, 20 May 2012 10:32:18 GMT
44
- recorded_with: VCR 2.1.1
44
+ - request:
45
+ method: post
46
+ uri: https://api.github.com/user/emails?access_token=<TOKEN>
47
+ body:
48
+ encoding: UTF-8
49
+ string: ! '["octocat@example.com","terry@example.com"]'
50
+ headers:
51
+ Content-Type:
52
+ - application/json
53
+ Accept:
54
+ - ! '*/*'
55
+ User-Agent:
56
+ - Ruby
57
+ response:
58
+ status:
59
+ code: 500
60
+ message: Internal Server Error
61
+ headers:
62
+ Server:
63
+ - nginx/1.0.13
64
+ Date:
65
+ - Sat, 09 Jun 2012 14:59:52 GMT
66
+ Transfer-Encoding:
67
+ - chunked
68
+ Connection:
69
+ - keep-alive
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ''
73
+ http_version: !!null
74
+ recorded_at: Sat, 09 Jun 2012 14:59:52 GMT
75
+ recorded_with: VCR 2.2.0
@@ -1,44 +1,75 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://<BASIC_AUTH>@api.github.com/user/emails?access_token=<TOKEN>
6
- body:
6
+ body:
7
7
  encoding: US-ASCII
8
- string: ""
9
- headers:
10
- Accept-Encoding:
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
11
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
12
+ Accept:
13
+ - ! '*/*'
14
+ User-Agent:
15
15
  - Ruby
16
- response:
17
- status:
16
+ response:
17
+ status:
18
18
  code: 200
19
19
  message: OK
20
- headers:
21
- Server:
20
+ headers:
21
+ Server:
22
22
  - nginx/1.0.13
23
- Date:
23
+ Date:
24
24
  - Sun, 20 May 2012 09:53:28 GMT
25
- Content-Type:
25
+ Content-Type:
26
26
  - application/json; charset=utf-8
27
- Connection:
27
+ Connection:
28
28
  - keep-alive
29
- Status:
29
+ Status:
30
30
  - 200 OK
31
- X-Ratelimit-Limit:
32
- - "5000"
33
- Etag:
34
- - "\"e411c2596673397775541ed7eb41a3cc\""
35
- X-Ratelimit-Remaining:
36
- - "4995"
37
- Content-Length:
38
- - "17"
39
- body:
31
+ X-Ratelimit-Limit:
32
+ - '5000'
33
+ Etag:
34
+ - ! '"e411c2596673397775541ed7eb41a3cc"'
35
+ X-Ratelimit-Remaining:
36
+ - '4995'
37
+ Content-Length:
38
+ - '17'
39
+ body:
40
40
  encoding: US-ASCII
41
- string: "[\"<EMAIL>\"]"
42
- http_version:
41
+ string: ! '["<EMAIL>"]'
42
+ http_version: !!null
43
43
  recorded_at: Sun, 20 May 2012 09:53:28 GMT
44
- recorded_with: VCR 2.1.1
44
+ - request:
45
+ method: get
46
+ uri: https://api.github.com/user/emails?access_token=<TOKEN>
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ''
50
+ headers:
51
+ Accept-Encoding:
52
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
53
+ Accept:
54
+ - ! '*/*'
55
+ User-Agent:
56
+ - Ruby
57
+ response:
58
+ status:
59
+ code: 500
60
+ message: Internal Server Error
61
+ headers:
62
+ Server:
63
+ - nginx/1.0.13
64
+ Date:
65
+ - Sat, 09 Jun 2012 14:59:30 GMT
66
+ Transfer-Encoding:
67
+ - chunked
68
+ Connection:
69
+ - keep-alive
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ''
73
+ http_version: !!null
74
+ recorded_at: Sat, 09 Jun 2012 14:59:30 GMT
75
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<BASIC_AUTH>@api.github.com/user?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: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.0.13
23
+ Date:
24
+ - Mon, 11 Jun 2012 21:31:28 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - 200 OK
33
+ X-Ratelimit-Limit:
34
+ - "5000"
35
+ Vary:
36
+ - Accept, Authorization, Cookie
37
+ Etag:
38
+ - "\"202d99b964a36da44cf3964b1678c1a2\""
39
+ Last-Modified:
40
+ - Sun, 20 May 2012 10:27:30 GMT
41
+ X-Ratelimit-Remaining:
42
+ - "4997"
43
+ Cache-Control:
44
+ - private, max-age=60
45
+ Content-Encoding:
46
+ - gzip
47
+ body:
48
+ encoding: ASCII-8BIT
49
+ string: !binary |
50
+ H4sIAAAAAAAAA4VSQW7DIBD8C1Jvjg2YxKmlqre+oL30Yq0xdpCxQYAbVVH+
51
+ 3k0cp4lSqRKHZTU7zOxwINIaA7X1EK0PpKQJ2cXBVJM3pMQyulBmWafjbqpT
52
+ aYdsmLzqSULit1OI+AjK463z8AURfKUbbG6prCVt5UbSvBF5K57XNc8Fr3PW
53
+ KtECDhjb6RGhC53zGglU1ekQZxnRRjDV0vfK2bkvvUJgU0HEcU4ZW+HhxTtj
54
+ paBlTj+R/SLm3kRQErWni9SzmxmY/Sf4tXlZVgFcbFOVQg8D6HRUMYMQVAzp
55
+ 746e+JseoFMBi+W123rFBE3d2KFQux/RyqPJFlOxe42YUyKNDn01BaQkZSFY
56
+ QtxUGy2ry1KKhNw7Badv5GQTZhSuwc3U2DlTOwMYw+GPb/AoKjiQqCCnBac4
57
+ OsJw+gGtV4ocE3JKnnGes/XmKvCSJjv+AEryqZpoAgAA
58
+
59
+ http_version:
60
+ recorded_at: Mon, 11 Jun 2012 21:31:28 GMT
61
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<BASIC_AUTH>@api.github.com/users/peter-murach?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: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.0.13
23
+ Date:
24
+ - Mon, 11 Jun 2012 21:31:23 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - 200 OK
33
+ X-Ratelimit-Limit:
34
+ - "5000"
35
+ Vary:
36
+ - Accept, Authorization, Cookie
37
+ Etag:
38
+ - "\"87b8964bc91a72b5eda0f821aa6b5203\""
39
+ Last-Modified:
40
+ - Sun, 20 May 2012 12:33:20 GMT
41
+ X-Ratelimit-Remaining:
42
+ - "4998"
43
+ Cache-Control:
44
+ - private, max-age=60
45
+ Content-Encoding:
46
+ - gzip
47
+ body:
48
+ encoding: ASCII-8BIT
49
+ string: !binary |
50
+ H4sIAAAAAAAAA4WRzWrDMBCEXyUIenP8FzmxDaW3Xkqh0ObSi1lba1tUtowk
51
+ t4TSd+8qiWmSS0GHXWl29DH7zXo3qGo2ipVUusmWUdRJ18912OghmtChWQ+z
52
+ gaZnAXOHCUm4t2ioI8EE44EuqKmV7qi6HAj/jLxAalaOs1IB6wx8ggNTSUEj
53
+ bZ3yQmTZlkPc5k0Gcb0tMBa7RGR5wQuaJW853rjTNQ4gPbhnMQgORQWO+jRO
54
+ 4rU/+VuyKzdJGcfvR5cGnNTe6LXHtpWoRLDaj5IGV09y7IQeSHZmu87EYjMb
55
+ DBfyYzgnYfQf/4O4X5KFlOchhvABRB6O6CKwFp29SOoufZQDdGipWH67rNcJ
56
+ j8Np7Ai01UrpL+JmZZYG7BoYJnnhGs20Mnu7zpMBPbAyyQM2wuC3+yK1M6vn
57
+ ZefTXCvZVJ20zusC1kvKulYkbUFZDJjfIud8kxDEWW1w0l7Nf34BcE+elGIC
58
+ AAA=
59
+
60
+ http_version:
61
+ recorded_at: Mon, 11 Jun 2012 21:31:23 GMT
62
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,64 @@
1
+ Feature: Issues API
2
+
3
+ Background:
4
+ Given I have "Github::Issues" instance
5
+
6
+ Scenario: List
7
+
8
+ Given I want to list resources
9
+ And I pass the following request options:
10
+ | filter | state | sort | direction |
11
+ | created | open | created | asc |
12
+ When I make request within a cassette named "issues/list/user"
13
+ Then the response status should be 200
14
+ And the response type should be JSON
15
+
16
+ Scenario: List on repository
17
+
18
+ Given I want to list_repo resources with the following params:
19
+ | user | repo |
20
+ | peter-murach | github |
21
+ And I pass the following request options:
22
+ | state | assignee | sort | direction |
23
+ | closed | none | created | asc |
24
+ When I make request within a cassette named "issues/list/repo"
25
+ Then the response status should be 200
26
+ And the response type should be JSON
27
+ And the response should not be empty
28
+
29
+ Scenario: Get single
30
+
31
+ Given I want to get resource with the following params:
32
+ | user | repo | issue_id |
33
+ | peter-murach | github | 15 |
34
+ When I make request within a cassette named "issues/get"
35
+ Then the response status should be 200
36
+ And the response type should be JSON
37
+ And the response should not be empty
38
+
39
+ Scenario: Create
40
+
41
+ Given I want to create resource with the following params:
42
+ | user | repo |
43
+ | murek | github_api_test |
44
+ And I pass the following request options:
45
+ | title | body | assignee |
46
+ | Found a bug | Im having a problem | murek |
47
+ When I make request within a cassette named "issues/create"
48
+ Then the response status should be 201
49
+ And the response type should be JSON
50
+ And the response should not be empty
51
+
52
+ Scenario: Edit
53
+
54
+ Given I want to edit resource with the following params:
55
+ | user | repo | issue_id |
56
+ | murek | github_api_test | 1 |
57
+ And I pass the following request options:
58
+ | body |
59
+ | Im having a problem with this |
60
+ When I make request within a cassette named "issues/edit"
61
+ Then the response status should be 200
62
+ And the response type should be JSON
63
+ And the response should not be empty
64
+
@@ -0,0 +1,27 @@
1
+ Feature: Pull Requests API
2
+
3
+ Background:
4
+ Given I have "Github::PullRequests" instance
5
+
6
+ Scenario: List
7
+
8
+ Given I want to list resources with the following params:
9
+ | user | repo |
10
+ | peter-murach | github |
11
+ And I pass the following request options:
12
+ | state |
13
+ | closed |
14
+ When I make request within a cassette named "pull_requests/list"
15
+ Then the response status should be 200
16
+ And the response type should be JSON
17
+ And the response should not be empty
18
+
19
+ Scenario: Get
20
+
21
+ Given I want to get resource with the following params:
22
+ | user | repo | request_id |
23
+ | peter-murach | github | 36 |
24
+ When I make request within a cassette named "pull_requests/get"
25
+ Then the response status should be 200
26
+ And the response type should be JSON
27
+ And the response should not be empty
@@ -0,0 +1,35 @@
1
+ Feature: Contents API
2
+
3
+ Background:
4
+ Given I have "Github::Repos::Contents" instance
5
+
6
+ Scenario: Readme
7
+
8
+ Given I want readme resource with the following params:
9
+ | user | repo |
10
+ | peter-murach | github |
11
+ When I make request within a cassette named "repos/contents/readme"
12
+ Then the response status should be 200
13
+ And the response type should be JSON
14
+ And the response should not be empty
15
+
16
+ Scenario: Get file contents
17
+
18
+ Given I want get resource with the following params:
19
+ | user | repo | path |
20
+ | peter-murach | github | README.md |
21
+ When I make request within a cassette named "repos/contents/get"
22
+ Then the response status should be 200
23
+ And the response type should be JSON
24
+ And the response should not be empty
25
+
26
+ Scenario: Archive
27
+
28
+ Given I want archive resource with the following params:
29
+ | user | repo |
30
+ | peter-murach | github |
31
+ And I pass the following request options:
32
+ | archive_format | ref |
33
+ | tarball | master |
34
+ When I make request within a cassette named "repos/contents/archive"
35
+ Then the response status should be 302