github_api 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/README.md +20 -1
  2. data/features/cassettes/issues/events/get.yml +139 -0
  3. data/features/cassettes/issues/events/list_issue.yml +71 -0
  4. data/features/cassettes/issues/events/list_repo.yml +222 -0
  5. data/features/cassettes/issues/labels/list_repo.yml +65 -0
  6. data/features/cassettes/issues/milestones/create.yml +55 -0
  7. data/features/cassettes/issues/milestones/delete.yml +46 -0
  8. data/features/cassettes/issues/milestones/get.yml +175 -0
  9. data/features/cassettes/issues/milestones/list.yml +54 -0
  10. data/features/cassettes/issues/milestones/update.yml +53 -0
  11. data/features/cassettes/repos/contents/archive.yml +43 -84
  12. data/features/cassettes/say/custom.yml +60 -0
  13. data/features/cassettes/say/random.yml +60 -0
  14. data/features/issues/events.feature +38 -0
  15. data/features/issues/labels.feature +14 -0
  16. data/features/issues/milestones.feature +62 -0
  17. data/features/say.feature +68 -0
  18. data/features/step_definitions/common_steps.rb +6 -0
  19. data/features/support/helpers.rb +4 -0
  20. data/lib/github_api.rb +2 -0
  21. data/lib/github_api/client.rb +8 -0
  22. data/lib/github_api/constants.rb +4 -0
  23. data/lib/github_api/issues.rb +74 -46
  24. data/lib/github_api/issues/assignees.rb +2 -1
  25. data/lib/github_api/issues/events.rb +3 -3
  26. data/lib/github_api/issues/milestones.rb +0 -1
  27. data/lib/github_api/rate_limit.rb +2 -0
  28. data/lib/github_api/result.rb +13 -0
  29. data/lib/github_api/say.rb +24 -0
  30. data/lib/github_api/scopes.rb +19 -0
  31. data/lib/github_api/version.rb +1 -1
  32. data/spec/github/git_data/git_data_spec.rb +19 -0
  33. data/spec/github/issues/assignees/check_spec.rb +46 -0
  34. data/spec/github/issues/assignees/list_spec.rb +47 -0
  35. data/spec/github/issues/assignees_spec.rb +0 -96
  36. data/spec/github/issues/create_spec.rb +60 -0
  37. data/spec/github/issues/edit_spec.rb +61 -0
  38. data/spec/github/issues/events_spec.rb +4 -4
  39. data/spec/github/issues/get_spec.rb +49 -0
  40. data/spec/github/issues/issues_spec.rb +19 -0
  41. data/spec/github/issues/list_spec.rb +90 -0
  42. data/spec/github/issues/milestones/create_spec.rb +56 -0
  43. data/spec/github/issues/milestones/delete_spec.rb +42 -0
  44. data/spec/github/issues/milestones/get_spec.rb +49 -0
  45. data/spec/github/issues/milestones/list_spec.rb +52 -0
  46. data/spec/github/issues/milestones/update_spec.rb +57 -0
  47. data/spec/github/issues/milestones_spec.rb +1 -276
  48. data/spec/github/scopes/list_spec.rb +33 -0
  49. data/spec/github/users/followers/follow_spec.rb +33 -0
  50. data/spec/github/users/followers/following_spec.rb +65 -0
  51. data/spec/github/users/followers/is_following_spec.rb +41 -0
  52. data/spec/github/users/followers/list_spec.rb +2 -8
  53. data/spec/github/users/followers/unfollow_spec.rb +33 -0
  54. data/spec/github/users/users_spec.rb +16 -0
  55. metadata +68 -35
  56. data/spec/github/git_data_spec.rb +0 -11
  57. data/spec/github/issues_spec.rb +0 -284
  58. data/spec/github/users/followers_spec.rb +0 -172
@@ -1,95 +1,54 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://<BASIC_AUTH>@api.github.com/repos/tarball/master?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
- - Mon, 11 Jun 2012 19:38:50 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-Limit:
34
- - "5000"
35
- X-Ratelimit-Remaining:
36
- - "4996"
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: Mon, 11 Jun 2012 19:38:50 GMT
48
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
49
4
  method: get
50
5
  uri: https://<BASIC_AUTH>@api.github.com/repos/peter-murach/github/tarball/master?access_token=<TOKEN>
51
- body:
6
+ body:
52
7
  encoding: US-ASCII
53
- string: ""
54
- headers:
55
- Accept-Encoding:
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/jsonapplication/vnd.github+json;q=0.7application/vnd.github.v3.raw+json;q=0.5application/vnd.github.beta.raw+json;q=0.1
12
+ Accept-Charset:
13
+ - utf-8
14
+ User-Agent:
15
+ - Github Ruby Gem 0.8.2
16
+ Content-Type:
17
+ - application/json
18
+ Accept-Encoding:
56
19
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
- Accept:
58
- - "*/*"
59
- User-Agent:
60
- - Ruby
61
- response:
62
- status:
20
+ response:
21
+ status:
63
22
  code: 302
64
23
  message: Found
65
- headers:
66
- Server:
67
- - nginx/1.0.13
68
- Date:
69
- - Mon, 11 Jun 2012 19:40:39 GMT
70
- Content-Type:
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 08 Dec 2012 11:16:57 GMT
29
+ Content-Type:
71
30
  - text/html;charset=utf-8
72
- Connection:
31
+ Connection:
73
32
  - keep-alive
74
- Status:
33
+ Status:
75
34
  - 302 Found
76
- X-Ratelimit-Limit:
77
- - "5000"
78
- Etag:
79
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
80
- Location:
81
- - https://nodeload.github.com/peter-murach/github/tarball/master
82
- X-Ratelimit-Remaining:
83
- - "4995"
84
- Content-Length:
85
- - "0"
86
- Expires:
87
- - Mon, 11 Jun 2012 19:40:39 GMT
88
- Cache-Control:
35
+ Content-Length:
36
+ - '0'
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Expires:
40
+ - Sat, 08 Dec 2012 11:16:57 GMT
41
+ X-Ratelimit-Limit:
42
+ - '5000'
43
+ Location:
44
+ - https://nodeload.github.com/peter-murach/github/legacy.tar.gz/master
45
+ X-Ratelimit-Remaining:
46
+ - '4999'
47
+ Cache-Control:
89
48
  - public, must-revalidate, max-age=0
90
- body:
49
+ body:
91
50
  encoding: US-ASCII
92
- string: ""
93
- http_version:
94
- recorded_at: Mon, 11 Jun 2012 19:40:39 GMT
95
- recorded_with: VCR 2.2.0
51
+ string: '[]'
52
+ http_version: !!null
53
+ recorded_at: Sat, 08 Dec 2012 11:16:57 GMT
54
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<BASIC_AUTH>@api.github.com/octocat?access_token=<TOKEN>&s=Hello%20cool%20world
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/jsonapplication/vnd.github+json;q=0.7application/vnd.github.v3.raw+json;q=0.5application/vnd.github.beta.raw+json;q=0.1
12
+ Accept-Charset:
13
+ - utf-8
14
+ User-Agent:
15
+ - Github Ruby Gem 0.8.2
16
+ Content-Type:
17
+ - application/json
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 08 Dec 2012 12:40:26 GMT
29
+ Content-Type:
30
+ - text/plain
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Status:
36
+ - 200 OK
37
+ Etag:
38
+ - ! '"b3fb1a0738afea59be10ba210c1eb0d5"'
39
+ X-Ratelimit-Remaining:
40
+ - '4999'
41
+ X-Ratelimit-Limit:
42
+ - '5000'
43
+ Cache-Control:
44
+ - max-age=0, private, must-revalidate
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ Content-Encoding:
48
+ - gzip
49
+ body:
50
+ encoding: ASCII-8BIT
51
+ string: !binary |-
52
+ H4sIAAAAAAAAA5VROw7CMAzdewrvVc2eqjtLr0AHYIsUiYUl8tmxX0Lj8BHC
53
+ SlPbz8+/DNRkXVd2Jqs99LB6OvkBF/L2Jo72mhG28bKrXNXceB9pIGY6XmNM
54
+ dE4p0j3d4oUa7wsNvE2vvtOeF8JEUygCbe/04PuSIJpIEFc0qWtkJtQPgYkV
55
+ HfWDBi8xu7Xo7pGBeGOCpm/jt03INQOaTa3gVLZnG0PaHTipY8Qiq7973OpT
56
+ rJy+lHH+hlh08HbEtS8qOqCBCNLhzLUXNUNkWey0v48gH/IM7AJs0lBz1IDh
57
+ AWrVM8ztAgAA
58
+ http_version: !!null
59
+ recorded_at: Sat, 08 Dec 2012 12:40:26 GMT
60
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<BASIC_AUTH>@api.github.com/octocat?access_token=<TOKEN>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/jsonapplication/vnd.github+json;q=0.7application/vnd.github.v3.raw+json;q=0.5application/vnd.github.beta.raw+json;q=0.1
12
+ Accept-Charset:
13
+ - utf-8
14
+ User-Agent:
15
+ - Github Ruby Gem 0.8.2
16
+ Content-Type:
17
+ - application/json
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 08 Dec 2012 12:09:12 GMT
29
+ Content-Type:
30
+ - text/plain
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Status:
36
+ - 200 OK
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Ratelimit-Limit:
40
+ - '5000'
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Ratelimit-Remaining:
44
+ - '4998'
45
+ Etag:
46
+ - ! '"2876b06f1b31f4d3fa325bb223b6f4a7"'
47
+ Content-Encoding:
48
+ - gzip
49
+ body:
50
+ encoding: ASCII-8BIT
51
+ string: !binary |-
52
+ H4sIAAAAAAAAA5VSUQ6CMAz95xT9V+r/CEfgChITSeRDMIgxJKRnt+0m64yK
53
+ NgPavre3diWDaFVVoQmR4yyFOZPYCuw31z+ZkXo9RWPRmk01X9w5ar2VUrEZ
54
+ qrY7wtTfBrj3w/G6hfHUTHAYGmjPl34YD92IELU+SKlWza/1LlMt53LInTf1
55
+ li53tn5yxOKkPO9RGAsiaE3OISCjG37U0ywgmivlWaoCYI2gHs/aTg9Uq1Co
56
+ EDeAub95uW2VXYA9JzY6hJBPfpaQY8yv9CjZ8zeExI3HRaZ8YuMGBVQSNyep
57
+ 5VAJiMpSVvxaBljKk5gQpFMXNAIhewBuXOr6PQMAAA==
58
+ http_version: !!null
59
+ recorded_at: Sat, 08 Dec 2012 12:09:12 GMT
60
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,38 @@
1
+ Feature: Events API
2
+
3
+ Background:
4
+ Given I have "Github::Issues::Events" instance
5
+
6
+ Scenario: List for a repository
7
+
8
+ Given I want to list resources with the following params:
9
+ | user | repo |
10
+ | peter-murach | github |
11
+ When I make request within a cassette named "issues/events/list_repo"
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: List for an issue
17
+
18
+ Given I want to list resources with the following params:
19
+ | user | repo |
20
+ | peter-murach | github |
21
+ And I pass the following request options:
22
+ | issue_id |
23
+ | 61 |
24
+ When I make request within a cassette named "issues/events/list_issue"
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
30
+
31
+ Given I want to get resource with the following params:
32
+ | user | repo | event_id |
33
+ | peter-murach | github | 29376722 |
34
+ When I make request within a cassette named "issues/events/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
+
@@ -0,0 +1,14 @@
1
+ Feature: Labels API
2
+
3
+ Background:
4
+ Given I have "Github::Issues::Labels" instance
5
+
6
+ Scenario: List in a repository
7
+
8
+ Given I want to list resources with the following params:
9
+ | user | repo |
10
+ | peter-murach | github |
11
+ When I make request within a cassette named "issues/labels/list_repo"
12
+ Then the response status should be 200
13
+ And the response type should be JSON
14
+ And the response should not be empty
@@ -0,0 +1,62 @@
1
+ Feature: Milestones API
2
+
3
+ Background:
4
+ Given I have "Github::Issues::Milestones" 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
+ When I make request within a cassette named "issues/milestones/list"
12
+ Then the response status should be 200
13
+ And the response type should be JSON
14
+ And the response should be empty
15
+
16
+ Scenario: Get a single milestone
17
+
18
+ Given I want to get resource with the following params:
19
+ | user | repo | milestone_id |
20
+ | josh | rails-behaviors | 1 |
21
+ And I pass the following request options:
22
+ | state |
23
+ | closed |
24
+ When I make request within a cassette named "issues/milestones/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
28
+
29
+ Scenario: Create
30
+
31
+ Given I want to create resource with the following params:
32
+ | user | repo |
33
+ | murek | github_api_test |
34
+ And I pass the following request options:
35
+ | title | state | description |
36
+ | fix-all | open | fixing all issues |
37
+ When I make request within a cassette named "issues/milestones/create"
38
+ Then the response status should be 201
39
+ And the response type should be JSON
40
+ And the response should not be empty
41
+
42
+ Scenario: Update
43
+
44
+ Given I want to update resource with the following params:
45
+ | user | repo | milestone_id |
46
+ | murek | github_api_test | 1 |
47
+ And I pass the following request options:
48
+ | state |
49
+ | closed |
50
+ When I make request within a cassette named "issues/milestones/update"
51
+ Then the response status should be 200
52
+ And the response type should be JSON
53
+ And the response should not be empty
54
+
55
+ Scenario: Delete
56
+
57
+ Given I want to delete resource with the following params:
58
+ | user | repo | milestone_id |
59
+ | murek | github_api_test | 1 |
60
+ When I make request within a cassette named "issues/milestones/delete"
61
+ Then the response status should be 204
62
+
@@ -0,0 +1,68 @@
1
+ Feature: Octocat ASCII API
2
+
3
+ Background:
4
+ Given I have "Github::Say" instance
5
+
6
+ Scenario: ASCII octocat with random text
7
+
8
+ Given I want to say resource
9
+ When I make request within a cassette named "say/random"
10
+ Then the response status should be 200
11
+ And the response type should be TEXT
12
+ And the response should contain:
13
+ """
14
+ MMM. .MMM
15
+ MMMMMMMMMMMMMMMMMMM
16
+ MMMMMMMMMMMMMMMMMMM ______________________________________
17
+ MMMMMMMMMMMMMMMMMMMMM | |
18
+ MMMMMMMMMMMMMMMMMMMMMMM | Mind your words, they are important. |
19
+ MMMMMMMMMMMMMMMMMMMMMMMM |_ __________________________________|
20
+ MMMM::- -:::::::- -::MMMM |/
21
+ MM~:~ ~:::::~ ~:~MM
22
+ .. MMMMM::. .:::+:::. .::MMMMM ..
23
+ .MM::::: ._. :::::MM.
24
+ MMMM;:::::;MMMM
25
+ -MM MMMMMMM
26
+ ^ M+ MMMMMMMMM
27
+ MMMMMMM MM MM MM
28
+ MM MM MM MM
29
+ MM MM MM MM
30
+ .~~MM~MM~MM~MM~~.
31
+ ~~~~MM:~MM~~~MM~:MM~~~~
32
+ ~~~~~~==~==~~~==~==~~~~~~
33
+ ~~~~~~==~==~==~==~~~~~~
34
+ :~==~==~==~==~~
35
+ """
36
+
37
+ Scenario: ASCII octocat with custom text
38
+
39
+ Given I want to say resource with the following params:
40
+ | text |
41
+ | Hello cool world |
42
+ When I make request within a cassette named "say/custom"
43
+ Then the response status should be 200
44
+ And the response type should be TEXT
45
+ And the response should contain:
46
+ """
47
+ MMM. .MMM
48
+ MMMMMMMMMMMMMMMMMMM
49
+ MMMMMMMMMMMMMMMMMMM __________________
50
+ MMMMMMMMMMMMMMMMMMMMM | |
51
+ MMMMMMMMMMMMMMMMMMMMMMM | Hello cool world |
52
+ MMMMMMMMMMMMMMMMMMMMMMMM |_ ______________|
53
+ MMMM::- -:::::::- -::MMMM |/
54
+ MM~:~ ~:::::~ ~:~MM
55
+ .. MMMMM::. .:::+:::. .::MMMMM ..
56
+ .MM::::: ._. :::::MM.
57
+ MMMM;:::::;MMMM
58
+ -MM MMMMMMM
59
+ ^ M+ MMMMMMMMM
60
+ MMMMMMM MM MM MM
61
+ MM MM MM MM
62
+ MM MM MM MM
63
+ .~~MM~MM~MM~MM~~.
64
+ ~~~~MM:~MM~~~MM~:MM~~~~
65
+ ~~~~~~==~==~~~==~==~~~~~~
66
+ ~~~~~~==~==~==~==~~~~~~
67
+ :~==~==~==~==~~
68
+ """