leadlight 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/Gemfile +9 -0
  2. data/Gemfile.lock +79 -0
  3. data/Guardfile +19 -0
  4. data/Rakefile +133 -0
  5. data/leadlight.gemspec +125 -0
  6. data/lib/leadlight.rb +92 -0
  7. data/lib/leadlight/blank.rb +15 -0
  8. data/lib/leadlight/codec.rb +63 -0
  9. data/lib/leadlight/enumerable_representation.rb +24 -0
  10. data/lib/leadlight/errors.rb +14 -0
  11. data/lib/leadlight/hyperlinkable.rb +126 -0
  12. data/lib/leadlight/link.rb +35 -0
  13. data/lib/leadlight/link_template.rb +47 -0
  14. data/lib/leadlight/representation.rb +30 -0
  15. data/lib/leadlight/request.rb +91 -0
  16. data/lib/leadlight/service.rb +73 -0
  17. data/lib/leadlight/service_middleware.rb +50 -0
  18. data/lib/leadlight/tint.rb +26 -0
  19. data/lib/leadlight/tint_helper.rb +67 -0
  20. data/lib/leadlight/type.rb +71 -0
  21. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/has_the_expected_content.yml +75 -0
  22. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/indicates_the_expected_oath_scopes.yml +75 -0
  23. data/spec/cassettes/Leadlight/authorized_GitHub_example/adding_and_removing_team_members.yml +384 -0
  24. data/spec/cassettes/Leadlight/authorized_GitHub_example/adding_and_removing_team_members/.yml +309 -0
  25. data/spec/cassettes/Leadlight/authorized_GitHub_example/test_team/.yml +159 -0
  26. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/.yml +32 -0
  27. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/__location__/.yml +32 -0
  28. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/should_be_a_204_no_content.yml +32 -0
  29. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/.yml +32 -0
  30. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/__location__/.yml +32 -0
  31. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/should_be_a_204_no_content.yml +32 -0
  32. data/spec/cassettes/Leadlight/tinted_GitHub_example/_user/has_the_expected_content.yml +65 -0
  33. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/.yml +100 -0
  34. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_able_to_follow_next_link.yml +135 -0
  35. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable.yml +275 -0
  36. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable_over_page_boundaries.yml +170 -0
  37. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_have_next_and_last_links.yml +100 -0
  38. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/exists.yml +32 -0
  39. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/links_to_the_expected_URL.yml +32 -0
  40. data/spec/leadlight/codec_spec.rb +93 -0
  41. data/spec/leadlight/hyperlinkable_spec.rb +136 -0
  42. data/spec/leadlight/link_spec.rb +53 -0
  43. data/spec/leadlight/link_template_spec.rb +45 -0
  44. data/spec/leadlight/representation_spec.rb +62 -0
  45. data/spec/leadlight/request_spec.rb +236 -0
  46. data/spec/leadlight/service_middleware_spec.rb +81 -0
  47. data/spec/leadlight/service_spec.rb +127 -0
  48. data/spec/leadlight/tint_helper_spec.rb +132 -0
  49. data/spec/leadlight/type_spec.rb +137 -0
  50. data/spec/leadlight_spec.rb +237 -0
  51. data/spec/spec_helper_lite.rb +6 -0
  52. data/spec/support/credentials.rb +16 -0
  53. data/spec/support/vcr.rb +18 -0
  54. metadata +229 -0
@@ -0,0 +1,309 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.github.com/
6
+ body: ''
7
+ headers:
8
+ Authorization:
9
+ - <AUTH FILTERED>
10
+ Accept:
11
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
12
+ text/plain
13
+ response:
14
+ status:
15
+ code: 204
16
+ message: !!null
17
+ headers:
18
+ server:
19
+ - nginx/1.0.4
20
+ date:
21
+ - Mon, 09 Jan 2012 02:45:30 GMT
22
+ connection:
23
+ - close
24
+ status:
25
+ - 204 No Content
26
+ x-ratelimit-limit:
27
+ - '5000'
28
+ etag:
29
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
30
+ x-oauth-scopes:
31
+ - repo
32
+ x-ratelimit-remaining:
33
+ - '4992'
34
+ body: ''
35
+ http_version: !!null
36
+ recorded_at: Mon, 09 Jan 2012 02:45:29 GMT
37
+ - request:
38
+ method: get
39
+ uri: https://api.github.com/users/leadlight-test
40
+ body: ''
41
+ headers:
42
+ Authorization:
43
+ - <AUTH FILTERED>
44
+ Accept:
45
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
46
+ text/plain
47
+ response:
48
+ status:
49
+ code: 200
50
+ message: !!null
51
+ headers:
52
+ server:
53
+ - nginx/1.0.4
54
+ date:
55
+ - Mon, 09 Jan 2012 02:45:31 GMT
56
+ content-type:
57
+ - application/json; charset=utf-8
58
+ transfer-encoding:
59
+ - chunked
60
+ connection:
61
+ - close
62
+ status:
63
+ - 200 OK
64
+ x-ratelimit-limit:
65
+ - '5000'
66
+ etag:
67
+ - ! '"8ce4bb5ff9ed333a4d60218c9cef1f4d"'
68
+ x-oauth-scopes:
69
+ - repo
70
+ x-ratelimit-remaining:
71
+ - '4991'
72
+ x-accepted-oauth-scopes:
73
+ - user
74
+ body: ! '{"type":"User","avatar_url":"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","followers":0,"gravatar_id":"71a3f4f0d28bcb9c10fe96bbfce8fef8","created_at":"2012-01-09T02:38:20Z","login":"leadlight-test","html_url":"https://github.com/leadlight-test","following":0,"public_gists":0,"url":"https://api.github.com/users/leadlight-test","id":1314019,"public_repos":0}'
75
+ http_version: !!null
76
+ recorded_at: Mon, 09 Jan 2012 02:45:29 GMT
77
+ - request:
78
+ method: get
79
+ uri: https://api.github.com/
80
+ body: ''
81
+ headers:
82
+ Authorization:
83
+ - <AUTH FILTERED>
84
+ Accept:
85
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
86
+ text/plain
87
+ response:
88
+ status:
89
+ code: 204
90
+ message: !!null
91
+ headers:
92
+ server:
93
+ - nginx/1.0.4
94
+ date:
95
+ - Mon, 09 Jan 2012 02:45:56 GMT
96
+ connection:
97
+ - close
98
+ status:
99
+ - 204 No Content
100
+ x-ratelimit-limit:
101
+ - '5000'
102
+ etag:
103
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
104
+ x-oauth-scopes:
105
+ - repo
106
+ x-ratelimit-remaining:
107
+ - '4990'
108
+ body: ''
109
+ http_version: !!null
110
+ recorded_at: Mon, 09 Jan 2012 02:45:54 GMT
111
+ - request:
112
+ method: get
113
+ uri: https://api.github.com/orgs/shiprise
114
+ body: ''
115
+ headers:
116
+ Authorization:
117
+ - <AUTH FILTERED>
118
+ Accept:
119
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
120
+ text/plain
121
+ response:
122
+ status:
123
+ code: 200
124
+ message: !!null
125
+ headers:
126
+ server:
127
+ - nginx/1.0.4
128
+ date:
129
+ - Mon, 09 Jan 2012 02:45:56 GMT
130
+ content-type:
131
+ - application/json; charset=utf-8
132
+ transfer-encoding:
133
+ - chunked
134
+ connection:
135
+ - close
136
+ status:
137
+ - 200 OK
138
+ x-ratelimit-limit:
139
+ - '5000'
140
+ etag:
141
+ - ! '"579e84143fd3758c78b8b2effe8ba5dc"'
142
+ x-oauth-scopes:
143
+ - repo
144
+ x-ratelimit-remaining:
145
+ - '4989'
146
+ x-accepted-oauth-scopes:
147
+ - repo
148
+ body: ! '{"type":"Organization","location":null,"private_gists":0,"public_repos":0,"company":null,"email":"avdi@shiprise.net","followers":0,"blog":"http://shiprise.net","html_url":"https://github.com/ShipRise","created_at":"2011-10-27T20:49:51Z","login":"ShipRise","disk_usage":552,"collaborators":0,"billing_email":"avdi@shiprise.net","avatar_url":"https://secure.gravatar.com/avatar/6dd3c12e97a46ff08c358542cae955e2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","plan":{"private_repos":10,"space":2516582,"name":"bronze"},"total_private_repos":1,"following":0,"name":"ShipRise","owned_private_repos":1,"url":"https://api.github.com/orgs/ShipRise","id":1156570,"public_gists":0}'
149
+ http_version: !!null
150
+ recorded_at: Mon, 09 Jan 2012 02:45:54 GMT
151
+ - request:
152
+ method: get
153
+ uri: https://api.github.com/orgs/shiprise/teams
154
+ body: ''
155
+ headers:
156
+ Authorization:
157
+ - <AUTH FILTERED>
158
+ Accept:
159
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
160
+ text/plain
161
+ response:
162
+ status:
163
+ code: 200
164
+ message: !!null
165
+ headers:
166
+ server:
167
+ - nginx/1.0.4
168
+ date:
169
+ - Mon, 09 Jan 2012 02:45:56 GMT
170
+ content-type:
171
+ - application/json; charset=utf-8
172
+ transfer-encoding:
173
+ - chunked
174
+ connection:
175
+ - close
176
+ status:
177
+ - 200 OK
178
+ x-ratelimit-limit:
179
+ - '5000'
180
+ etag:
181
+ - ! '"7bacecfddc356d3ba366ba12652db603"'
182
+ x-oauth-scopes:
183
+ - repo
184
+ x-ratelimit-remaining:
185
+ - '4988'
186
+ x-accepted-oauth-scopes:
187
+ - repo
188
+ body: ! '[{"name":"BitBindery Development","url":"https://api.github.com/teams/111894","id":111894},{"name":"Leadlight
189
+ Test Team","url":"https://api.github.com/teams/127491","id":127491},{"name":"Owners","url":"https://api.github.com/teams/104018","id":104018}]'
190
+ http_version: !!null
191
+ recorded_at: Mon, 09 Jan 2012 02:45:55 GMT
192
+ - request:
193
+ method: get
194
+ uri: https://api.github.com/teams/127491
195
+ body: ''
196
+ headers:
197
+ Authorization:
198
+ - <AUTH FILTERED>
199
+ Accept:
200
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
201
+ text/plain
202
+ response:
203
+ status:
204
+ code: 200
205
+ message: !!null
206
+ headers:
207
+ server:
208
+ - nginx/1.0.4
209
+ date:
210
+ - Mon, 09 Jan 2012 04:06:24 GMT
211
+ content-type:
212
+ - application/json; charset=utf-8
213
+ transfer-encoding:
214
+ - chunked
215
+ connection:
216
+ - close
217
+ status:
218
+ - 200 OK
219
+ x-ratelimit-limit:
220
+ - '5000'
221
+ etag:
222
+ - ! '"bc0707fd773571a735b3c0805a49d86c"'
223
+ x-oauth-scopes:
224
+ - repo
225
+ x-ratelimit-remaining:
226
+ - '4965'
227
+ x-accepted-oauth-scopes:
228
+ - repo
229
+ body: ! '{"members_count":0,"repos_count":0,"permission":"pull","name":"Leadlight
230
+ Test Team","url":"https://api.github.com/teams/127491","id":127491}'
231
+ http_version: !!null
232
+ recorded_at: Mon, 09 Jan 2012 04:06:22 GMT
233
+ - request:
234
+ method: put
235
+ uri: https://api.github.com/teams/127491/members/leadlight-test
236
+ body: ''
237
+ headers:
238
+ Authorization:
239
+ - <AUTH FILTERED>
240
+ Accept:
241
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
242
+ text/plain
243
+ response:
244
+ status:
245
+ code: 204
246
+ message: !!null
247
+ headers:
248
+ server:
249
+ - nginx/1.0.4
250
+ date:
251
+ - Mon, 09 Jan 2012 04:06:24 GMT
252
+ connection:
253
+ - close
254
+ status:
255
+ - 204 No Content
256
+ x-ratelimit-limit:
257
+ - '5000'
258
+ etag:
259
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
260
+ x-oauth-scopes:
261
+ - repo
262
+ x-ratelimit-remaining:
263
+ - '4964'
264
+ x-accepted-oauth-scopes:
265
+ - repo
266
+ body: ''
267
+ http_version: !!null
268
+ recorded_at: Mon, 09 Jan 2012 04:06:23 GMT
269
+ - request:
270
+ method: get
271
+ uri: https://api.github.com/teams/127491/members
272
+ body: ''
273
+ headers:
274
+ Authorization:
275
+ - <AUTH FILTERED>
276
+ Accept:
277
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
278
+ text/plain
279
+ response:
280
+ status:
281
+ code: 200
282
+ message: !!null
283
+ headers:
284
+ server:
285
+ - nginx/1.0.4
286
+ date:
287
+ - Mon, 09 Jan 2012 04:23:51 GMT
288
+ content-type:
289
+ - application/json; charset=utf-8
290
+ transfer-encoding:
291
+ - chunked
292
+ connection:
293
+ - close
294
+ status:
295
+ - 200 OK
296
+ x-ratelimit-limit:
297
+ - '5000'
298
+ etag:
299
+ - ! '"1718600bae7832df12f90aa6c7fbc89a"'
300
+ x-oauth-scopes:
301
+ - repo
302
+ x-ratelimit-remaining:
303
+ - '4962'
304
+ x-accepted-oauth-scopes:
305
+ - repo
306
+ body: ! '[{"avatar_url":"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leadlight-test","gravatar_id":"71a3f4f0d28bcb9c10fe96bbfce8fef8","url":"https://api.github.com/users/leadlight-test","id":1314019}]'
307
+ http_version: !!null
308
+ recorded_at: Mon, 09 Jan 2012 04:23:49 GMT
309
+ recorded_with: VCR 2.0.0.rc1
@@ -0,0 +1,159 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.github.com/
6
+ body: ''
7
+ headers:
8
+ Authorization:
9
+ - <AUTH FILTERED>
10
+ Accept:
11
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
12
+ text/plain
13
+ response:
14
+ status:
15
+ code: 204
16
+ message: !!null
17
+ headers:
18
+ server:
19
+ - nginx/1.0.4
20
+ date:
21
+ - Mon, 09 Jan 2012 02:31:57 GMT
22
+ connection:
23
+ - close
24
+ status:
25
+ - 204 No Content
26
+ x-ratelimit-limit:
27
+ - '5000'
28
+ etag:
29
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
30
+ x-oauth-scopes:
31
+ - repo
32
+ x-ratelimit-remaining:
33
+ - '4995'
34
+ body: ''
35
+ http_version: !!null
36
+ recorded_at: Mon, 09 Jan 2012 02:31:55 GMT
37
+ - request:
38
+ method: get
39
+ uri: https://api.github.com/orgs/shiprise
40
+ body: ''
41
+ headers:
42
+ Authorization:
43
+ - <AUTH FILTERED>
44
+ Accept:
45
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
46
+ text/plain
47
+ response:
48
+ status:
49
+ code: 200
50
+ message: !!null
51
+ headers:
52
+ server:
53
+ - nginx/1.0.4
54
+ date:
55
+ - Mon, 09 Jan 2012 02:31:57 GMT
56
+ content-type:
57
+ - application/json; charset=utf-8
58
+ transfer-encoding:
59
+ - chunked
60
+ connection:
61
+ - close
62
+ status:
63
+ - 200 OK
64
+ x-ratelimit-limit:
65
+ - '5000'
66
+ etag:
67
+ - ! '"b2cc0895af15b91bc02f3a4d02d7b181"'
68
+ x-oauth-scopes:
69
+ - repo
70
+ x-ratelimit-remaining:
71
+ - '4994'
72
+ x-accepted-oauth-scopes:
73
+ - repo
74
+ body: ! '{"total_private_repos":1,"type":"Organization","blog":"http://shiprise.net","location":null,"company":null,"email":"avdi@shiprise.net","owned_private_repos":1,"followers":0,"created_at":"2011-10-27T20:49:51Z","login":"ShipRise","disk_usage":552,"billing_email":"avdi@shiprise.net","public_repos":0,"collaborators":0,"plan":{"space":2516582,"name":"bronze","private_repos":10},"avatar_url":"https://secure.gravatar.com/avatar/6dd3c12e97a46ff08c358542cae955e2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","public_gists":0,"following":0,"html_url":"https://github.com/ShipRise","name":"ShipRise","private_gists":0,"url":"https://api.github.com/orgs/ShipRise","id":1156570}'
75
+ http_version: !!null
76
+ recorded_at: Mon, 09 Jan 2012 02:31:55 GMT
77
+ - request:
78
+ method: get
79
+ uri: https://api.github.com/orgs/shiprise/teams
80
+ body: ''
81
+ headers:
82
+ Authorization:
83
+ - <AUTH FILTERED>
84
+ Accept:
85
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
86
+ text/plain
87
+ response:
88
+ status:
89
+ code: 200
90
+ message: !!null
91
+ headers:
92
+ server:
93
+ - nginx/1.0.4
94
+ date:
95
+ - Mon, 09 Jan 2012 02:31:57 GMT
96
+ content-type:
97
+ - application/json; charset=utf-8
98
+ transfer-encoding:
99
+ - chunked
100
+ connection:
101
+ - close
102
+ status:
103
+ - 200 OK
104
+ x-ratelimit-limit:
105
+ - '5000'
106
+ etag:
107
+ - ! '"7bacecfddc356d3ba366ba12652db603"'
108
+ x-oauth-scopes:
109
+ - repo
110
+ x-ratelimit-remaining:
111
+ - '4993'
112
+ x-accepted-oauth-scopes:
113
+ - repo
114
+ body: ! '[{"name":"BitBindery Development","url":"https://api.github.com/teams/111894","id":111894},{"name":"Leadlight
115
+ Test Team","url":"https://api.github.com/teams/127491","id":127491},{"name":"Owners","url":"https://api.github.com/teams/104018","id":104018}]'
116
+ http_version: !!null
117
+ recorded_at: Mon, 09 Jan 2012 02:31:56 GMT
118
+ - request:
119
+ method: get
120
+ uri: https://api.github.com/teams/127491
121
+ body: ''
122
+ headers:
123
+ Authorization:
124
+ - <AUTH FILTERED>
125
+ Accept:
126
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
127
+ text/plain
128
+ response:
129
+ status:
130
+ code: 200
131
+ message: !!null
132
+ headers:
133
+ server:
134
+ - nginx/1.0.4
135
+ date:
136
+ - Mon, 09 Jan 2012 04:18:16 GMT
137
+ content-type:
138
+ - application/json; charset=utf-8
139
+ transfer-encoding:
140
+ - chunked
141
+ connection:
142
+ - close
143
+ status:
144
+ - 200 OK
145
+ x-ratelimit-limit:
146
+ - '5000'
147
+ etag:
148
+ - ! '"1defd6f3beb5e83cdf62db4afe841bd5"'
149
+ x-oauth-scopes:
150
+ - repo
151
+ x-ratelimit-remaining:
152
+ - '4963'
153
+ x-accepted-oauth-scopes:
154
+ - repo
155
+ body: ! '{"repos_count":0,"permission":"pull","members_count":1,"name":"Leadlight
156
+ Test Team","url":"https://api.github.com/teams/127491","id":127491}'
157
+ http_version: !!null
158
+ recorded_at: Mon, 09 Jan 2012 04:18:14 GMT
159
+ recorded_with: VCR 2.0.0.rc1