Class: KudagoClient::Response
- Inherits:
-
Object
- Object
- KudagoClient::Response
- Defined in:
- lib/kudago_client/response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
-
#initialize(response_body) ⇒ Response
constructor
A new instance of Response.
- #list? ⇒ Boolean
Constructor Details
#initialize(response_body) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kudago_client/response.rb', line 9 def initialize(response_body) @list = true prepared_data = if response_body.is_a? Array data_with_count = parse_with_count(response_body) parse_response_urls(data_with_count) elsif response_body.is_a?(Hash) && response_body.key?(:count) parse_response_urls(response_body) else @list = false response_body end @data = prepared_data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/kudago_client/response.rb', line 7 def data @data end |
#list ⇒ Object (readonly)
Returns the value of attribute list.
7 8 9 |
# File 'lib/kudago_client/response.rb', line 7 def list @list end |
Instance Method Details
#list? ⇒ Boolean
26 27 28 |
# File 'lib/kudago_client/response.rb', line 26 def list? list end |