leadlight 0.0.2 → 0.0.3

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 (52) hide show
  1. data/Gemfile.lock +5 -7
  2. data/README.md +82 -0
  3. data/default.gems +1 -0
  4. data/leadlight.gemspec +16 -7
  5. data/lib/leadlight.rb +18 -62
  6. data/lib/leadlight/basic_converter.rb +18 -0
  7. data/lib/leadlight/codec.rb +2 -0
  8. data/lib/leadlight/entity.rb +1 -0
  9. data/lib/leadlight/errors.rb +10 -2
  10. data/lib/leadlight/header_helpers.rb +11 -0
  11. data/lib/leadlight/hyperlinkable.rb +1 -1
  12. data/lib/leadlight/representation.rb +19 -1
  13. data/lib/leadlight/request.rb +44 -11
  14. data/lib/leadlight/service.rb +4 -9
  15. data/lib/leadlight/service_class_methods.rb +69 -0
  16. data/lib/leadlight/service_middleware.rb +2 -14
  17. data/lib/leadlight/tint.rb +6 -2
  18. data/lib/leadlight/tint_helper.rb +27 -4
  19. data/lib/leadlight/type_map.rb +101 -0
  20. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/has_the_expected_content.yml +8 -8
  21. data/spec/cassettes/Leadlight/authorized_GitHub_example/_user/indicates_the_expected_oath_scopes.yml +8 -8
  22. data/spec/cassettes/Leadlight/authorized_GitHub_example/adding_and_removing_team_members.yml +273 -284
  23. data/spec/cassettes/Leadlight/authorized_GitHub_example/{adding_and_removing_team_members/.yml → adding_and_removing_teams.yml} +57 -84
  24. data/spec/cassettes/Leadlight/authorized_GitHub_example/test_team/.yml +111 -117
  25. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/.yml +58 -25
  26. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/__location__/.yml +58 -25
  27. data/spec/cassettes/Leadlight/basic_GitHub_example/_root/should_be_a_204_no_content.yml +58 -25
  28. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/.yml +58 -25
  29. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/__location__/.yml +58 -25
  30. data/spec/cassettes/Leadlight/tinted_GitHub_example/_root/should_be_a_204_no_content.yml +58 -25
  31. data/spec/cassettes/Leadlight/tinted_GitHub_example/_user/has_the_expected_content.yml +122 -50
  32. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/.yml +190 -77
  33. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_able_to_follow_next_link.yml +260 -104
  34. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable.yml +616 -212
  35. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_be_enumerable_over_page_boundaries.yml +331 -131
  36. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_followers/should_have_next_and_last_links.yml +190 -77
  37. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/exists.yml +58 -25
  38. data/spec/cassettes/Leadlight/tinted_GitHub_example/user_link/links_to_the_expected_URL.yml +58 -25
  39. data/spec/leadlight/hyperlinkable_spec.rb +3 -1
  40. data/spec/leadlight/link_template_spec.rb +2 -1
  41. data/spec/leadlight/request_spec.rb +44 -21
  42. data/spec/leadlight/service_middleware_spec.rb +9 -46
  43. data/spec/leadlight/service_spec.rb +30 -24
  44. data/spec/leadlight/tint_helper_spec.rb +67 -1
  45. data/spec/leadlight/tint_spec.rb +69 -0
  46. data/spec/leadlight/type_map_spec.rb +127 -0
  47. data/spec/leadlight_spec.rb +102 -51
  48. data/spec/support/credentials.rb +10 -2
  49. data/spec/support/vcr.rb +1 -1
  50. metadata +61 -32
  51. data/lib/leadlight/type.rb +0 -71
  52. data/spec/leadlight/type_spec.rb +0 -137
@@ -1,32 +1,65 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ""
7
- headers:
8
- Accept:
9
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
10
- response:
11
- status:
6
+ body: ''
7
+ headers:
8
+ Accept:
9
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
10
+ text/plain
11
+ response:
12
+ status:
12
13
  code: 204
13
- message:
14
- headers:
15
- server:
14
+ message: !!null
15
+ headers:
16
+ server:
16
17
  - nginx/1.0.4
17
- date:
18
- - Mon, 09 Jan 2012 02:31:42 GMT
19
- connection:
18
+ date:
19
+ - Sun, 15 Jan 2012 19:38:31 GMT
20
+ connection:
20
21
  - close
21
- status:
22
+ status:
22
23
  - 204 No Content
23
- x-ratelimit-limit:
24
- - "5000"
25
- etag:
26
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
27
- x-ratelimit-remaining:
28
- - "4999"
29
- body: ""
30
- http_version:
31
- recorded_at: Mon, 09 Jan 2012 02:31:41 GMT
24
+ x-ratelimit-limit:
25
+ - '5000'
26
+ etag:
27
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ 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
32
65
  recorded_with: VCR 2.0.0.rc1
@@ -1,32 +1,65 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ""
7
- headers:
8
- Accept:
9
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
10
- response:
11
- status:
6
+ body: ''
7
+ headers:
8
+ Accept:
9
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
10
+ text/plain
11
+ response:
12
+ status:
12
13
  code: 204
13
- message:
14
- headers:
15
- server:
14
+ message: !!null
15
+ headers:
16
+ server:
16
17
  - nginx/1.0.4
17
- date:
18
- - Mon, 09 Jan 2012 02:31:43 GMT
19
- connection:
18
+ date:
19
+ - Sun, 15 Jan 2012 19:38:32 GMT
20
+ connection:
20
21
  - close
21
- status:
22
+ status:
22
23
  - 204 No Content
23
- x-ratelimit-limit:
24
- - "5000"
25
- etag:
26
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
27
- x-ratelimit-remaining:
28
- - "4997"
29
- body: ""
30
- http_version:
31
- recorded_at: Mon, 09 Jan 2012 02:31:42 GMT
24
+ x-ratelimit-limit:
25
+ - '5000'
26
+ etag:
27
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ 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
56
+ x-ratelimit-limit:
57
+ - '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
32
65
  recorded_with: VCR 2.0.0.rc1
@@ -1,32 +1,65 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ""
7
- headers:
8
- Accept:
9
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
10
- response:
11
- status:
6
+ body: ''
7
+ headers:
8
+ Accept:
9
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
10
+ text/plain
11
+ response:
12
+ status:
12
13
  code: 204
13
- message:
14
- headers:
15
- server:
14
+ message: !!null
15
+ headers:
16
+ server:
16
17
  - nginx/1.0.4
17
- date:
18
- - Mon, 09 Jan 2012 02:31:43 GMT
19
- connection:
18
+ date:
19
+ - Sun, 15 Jan 2012 19:38:32 GMT
20
+ connection:
20
21
  - close
21
- status:
22
+ status:
22
23
  - 204 No Content
23
- x-ratelimit-limit:
24
- - "5000"
25
- etag:
26
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
27
- x-ratelimit-remaining:
28
- - "4998"
29
- body: ""
30
- http_version:
31
- recorded_at: Mon, 09 Jan 2012 02:31:41 GMT
24
+ x-ratelimit-limit:
25
+ - '5000'
26
+ etag:
27
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ 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
32
65
  recorded_with: VCR 2.0.0.rc1
@@ -1,32 +1,65 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ""
7
- headers:
8
- Accept:
9
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
10
- response:
11
- status:
6
+ body: ''
7
+ headers:
8
+ Accept:
9
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
10
+ text/plain
11
+ response:
12
+ status:
12
13
  code: 204
13
- message:
14
- headers:
15
- server:
14
+ message: !!null
15
+ headers:
16
+ server:
16
17
  - nginx/1.0.4
17
- date:
18
- - Mon, 09 Jan 2012 02:31:44 GMT
19
- connection:
18
+ date:
19
+ - Sun, 15 Jan 2012 19:38:32 GMT
20
+ connection:
20
21
  - close
21
- status:
22
+ status:
22
23
  - 204 No Content
23
- x-ratelimit-limit:
24
- - "5000"
25
- etag:
26
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
27
- x-ratelimit-remaining:
28
- - "4996"
29
- body: ""
30
- http_version:
31
- recorded_at: Mon, 09 Jan 2012 02:31:42 GMT
24
+ x-ratelimit-limit:
25
+ - '5000'
26
+ etag:
27
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ 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
56
+ x-ratelimit-limit:
57
+ - '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
32
65
  recorded_with: VCR 2.0.0.rc1
@@ -1,32 +1,65 @@
1
- ---
2
- http_interactions:
3
- - request:
1
+ ---
2
+ http_interactions:
3
+ - request:
4
4
  method: get
5
5
  uri: https://api.github.com/
6
- body: ""
7
- headers:
8
- Accept:
9
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
10
- response:
11
- status:
6
+ body: ''
7
+ headers:
8
+ Accept:
9
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
10
+ text/plain
11
+ response:
12
+ status:
12
13
  code: 204
13
- message:
14
- headers:
15
- server:
14
+ message: !!null
15
+ headers:
16
+ server:
16
17
  - nginx/1.0.4
17
- date:
18
- - Mon, 09 Jan 2012 02:31:44 GMT
19
- connection:
18
+ date:
19
+ - Sun, 15 Jan 2012 19:38:33 GMT
20
+ connection:
20
21
  - close
21
- status:
22
+ status:
22
23
  - 204 No Content
23
- x-ratelimit-limit:
24
- - "5000"
25
- etag:
26
- - "\"d41d8cd98f00b204e9800998ecf8427e\""
27
- x-ratelimit-remaining:
28
- - "4994"
29
- body: ""
30
- http_version:
31
- recorded_at: Mon, 09 Jan 2012 02:31:43 GMT
24
+ x-ratelimit-limit:
25
+ - '5000'
26
+ etag:
27
+ - ! '"d41d8cd98f00b204e9800998ecf8427e"'
28
+ 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
32
65
  recorded_with: VCR 2.0.0.rc1