leadlight 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/Gemfile.lock +20 -18
  2. data/default.gems +1 -1
  3. data/leadlight.gemspec +24 -4
  4. data/lib/leadlight.rb +4 -5
  5. data/lib/leadlight/connection_builder.rb +29 -0
  6. data/lib/leadlight/errors.rb +11 -5
  7. data/lib/leadlight/hyperlinkable.rb +31 -10
  8. data/lib/leadlight/lib_ext.rb +3 -0
  9. data/lib/leadlight/lib_ext/faraday/README +6 -0
  10. data/lib/leadlight/lib_ext/faraday/adapter.rb +7 -0
  11. data/lib/leadlight/lib_ext/faraday/builder.rb +47 -0
  12. data/lib/leadlight/lib_ext/faraday/connection.rb +40 -0
  13. data/lib/leadlight/lib_ext/faraday/middleware.rb +7 -0
  14. data/lib/leadlight/link.rb +91 -4
  15. data/lib/leadlight/link_template.rb +13 -5
  16. data/lib/leadlight/null_link.rb +21 -0
  17. data/lib/leadlight/param_hash.rb +42 -0
  18. data/lib/leadlight/representation.rb +23 -3
  19. data/lib/leadlight/request.rb +42 -10
  20. data/lib/leadlight/service.rb +11 -9
  21. data/lib/leadlight/service_class_methods.rb +11 -3
  22. data/lib/leadlight/tint_helper.rb +32 -2
  23. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/has_the_expected_content.yml +72 -54
  24. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/indicates_the_expected_oath_scopes.yml +73 -55
  25. data/spec/cassettes/Leadlight/authorized_GitHub_example/adding_and_removing_team_members.yml +353 -265
  26. data/spec/cassettes/Leadlight/authorized_GitHub_example/adding_and_removing_teams.yml +75 -175
  27. data/spec/cassettes/Leadlight/authorized_GitHub_example/team_list/should_have_a_link_back_to_the_org.yml +196 -0
  28. data/spec/cassettes/Leadlight/authorized_GitHub_example/test_team/.yml +152 -108
  29. data/spec/cassettes/Leadlight/authorized_GitHub_example/test_team/has_a_root_link.yml +197 -0
  30. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/.yml +15 -43
  31. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/__location__/.yml +15 -43
  32. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/should_be_a_204_no_content.yml +15 -43
  33. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/.yml +15 -43
  34. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/__location__/.yml +15 -43
  35. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/should_be_a_204_no_content.yml +15 -43
  36. data/spec/cassettes/Leadlight/tinted_GitHub_example/_user/has_the_expected_content.yml +35 -90
  37. data/spec/cassettes/Leadlight/tinted_GitHub_example/bad_links/enables_custom_error_matching.yml +25 -17
  38. data/spec/cassettes/Leadlight/tinted_GitHub_example/bad_links/should_raise_ResourceNotFound.yml +26 -90
  39. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/.yml +57 -140
  40. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_able_to_follow_next_link.yml +79 -192
  41. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable.yml +279 -350
  42. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable_over_page_boundaries.yml +98 -243
  43. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_have_next_and_last_links.yml +59 -142
  44. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/exists.yml +15 -43
  45. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/links_to_the_expected_URL.yml +15 -43
  46. data/spec/leadlight/hyperlinkable_spec.rb +50 -4
  47. data/spec/leadlight/link_spec.rb +70 -10
  48. data/spec/leadlight/link_template_spec.rb +20 -4
  49. data/spec/leadlight/null_link_spec.rb +14 -0
  50. data/spec/leadlight/param_hash_spec.rb +26 -0
  51. data/spec/leadlight/representation_spec.rb +36 -4
  52. data/spec/leadlight/request_spec.rb +39 -22
  53. data/spec/leadlight/service_spec.rb +14 -13
  54. data/spec/leadlight/tint_helper_spec.rb +36 -2
  55. data/spec/leadlight_spec.rb +31 -17
  56. data/spec/support/link_matchers.rb +59 -0
  57. data/spec/support/misc.rb +9 -0
  58. metadata +49 -34
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:31 GMT
21
+ - Wed, 01 Aug 2012 19:38:39 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
24
26
  x-ratelimit-limit:
25
27
  - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ cache-control:
29
+ - ''
28
30
  x-ratelimit-remaining:
29
- - '4999'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:31 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:52 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
56
- x-ratelimit-limit:
57
- - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4999'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:52 GMT
65
- recorded_with: VCR 2.0.0.rc1
31
+ - '4994'
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:29 GMT
37
+ recorded_with: VCR 2.2.4
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:32 GMT
21
+ - Wed, 01 Aug 2012 19:38:40 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
24
- x-ratelimit-limit:
25
- - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
26
  x-ratelimit-remaining:
29
- - '4997'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:32 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:53 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
27
+ - '4992'
28
+ cache-control:
29
+ - ''
56
30
  x-ratelimit-limit:
57
31
  - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4997'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:53 GMT
65
- recorded_with: VCR 2.0.0.rc1
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:29 GMT
37
+ recorded_with: VCR 2.2.4
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:32 GMT
21
+ - Wed, 01 Aug 2012 19:38:40 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
24
26
  x-ratelimit-limit:
25
27
  - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ cache-control:
29
+ - ''
28
30
  x-ratelimit-remaining:
29
- - '4998'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:32 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:52 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
56
- x-ratelimit-limit:
57
- - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4998'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:52 GMT
65
- recorded_with: VCR 2.0.0.rc1
31
+ - '4993'
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:29 GMT
37
+ recorded_with: VCR 2.2.4
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:32 GMT
21
+ - Wed, 01 Aug 2012 19:38:40 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
24
- x-ratelimit-limit:
25
- - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
26
  x-ratelimit-remaining:
29
- - '4996'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:32 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:53 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
27
+ - '4991'
28
+ cache-control:
29
+ - ''
56
30
  x-ratelimit-limit:
57
31
  - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4996'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:53 GMT
65
- recorded_with: VCR 2.0.0.rc1
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:29 GMT
37
+ recorded_with: VCR 2.2.4
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:33 GMT
21
+ - Wed, 01 Aug 2012 19:38:40 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
26
+ cache-control:
27
+ - ''
24
28
  x-ratelimit-limit:
25
29
  - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
30
  x-ratelimit-remaining:
29
- - '4994'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:33 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:54 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
56
- x-ratelimit-limit:
57
- - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4994'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:54 GMT
65
- recorded_with: VCR 2.0.0.rc1
31
+ - '4989'
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:30 GMT
37
+ recorded_with: VCR 2.2.4
@@ -3,7 +3,9 @@ http_interactions:
3
3
  - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ''
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
7
9
  headers:
8
10
  Accept:
9
11
  - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
@@ -11,55 +13,25 @@ http_interactions:
11
13
  response:
12
14
  status:
13
15
  code: 204
14
- message: !!null
16
+ message:
15
17
  headers:
16
18
  server:
17
- - nginx/1.0.4
19
+ - nginx/1.0.13
18
20
  date:
19
- - Sun, 15 Jan 2012 19:38:33 GMT
21
+ - Wed, 01 Aug 2012 19:38:40 GMT
20
22
  connection:
21
23
  - close
22
24
  status:
23
25
  - 204 No Content
24
- x-ratelimit-limit:
25
- - '5000'
26
- etag:
27
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
26
  x-ratelimit-remaining:
29
- - '4995'
30
- body: ''
31
- http_version: !!null
32
- recorded_at: Sun, 15 Jan 2012 19:38:33 GMT
33
- - request:
34
- method: get
35
- uri: https://api.github.com/
36
- body: 'null'
37
- headers:
38
- Content-Type:
39
- - application/json
40
- Accept:
41
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
42
- text/plain
43
- response:
44
- status:
45
- code: 204
46
- message: !!null
47
- headers:
48
- server:
49
- - nginx/1.0.4
50
- date:
51
- - Mon, 16 Jan 2012 02:45:53 GMT
52
- connection:
53
- - close
54
- status:
55
- - 204 No Content
27
+ - '4990'
28
+ cache-control:
29
+ - ''
56
30
  x-ratelimit-limit:
57
31
  - '5000'
58
- etag:
59
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
60
- x-ratelimit-remaining:
61
- - '4995'
62
- body: ''
63
- http_version: !!null
64
- recorded_at: Mon, 16 Jan 2012 02:45:53 GMT
65
- recorded_with: VCR 2.0.0.rc1
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ''
35
+ http_version:
36
+ recorded_at: Wed, 01 Aug 2012 19:38:30 GMT
37
+ recorded_with: VCR 2.2.4