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
@@ -10,12 +10,14 @@ module Leadlight
10
10
  fattr(:logger) { service_options.fetch(:logger) { ::Logger.new($stderr) } }
11
11
  fattr(:tints) { self.class.tints }
12
12
  fattr(:codec) { service_options.fetch(:codec) { Codec.new } }
13
+ fattr(:type_map) { TypeMap.new }
13
14
 
14
15
  def_delegators :codec, :encode, :decode
15
- def_delegators 'self.class', :types, :type_for_name
16
+ def_delegators 'self.class', :types, :type_for_name, :request_class
16
17
 
17
18
  def initialize(service_options={})
18
19
  @service_options = service_options
20
+ execute_hook(:on_init, self)
19
21
  end
20
22
 
21
23
  def root
@@ -52,20 +54,13 @@ module Leadlight
52
54
  private
53
55
 
54
56
  def perform_request(url, http_method, params={}, body=nil, &representation_handler)
55
- req = Request.new(connection, url, http_method, params, body)
56
- req.on_prepare_request do |faraday_request|
57
- prepare_request(faraday_request)
58
- end
57
+ req = request_class.new(self, connection, url, http_method, params, body)
59
58
  if representation_handler
60
59
  req.submit_and_wait(&representation_handler)
61
60
  end
62
61
  req
63
62
  end
64
63
 
65
- def prepare_request(request)
66
- # Override in subclasses
67
- end
68
-
69
64
  def connection_stack
70
65
  self.class.connection_stack
71
66
  end
@@ -0,0 +1,69 @@
1
+ require 'leadlight/basic_converter'
2
+
3
+ module Leadlight
4
+ module ServiceClassMethods
5
+ fattr(:tints) { default_tints }
6
+
7
+ def url(new_url=:none)
8
+ if new_url == :none
9
+ @url ||= Addressable::URI.parse('http://example.com')
10
+ else
11
+ @url = Addressable::URI.parse(new_url)
12
+ end
13
+ end
14
+
15
+ def session(options={})
16
+ sessions[options]
17
+ end
18
+
19
+ def sessions
20
+ @sessions ||= Hash.new{|h,k|
21
+ h[k] = new(k)
22
+ }
23
+ end
24
+
25
+ def connection_stack
26
+ @connection_stack ||= ->(builder){}
27
+ end
28
+
29
+ def default_tints
30
+ [
31
+ EnumerableRepresentation::Tint
32
+ ]
33
+ end
34
+
35
+ def request_class
36
+ @request_class ||= Class.new(Request)
37
+ end
38
+
39
+ private
40
+
41
+ def tint(name, options={}, &block)
42
+ self.tints << Tint.new(name, options, &block)
43
+ end
44
+
45
+ # Declare a new type mapping. Either pass a converter ("type")
46
+ # class, or pass a block which defines #decode and #encode
47
+ # methods.
48
+ def type_mapping(enctype_patterns,
49
+ object_patterns,
50
+ converter_class=make_converter_class,
51
+ &converter_definition)
52
+ converter_class.module_eval(&converter_definition) if converter_definition
53
+ on_init do
54
+ type_map.add(enctype_patterns, object_patterns, converter_class.new(codec))
55
+ end
56
+ end
57
+
58
+ def build_connection(&block)
59
+ @connection_stack = block
60
+ end
61
+
62
+ def make_converter_class
63
+ Class.new do
64
+ include BasicConverter
65
+ end
66
+ end
67
+
68
+ end
69
+ end
@@ -1,7 +1,4 @@
1
1
  require 'multi_json'
2
- require 'leadlight/blank'
3
- require 'leadlight/hyperlinkable'
4
- require 'leadlight/representation'
5
2
 
6
3
  module Leadlight
7
4
 
@@ -33,17 +30,8 @@ module Leadlight
33
30
  end
34
31
 
35
32
  def represent(env)
36
- content_type = env[:response_headers]['Content-Type']
37
- representation = if (env[:body] || '').size > 0
38
- ::MultiJson.decode(env[:body])
39
- else
40
- Blank.new
41
- end
42
- representation.
43
- extend(Representation).
44
- initialize_representation(env[:leadlight_service], env[:url], env[:response]).
45
- extend(Hyperlinkable).
46
- apply_all_tints
33
+ leadlight_request = env[:request].fetch(:leadlight_request)
34
+ leadlight_request.represent(env)
47
35
  end
48
36
  end
49
37
 
@@ -3,14 +3,18 @@ require 'leadlight/tint_helper'
3
3
  module Leadlight
4
4
  class Tint < Module
5
5
  attr_reader :name
6
- def initialize(name, &block)
6
+ def initialize(name, options={}, &block)
7
7
  @name = @tint_name = name
8
+ status_patterns = Array(options.fetch(:status) { :success })
8
9
  tint = self
9
10
  super(){
10
11
  define_method(:__apply_tint__) do
11
12
  super()
12
13
  helper = TintHelper.new(self, tint)
13
- helper.exec_tint(&block)
14
+ helper.exec_tint do
15
+ match_status(*status_patterns)
16
+ instance_eval(&block)
17
+ end
14
18
  end
15
19
  }
16
20
  end
@@ -15,8 +15,9 @@ module Leadlight
15
15
  self
16
16
  end
17
17
 
18
- def match(&block)
19
- matched = instance_eval(&block)
18
+ def match(*matchers, &block_matcher)
19
+ matchers << block_matcher if block_matcher
20
+ matched = matchers.any?{|m| m === __getobj__}
20
21
  throw :halt_tint unless matched
21
22
  end
22
23
 
@@ -45,6 +46,11 @@ module Leadlight
45
46
  match{ klass === __getobj__}
46
47
  end
47
48
 
49
+ def match_status(*patterns)
50
+ patterns = expand_status_patterns(*patterns)
51
+ match{ patterns.any?{|p| p === __response__.status} }
52
+ end
53
+
48
54
  def add_header(name, value)
49
55
  __response__.env[:response_headers][name] = value
50
56
  end
@@ -60,8 +66,25 @@ module Leadlight
60
66
  end
61
67
  end
62
68
 
63
- def type(type_name)
64
- __getobj__.__type__ = __service__.type_for_name(type_name)
69
+ private
70
+
71
+ def expand_status_patterns(*patterns)
72
+ patterns.inject([]) {|patterns, pattern|
73
+ case pattern
74
+ when :any
75
+ pattern << (100..599)
76
+ when :user_error
77
+ patterns << (400..499)
78
+ when :server_error
79
+ patterns << (500..599)
80
+ when :error
81
+ patterns << (400..499) << (500..599)
82
+ when :success
83
+ patterns << (200..299)
84
+ else
85
+ patterns << pattern
86
+ end
87
+ }
65
88
  end
66
89
  end
67
90
  end
@@ -0,0 +1,101 @@
1
+ require 'fattr'
2
+ require 'forwardable'
3
+ require 'leadlight/codec'
4
+ require 'leadlight/errors'
5
+ require 'leadlight/blank'
6
+ require 'leadlight/entity'
7
+
8
+ module Leadlight
9
+ class TypeMap
10
+ fattr(:codec) { Codec.new }
11
+ attr_reader :types
12
+
13
+ def initialize(options={})
14
+ options.each do |key, value|
15
+ send key, value
16
+ end
17
+ @types = []
18
+ add_default_types
19
+ end
20
+
21
+ def add(enctype_pattern, object_pattern, type)
22
+ types.unshift(Mapping.new(enctype_pattern, object_pattern, type))
23
+ end
24
+
25
+ def to_entity_body(object, options={})
26
+ types.detect(handle_unknown_object_type(object)) {|t|
27
+ t.match_for_object?(object)
28
+ }.encode(object, options)
29
+ end
30
+
31
+ def to_native(content_type, entity_body, options={})
32
+ types.detect(handle_unknown_enctype(content_type)) {|t|
33
+ t.match_for_enctype?(content_type)
34
+ }.decode(content_type, entity_body, options)
35
+ end
36
+
37
+ private
38
+
39
+ def add_default_types
40
+ add [nil, //], Object, DefaultType.new(codec)
41
+ end
42
+
43
+ def handle_unknown_enctype(enctype)
44
+ -> do
45
+ raise TypeError, "No type registered for content-type #{enctype.inspect}"
46
+ end
47
+ end
48
+
49
+ def handle_unknown_object_type(object)
50
+ -> do
51
+ raise TypeError, "No type matches object #{object.inspect}"
52
+ end
53
+ end
54
+
55
+ class Mapping
56
+ extend Forwardable
57
+
58
+ fattr(:enctype_patterns)
59
+ fattr(:object_patterns)
60
+ fattr(:type)
61
+
62
+ def_delegators :type, :encode, :decode
63
+
64
+ def initialize(enctype_pattern, object_pattern, type)
65
+ enctype_patterns Array(enctype_pattern)
66
+ object_patterns Array(object_pattern)
67
+ self.type = type
68
+ end
69
+
70
+ def match_for_enctype?(enctype)
71
+ enctype_patterns.any?{|p| p === enctype}
72
+ end
73
+
74
+ def match_for_object?(object)
75
+ object_patterns.any?{|p| p === object}
76
+ end
77
+ end
78
+
79
+ class DefaultType
80
+ def initialize(codec)
81
+ @codec = codec
82
+ end
83
+
84
+ def encode(object, options={})
85
+ return Entity.new(nil, nil) if object.nil?
86
+ content_type = options.delete(:content_type){"application/json"}
87
+ body = @codec.encode(content_type, object, options)
88
+ Entity.new(content_type, body)
89
+ end
90
+
91
+ def decode(content_type, entity_body, options={})
92
+ case entity_body.to_s.size
93
+ when 0,1 # No valid JSON document is smaller than 2 bytes
94
+ Blank.new
95
+ else
96
+ @codec.decode(content_type, entity_body, options)
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -17,7 +17,7 @@ http_interactions:
17
17
  server:
18
18
  - nginx/1.0.4
19
19
  date:
20
- - Mon, 09 Jan 2012 02:31:55 GMT
20
+ - Sun, 15 Jan 2012 19:38:44 GMT
21
21
  connection:
22
22
  - close
23
23
  status:
@@ -29,10 +29,10 @@ http_interactions:
29
29
  x-oauth-scopes:
30
30
  - repo
31
31
  x-ratelimit-remaining:
32
- - "4999"
32
+ - "4994"
33
33
  body: ""
34
34
  http_version:
35
- recorded_at: Mon, 09 Jan 2012 02:31:54 GMT
35
+ recorded_at: Sun, 15 Jan 2012 19:38:44 GMT
36
36
  - request:
37
37
  method: get
38
38
  uri: https://api.github.com/users/avdi
@@ -50,7 +50,7 @@ http_interactions:
50
50
  server:
51
51
  - nginx/1.0.4
52
52
  date:
53
- - Mon, 09 Jan 2012 02:31:55 GMT
53
+ - Sun, 15 Jan 2012 19:38:45 GMT
54
54
  content-type:
55
55
  - application/json; charset=utf-8
56
56
  transfer-encoding:
@@ -62,14 +62,14 @@ http_interactions:
62
62
  x-ratelimit-limit:
63
63
  - "5000"
64
64
  etag:
65
- - "\"16b8c1c449e332c8cdb94888facbedfd\""
65
+ - "\"3318aa5883e462e54c8e97cb1e76accf\""
66
66
  x-oauth-scopes:
67
67
  - repo
68
68
  x-ratelimit-remaining:
69
- - "4998"
69
+ - "4993"
70
70
  x-accepted-oauth-scopes:
71
71
  - user
72
- body: "{\"type\":\"User\",\"location\":\"Pennsylvania, USA\",\"company\":\"ShipRise\",\"email\":\"avdi@avdi.org\",\"followers\":178,\"blog\":\"http://avdi.org/devblog/\",\"created_at\":\"2008-02-26T19:54:34Z\",\"login\":\"avdi\",\"avatar_url\":\"https://secure.gravatar.com/avatar/4dea430d31b993abaf41cd9b54f8128d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"gravatar_id\":\"4dea430d31b993abaf41cd9b54f8128d\",\"public_repos\":61,\"following\":34,\"html_url\":\"https://github.com/avdi\",\"hireable\":false,\"public_gists\":68,\"name\":\"Avdi Grimm\",\"bio\":null,\"url\":\"https://api.github.com/users/avdi\",\"id\":982}"
72
+ body: "{\"type\":\"User\",\"public_repos\":61,\"public_gists\":72,\"created_at\":\"2008-02-26T19:54:34Z\",\"email\":\"avdi@avdi.org\",\"url\":\"https://api.github.com/users/avdi\",\"login\":\"avdi\",\"followers\":181,\"following\":33,\"hireable\":false,\"bio\":null,\"name\":\"Avdi Grimm\",\"blog\":\"http://avdi.org/devblog/\",\"avatar_url\":\"https://secure.gravatar.com/avatar/4dea430d31b993abaf41cd9b54f8128d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"location\":\"Pennsylvania, USA\",\"id\":982,\"html_url\":\"https://github.com/avdi\",\"company\":\"ShipRise\",\"gravatar_id\":\"4dea430d31b993abaf41cd9b54f8128d\"}"
73
73
  http_version:
74
- recorded_at: Mon, 09 Jan 2012 02:31:54 GMT
74
+ recorded_at: Sun, 15 Jan 2012 19:38:45 GMT
75
75
  recorded_with: VCR 2.0.0.rc1
@@ -17,7 +17,7 @@ http_interactions:
17
17
  server:
18
18
  - nginx/1.0.4
19
19
  date:
20
- - Mon, 09 Jan 2012 02:31:56 GMT
20
+ - Sun, 15 Jan 2012 19:38:45 GMT
21
21
  connection:
22
22
  - close
23
23
  status:
@@ -29,10 +29,10 @@ http_interactions:
29
29
  x-oauth-scopes:
30
30
  - repo
31
31
  x-ratelimit-remaining:
32
- - "4997"
32
+ - "4992"
33
33
  body: ""
34
34
  http_version:
35
- recorded_at: Mon, 09 Jan 2012 02:31:54 GMT
35
+ recorded_at: Sun, 15 Jan 2012 19:38:45 GMT
36
36
  - request:
37
37
  method: get
38
38
  uri: https://api.github.com/users/avdi
@@ -50,7 +50,7 @@ http_interactions:
50
50
  server:
51
51
  - nginx/1.0.4
52
52
  date:
53
- - Mon, 09 Jan 2012 02:31:56 GMT
53
+ - Sun, 15 Jan 2012 19:38:45 GMT
54
54
  content-type:
55
55
  - application/json; charset=utf-8
56
56
  transfer-encoding:
@@ -62,14 +62,14 @@ http_interactions:
62
62
  x-ratelimit-limit:
63
63
  - "5000"
64
64
  etag:
65
- - "\"1c5ce32320a58cc20b20e43775836557\""
65
+ - "\"f750a3b07a1f183f7b1332b16f2dba2e\""
66
66
  x-oauth-scopes:
67
67
  - repo
68
68
  x-ratelimit-remaining:
69
- - "4996"
69
+ - "4991"
70
70
  x-accepted-oauth-scopes:
71
71
  - user
72
- body: "{\"type\":\"User\",\"location\":\"Pennsylvania, USA\",\"company\":\"ShipRise\",\"email\":\"avdi@avdi.org\",\"bio\":null,\"followers\":178,\"blog\":\"http://avdi.org/devblog/\",\"avatar_url\":\"https://secure.gravatar.com/avatar/4dea430d31b993abaf41cd9b54f8128d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"created_at\":\"2008-02-26T19:54:34Z\",\"login\":\"avdi\",\"gravatar_id\":\"4dea430d31b993abaf41cd9b54f8128d\",\"following\":34,\"html_url\":\"https://github.com/avdi\",\"public_repos\":61,\"name\":\"Avdi Grimm\",\"public_gists\":68,\"url\":\"https://api.github.com/users/avdi\",\"id\":982,\"hireable\":false}"
72
+ body: "{\"type\":\"User\",\"created_at\":\"2008-02-26T19:54:34Z\",\"email\":\"avdi@avdi.org\",\"bio\":null,\"public_repos\":61,\"url\":\"https://api.github.com/users/avdi\",\"login\":\"avdi\",\"followers\":181,\"blog\":\"http://avdi.org/devblog/\",\"following\":33,\"gravatar_id\":\"4dea430d31b993abaf41cd9b54f8128d\",\"avatar_url\":\"https://secure.gravatar.com/avatar/4dea430d31b993abaf41cd9b54f8128d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"public_gists\":72,\"html_url\":\"https://github.com/avdi\",\"name\":\"Avdi Grimm\",\"location\":\"Pennsylvania, USA\",\"id\":982,\"company\":\"ShipRise\",\"hireable\":false}"
73
73
  http_version:
74
- recorded_at: Mon, 09 Jan 2012 02:31:55 GMT
74
+ recorded_at: Sun, 15 Jan 2012 19:38:45 GMT
75
75
  recorded_with: VCR 2.0.0.rc1
@@ -1,384 +1,373 @@
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
- Authorization:
6
+ body: ""
7
+ headers:
8
+ Authorization:
9
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:
10
+ Accept:
11
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
12
+ response:
13
+ status:
15
14
  code: 204
16
- message: !!null
17
- headers:
18
- server:
15
+ message:
16
+ headers:
17
+ server:
19
18
  - nginx/1.0.4
20
- date:
21
- - Mon, 09 Jan 2012 04:26:53 GMT
22
- connection:
19
+ date:
20
+ - Sun, 15 Jan 2012 19:38:43 GMT
21
+ connection:
23
22
  - close
24
- status:
23
+ status:
25
24
  - 204 No Content
26
- x-ratelimit-limit:
27
- - '5000'
28
- etag:
29
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
30
- x-oauth-scopes:
25
+ x-ratelimit-limit:
26
+ - "5000"
27
+ etag:
28
+ - "\"d41d8cd98f00b204e9800998ecf8427e\""
29
+ x-oauth-scopes:
31
30
  - repo
32
- x-ratelimit-remaining:
33
- - '4961'
34
- body: ''
35
- http_version: !!null
36
- recorded_at: Mon, 09 Jan 2012 04:26:51 GMT
37
- - request:
31
+ x-ratelimit-remaining:
32
+ - "4999"
33
+ body: ""
34
+ http_version:
35
+ recorded_at: Sun, 15 Jan 2012 19:38:43 GMT
36
+ - request:
38
37
  method: get
39
38
  uri: https://api.github.com/users/leadlight-test
40
- body: ''
41
- headers:
42
- Authorization:
39
+ body: ""
40
+ headers:
41
+ Authorization:
43
42
  - <AUTH FILTERED>
44
- Accept:
45
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
46
- text/plain
47
- response:
48
- status:
43
+ Accept:
44
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
45
+ response:
46
+ status:
49
47
  code: 200
50
- message: !!null
51
- headers:
52
- server:
48
+ message:
49
+ headers:
50
+ server:
53
51
  - nginx/1.0.4
54
- date:
55
- - Mon, 09 Jan 2012 04:26:53 GMT
56
- content-type:
52
+ date:
53
+ - Sun, 15 Jan 2012 19:38:43 GMT
54
+ content-type:
57
55
  - application/json; charset=utf-8
58
- transfer-encoding:
56
+ transfer-encoding:
59
57
  - chunked
60
- connection:
58
+ connection:
61
59
  - close
62
- status:
60
+ status:
63
61
  - 200 OK
64
- x-ratelimit-limit:
65
- - '5000'
66
- etag:
67
- - ! '"840c0261b10d96847d2cae0bbe7aa71e"'
68
- x-oauth-scopes:
62
+ x-ratelimit-limit:
63
+ - "5000"
64
+ etag:
65
+ - "\"9f36bc2e54d4dfe4cce0040c2c1a4594\""
66
+ x-oauth-scopes:
69
67
  - repo
70
- x-ratelimit-remaining:
71
- - '4960'
72
- x-accepted-oauth-scopes:
68
+ x-ratelimit-remaining:
69
+ - "4998"
70
+ x-accepted-oauth-scopes:
73
71
  - user
74
- body: ! '{"type":"User","followers":0,"html_url":"https://github.com/leadlight-test","created_at":"2012-01-09T02:38:20Z","login":"leadlight-test","gravatar_id":"71a3f4f0d28bcb9c10fe96bbfce8fef8","public_repos":0,"following":0,"public_gists":0,"url":"https://api.github.com/users/leadlight-test","id":1314019,"avatar_url":"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"}'
75
- http_version: !!null
76
- recorded_at: Mon, 09 Jan 2012 04:26:51 GMT
77
- - request:
72
+ body: "{\"type\":\"User\",\"public_gists\":0,\"created_at\":\"2012-01-09T02:38:20Z\",\"avatar_url\":\"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/leadlight-test\",\"login\":\"leadlight-test\",\"followers\":0,\"following\":0,\"html_url\":\"https://github.com/leadlight-test\",\"id\":1314019,\"public_repos\":0,\"gravatar_id\":\"71a3f4f0d28bcb9c10fe96bbfce8fef8\"}"
73
+ http_version:
74
+ recorded_at: Sun, 15 Jan 2012 19:38:43 GMT
75
+ - request:
78
76
  method: get
79
77
  uri: https://api.github.com/
80
- body: ''
81
- headers:
82
- Authorization:
78
+ body: ""
79
+ headers:
80
+ Authorization:
83
81
  - <AUTH FILTERED>
84
- Accept:
85
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
86
- text/plain
87
- response:
88
- status:
82
+ Accept:
83
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
84
+ response:
85
+ status:
89
86
  code: 204
90
- message: !!null
91
- headers:
92
- server:
87
+ message:
88
+ headers:
89
+ server:
93
90
  - nginx/1.0.4
94
- date:
95
- - Mon, 09 Jan 2012 04:26:53 GMT
96
- connection:
91
+ date:
92
+ - Sun, 15 Jan 2012 19:38:43 GMT
93
+ connection:
97
94
  - close
98
- status:
95
+ status:
99
96
  - 204 No Content
100
- x-ratelimit-limit:
101
- - '5000'
102
- etag:
103
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
104
- x-oauth-scopes:
97
+ x-ratelimit-limit:
98
+ - "5000"
99
+ etag:
100
+ - "\"d41d8cd98f00b204e9800998ecf8427e\""
101
+ x-oauth-scopes:
105
102
  - repo
106
- x-ratelimit-remaining:
107
- - '4959'
108
- body: ''
109
- http_version: !!null
110
- recorded_at: Mon, 09 Jan 2012 04:26:52 GMT
111
- - request:
103
+ x-ratelimit-remaining:
104
+ - "4997"
105
+ body: ""
106
+ http_version:
107
+ recorded_at: Sun, 15 Jan 2012 19:38:43 GMT
108
+ - request:
112
109
  method: get
113
110
  uri: https://api.github.com/orgs/shiprise
114
- body: ''
115
- headers:
116
- Authorization:
111
+ body: ""
112
+ headers:
113
+ Authorization:
117
114
  - <AUTH FILTERED>
118
- Accept:
119
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
120
- text/plain
121
- response:
122
- status:
115
+ Accept:
116
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
117
+ response:
118
+ status:
123
119
  code: 200
124
- message: !!null
125
- headers:
126
- server:
120
+ message:
121
+ headers:
122
+ server:
127
123
  - nginx/1.0.4
128
- date:
129
- - Mon, 09 Jan 2012 04:26:54 GMT
130
- content-type:
124
+ date:
125
+ - Sun, 15 Jan 2012 19:38:44 GMT
126
+ content-type:
131
127
  - application/json; charset=utf-8
132
- transfer-encoding:
128
+ transfer-encoding:
133
129
  - chunked
134
- connection:
130
+ connection:
135
131
  - close
136
- status:
132
+ status:
137
133
  - 200 OK
138
- x-ratelimit-limit:
139
- - '5000'
140
- etag:
141
- - ! '"c6a60d604b660c4c194cb914dd0da09a"'
142
- x-oauth-scopes:
134
+ x-ratelimit-limit:
135
+ - "5000"
136
+ etag:
137
+ - "\"5e3c5fb8b3ef2d076c983277730720d0\""
138
+ x-oauth-scopes:
143
139
  - repo
144
- x-ratelimit-remaining:
145
- - '4958'
146
- x-accepted-oauth-scopes:
140
+ x-ratelimit-remaining:
141
+ - "4996"
142
+ x-accepted-oauth-scopes:
147
143
  - repo
148
- body: ! '{"type":"Organization","location":null,"plan":{"private_repos":10,"space":2516582,"name":"bronze"},"followers":0,"company":null,"blog":"http://shiprise.net","email":"avdi@shiprise.net","disk_usage":552,"total_private_repos":1,"billing_email":"avdi@shiprise.net","created_at":"2011-10-27T20:49:51Z","login":"ShipRise","avatar_url":"https://secure.gravatar.com/avatar/6dd3c12e97a46ff08c358542cae955e2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","owned_private_repos":1,"public_gists":0,"following":0,"private_gists":0,"public_repos":0,"name":"ShipRise","html_url":"https://github.com/ShipRise","url":"https://api.github.com/orgs/ShipRise","id":1156570,"collaborators":0}'
149
- http_version: !!null
150
- recorded_at: Mon, 09 Jan 2012 04:26:52 GMT
151
- - request:
144
+ body: "{\"type\":\"Organization\",\"collaborators\":0,\"created_at\":\"2011-10-27T20:49:51Z\",\"email\":\"avdi@shiprise.net\",\"total_private_repos\":1,\"public_repos\":0,\"url\":\"https://api.github.com/orgs/ShipRise\",\"login\":\"ShipRise\",\"plan\":{\"private_repos\":10,\"space\":2516582,\"name\":\"bronze\"},\"followers\":0,\"blog\":\"http://shiprise.net\",\"owned_private_repos\":1,\"following\":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\",\"disk_usage\":552,\"public_gists\":0,\"html_url\":\"https://github.com/ShipRise\",\"name\":\"ShipRise\",\"location\":null,\"id\":1156570,\"private_gists\":0,\"company\":null}"
145
+ http_version:
146
+ recorded_at: Sun, 15 Jan 2012 19:38:44 GMT
147
+ - request:
152
148
  method: get
153
149
  uri: https://api.github.com/orgs/shiprise/teams
154
- body: ''
155
- headers:
156
- Authorization:
150
+ body: ""
151
+ headers:
152
+ Authorization:
157
153
  - <AUTH FILTERED>
158
- Accept:
159
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
160
- text/plain
161
- response:
162
- status:
154
+ Accept:
155
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
156
+ response:
157
+ status:
163
158
  code: 200
164
- message: !!null
165
- headers:
166
- server:
159
+ message:
160
+ headers:
161
+ server:
167
162
  - nginx/1.0.4
168
- date:
169
- - Mon, 09 Jan 2012 04:26:54 GMT
170
- content-type:
163
+ date:
164
+ - Sun, 15 Jan 2012 19:38:44 GMT
165
+ content-type:
171
166
  - application/json; charset=utf-8
172
- transfer-encoding:
167
+ transfer-encoding:
173
168
  - chunked
174
- connection:
169
+ connection:
175
170
  - close
176
- status:
171
+ status:
177
172
  - 200 OK
178
- x-ratelimit-limit:
179
- - '5000'
180
- etag:
181
- - ! '"7bacecfddc356d3ba366ba12652db603"'
182
- x-oauth-scopes:
173
+ x-ratelimit-limit:
174
+ - "5000"
175
+ etag:
176
+ - "\"00457d8d71ef8c5f77fd729ddcc288b7\""
177
+ x-oauth-scopes:
183
178
  - repo
184
- x-ratelimit-remaining:
185
- - '4957'
186
- x-accepted-oauth-scopes:
179
+ x-ratelimit-remaining:
180
+ - "4995"
181
+ x-accepted-oauth-scopes:
187
182
  - 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 04:26:52 GMT
192
- - request:
183
+ body: "[{\"url\":\"https://api.github.com/teams/111894\",\"name\":\"BitBindery Development\",\"id\":111894},{\"url\":\"https://api.github.com/teams/127491\",\"name\":\"Leadlight Test Team\",\"id\":127491},{\"url\":\"https://api.github.com/teams/104018\",\"name\":\"Owners\",\"id\":104018}]"
184
+ http_version:
185
+ recorded_at: Sun, 15 Jan 2012 19:38:44 GMT
186
+ - request:
193
187
  method: get
194
188
  uri: https://api.github.com/teams/127491
195
- body: ''
196
- headers:
197
- Authorization:
189
+ body: ""
190
+ headers:
191
+ Authorization:
198
192
  - <AUTH FILTERED>
199
- Accept:
200
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
201
- text/plain
202
- response:
203
- status:
193
+ Accept:
194
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
195
+ response:
196
+ status:
204
197
  code: 200
205
- message: !!null
206
- headers:
207
- server:
198
+ message:
199
+ headers:
200
+ server:
208
201
  - nginx/1.0.4
209
- date:
210
- - Mon, 09 Jan 2012 04:26:54 GMT
211
- content-type:
202
+ date:
203
+ - Sun, 15 Jan 2012 19:39:51 GMT
204
+ content-type:
212
205
  - application/json; charset=utf-8
213
- transfer-encoding:
206
+ transfer-encoding:
214
207
  - chunked
215
- connection:
208
+ connection:
216
209
  - close
217
- status:
210
+ status:
218
211
  - 200 OK
219
- x-ratelimit-limit:
220
- - '5000'
221
- etag:
222
- - ! '"028df71b90485d72587c23be1161baed"'
223
- x-oauth-scopes:
212
+ x-ratelimit-limit:
213
+ - "5000"
214
+ etag:
215
+ - "\"c8fb299f3c9bf7ddfd50e5ce06275345\""
216
+ x-oauth-scopes:
224
217
  - repo
225
- x-ratelimit-remaining:
226
- - '4956'
227
- x-accepted-oauth-scopes:
218
+ x-ratelimit-remaining:
219
+ - "4986"
220
+ x-accepted-oauth-scopes:
228
221
  - repo
229
- body: ! '{"repos_count":0,"permission":"pull","name":"Leadlight Test Team","members_count":1,"url":"https://api.github.com/teams/127491","id":127491}'
230
- http_version: !!null
231
- recorded_at: Mon, 09 Jan 2012 04:26:53 GMT
232
- - request:
222
+ body: "{\"members_count\":0,\"repos_count\":0,\"url\":\"https://api.github.com/teams/127491\",\"permission\":\"pull\",\"name\":\"Leadlight Test Team\",\"id\":127491}"
223
+ http_version:
224
+ recorded_at: Sun, 15 Jan 2012 19:39:51 GMT
225
+ - request:
233
226
  method: put
234
227
  uri: https://api.github.com/teams/127491/members/leadlight-test
235
- body: ''
236
- headers:
237
- Authorization:
228
+ body: ""
229
+ headers:
230
+ Authorization:
238
231
  - <AUTH FILTERED>
239
- Accept:
240
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
241
- text/plain
242
- response:
243
- status:
232
+ Accept:
233
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
234
+ response:
235
+ status:
244
236
  code: 204
245
- message: !!null
246
- headers:
247
- server:
237
+ message:
238
+ headers:
239
+ server:
248
240
  - nginx/1.0.4
249
- date:
250
- - Mon, 09 Jan 2012 04:26:55 GMT
251
- connection:
241
+ date:
242
+ - Sun, 15 Jan 2012 19:39:51 GMT
243
+ connection:
252
244
  - close
253
- status:
245
+ status:
254
246
  - 204 No Content
255
- x-ratelimit-limit:
256
- - '5000'
257
- etag:
258
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
259
- x-oauth-scopes:
247
+ x-ratelimit-limit:
248
+ - "5000"
249
+ etag:
250
+ - "\"d41d8cd98f00b204e9800998ecf8427e\""
251
+ x-oauth-scopes:
260
252
  - repo
261
- x-ratelimit-remaining:
262
- - '4955'
263
- x-accepted-oauth-scopes:
253
+ x-ratelimit-remaining:
254
+ - "4985"
255
+ x-accepted-oauth-scopes:
264
256
  - repo
265
- body: ''
266
- http_version: !!null
267
- recorded_at: Mon, 09 Jan 2012 04:26:53 GMT
268
- - request:
257
+ body: ""
258
+ http_version:
259
+ recorded_at: Sun, 15 Jan 2012 19:39:51 GMT
260
+ - request:
269
261
  method: get
270
262
  uri: https://api.github.com/teams/127491/members
271
- body: ''
272
- headers:
273
- Authorization:
263
+ body: ""
264
+ headers:
265
+ Authorization:
274
266
  - <AUTH FILTERED>
275
- Accept:
276
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
277
- text/plain
278
- response:
279
- status:
267
+ Accept:
268
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
269
+ response:
270
+ status:
280
271
  code: 200
281
- message: !!null
282
- headers:
283
- server:
272
+ message:
273
+ headers:
274
+ server:
284
275
  - nginx/1.0.4
285
- date:
286
- - Mon, 09 Jan 2012 04:26:55 GMT
287
- content-type:
276
+ date:
277
+ - Sun, 15 Jan 2012 19:39:51 GMT
278
+ content-type:
288
279
  - application/json; charset=utf-8
289
- transfer-encoding:
280
+ transfer-encoding:
290
281
  - chunked
291
- connection:
282
+ connection:
292
283
  - close
293
- status:
284
+ status:
294
285
  - 200 OK
295
- x-ratelimit-limit:
296
- - '5000'
297
- etag:
298
- - ! '"584015087edc658ced2457c05965827a"'
299
- x-oauth-scopes:
286
+ x-ratelimit-limit:
287
+ - "5000"
288
+ etag:
289
+ - "\"e851f02487ca5c26e7770f526f22e4a1\""
290
+ x-oauth-scopes:
300
291
  - repo
301
- x-ratelimit-remaining:
302
- - '4954'
303
- x-accepted-oauth-scopes:
292
+ x-ratelimit-remaining:
293
+ - "4984"
294
+ x-accepted-oauth-scopes:
304
295
  - repo
305
- body: ! '[{"gravatar_id":"71a3f4f0d28bcb9c10fe96bbfce8fef8","login":"leadlight-test","avatar_url":"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/leadlight-test","id":1314019}]'
306
- http_version: !!null
307
- recorded_at: Mon, 09 Jan 2012 04:26:53 GMT
308
- - request:
296
+ body: "[{\"avatar_url\":\"https://secure.gravatar.com/avatar/71a3f4f0d28bcb9c10fe96bbfce8fef8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/leadlight-test\",\"login\":\"leadlight-test\",\"id\":1314019,\"gravatar_id\":\"71a3f4f0d28bcb9c10fe96bbfce8fef8\"}]"
297
+ http_version:
298
+ recorded_at: Sun, 15 Jan 2012 19:39:51 GMT
299
+ - request:
309
300
  method: delete
310
301
  uri: https://api.github.com/teams/127491/members/leadlight-test
311
- body: ''
312
- headers:
313
- Authorization:
302
+ body: ""
303
+ headers:
304
+ Authorization:
314
305
  - <AUTH FILTERED>
315
- Accept:
316
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
317
- text/plain
318
- response:
319
- status:
306
+ Accept:
307
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
308
+ response:
309
+ status:
320
310
  code: 204
321
- message: !!null
322
- headers:
323
- server:
311
+ message:
312
+ headers:
313
+ server:
324
314
  - nginx/1.0.4
325
- date:
326
- - Mon, 09 Jan 2012 04:29:59 GMT
327
- connection:
315
+ date:
316
+ - Sun, 15 Jan 2012 19:39:52 GMT
317
+ connection:
328
318
  - close
329
- status:
319
+ status:
330
320
  - 204 No Content
331
- x-ratelimit-limit:
332
- - '5000'
333
- etag:
334
- - ! '"d41d8cd98f00b204e9800998ecf8427e"'
335
- x-oauth-scopes:
321
+ x-ratelimit-limit:
322
+ - "5000"
323
+ etag:
324
+ - "\"d41d8cd98f00b204e9800998ecf8427e\""
325
+ x-oauth-scopes:
336
326
  - repo
337
- x-ratelimit-remaining:
338
- - '4953'
339
- x-accepted-oauth-scopes:
327
+ x-ratelimit-remaining:
328
+ - "4983"
329
+ x-accepted-oauth-scopes:
340
330
  - repo
341
- body: ''
342
- http_version: !!null
343
- recorded_at: Mon, 09 Jan 2012 04:29:57 GMT
344
- - request:
331
+ body: ""
332
+ http_version:
333
+ recorded_at: Sun, 15 Jan 2012 19:39:52 GMT
334
+ - request:
345
335
  method: get
346
336
  uri: https://api.github.com/teams/127491/members
347
- body: ''
348
- headers:
349
- Authorization:
337
+ body: ""
338
+ headers:
339
+ Authorization:
350
340
  - <AUTH FILTERED>
351
- Accept:
352
- - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html,
353
- text/plain
354
- response:
355
- status:
341
+ Accept:
342
+ - application/json, text/x-yaml, application/xml, application/xhtml+xml, text/html, text/plain
343
+ response:
344
+ status:
356
345
  code: 200
357
- message: !!null
358
- headers:
359
- server:
346
+ message:
347
+ headers:
348
+ server:
360
349
  - nginx/1.0.4
361
- date:
362
- - Mon, 09 Jan 2012 04:29:59 GMT
363
- content-type:
350
+ date:
351
+ - Sun, 15 Jan 2012 19:39:52 GMT
352
+ content-type:
364
353
  - application/json; charset=utf-8
365
- connection:
354
+ connection:
366
355
  - close
367
- status:
356
+ status:
368
357
  - 200 OK
369
- x-ratelimit-limit:
370
- - '5000'
371
- etag:
372
- - ! '"d751713988987e9331980363e24189ce"'
373
- x-oauth-scopes:
358
+ x-ratelimit-limit:
359
+ - "5000"
360
+ etag:
361
+ - "\"d751713988987e9331980363e24189ce\""
362
+ x-oauth-scopes:
374
363
  - repo
375
- x-ratelimit-remaining:
376
- - '4952'
377
- content-length:
378
- - '2'
379
- x-accepted-oauth-scopes:
364
+ x-ratelimit-remaining:
365
+ - "4982"
366
+ content-length:
367
+ - "2"
368
+ x-accepted-oauth-scopes:
380
369
  - repo
381
- body: ! '[]'
382
- http_version: !!null
383
- recorded_at: Mon, 09 Jan 2012 04:29:57 GMT
370
+ body: "[]"
371
+ http_version:
372
+ recorded_at: Sun, 15 Jan 2012 19:39:52 GMT
384
373
  recorded_with: VCR 2.0.0.rc1