Class: JawboneUp::Client::Response
- Inherits:
-
Object
- Object
- JawboneUp::Client::Response
- Includes:
- Enumerable
- Defined in:
- lib/jawbone_up/client/response.rb,
lib/jawbone_up/client/response/item.rb,
lib/jawbone_up/client/response/meta.rb
Defined Under Namespace
Instance Method Summary collapse
- #[](key) ⇒ Object
- #code ⇒ Object
- #each ⇒ Object
- #headers ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #meta ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
9 10 11 |
# File 'lib/jawbone_up/client/response.rb', line 9 def initialize(response) @response = response end |
Instance Method Details
#[](key) ⇒ Object
35 36 37 |
# File 'lib/jawbone_up/client/response.rb', line 35 def [](key) data[key] end |
#code ⇒ Object
13 14 15 |
# File 'lib/jawbone_up/client/response.rb', line 13 def code @response.code end |
#each ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/jawbone_up/client/response.rb', line 25 def each if data.has_key?('items') data['items'].each do |item| yield Item.new(item) end else yield Item.new(data) end end |
#headers ⇒ Object
17 18 19 |
# File 'lib/jawbone_up/client/response.rb', line 17 def headers @response.headers end |