Class: Bugsink::Client::Response
- Inherits:
-
Object
- Object
- Bugsink::Client::Response
- Defined in:
- lib/bugsink/client.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#next_cursor ⇒ Object
readonly
Returns the value of attribute next_cursor.
Instance Method Summary collapse
- #add_data(new_data) ⇒ Object
- #has_more? ⇒ Boolean
-
#initialize(response_body) ⇒ Response
constructor
A new instance of Response.
- #initialize_from_list(response_body) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response_body) ⇒ Response
Returns a new instance of Response.
26 27 28 29 |
# File 'lib/bugsink/client.rb', line 26 def initialize(response_body) @data = response_body.is_a?(Hash) ? [response_body] : (response_body || []) @next_cursor = extract_next_cursor(@data) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
24 25 26 |
# File 'lib/bugsink/client.rb', line 24 def data @data end |
#next_cursor ⇒ Object (readonly)
Returns the value of attribute next_cursor.
24 25 26 |
# File 'lib/bugsink/client.rb', line 24 def next_cursor @next_cursor end |
Instance Method Details
#add_data(new_data) ⇒ Object
40 41 42 |
# File 'lib/bugsink/client.rb', line 40 def add_data(new_data) @data.concat(new_data) end |
#has_more? ⇒ Boolean
44 45 46 |
# File 'lib/bugsink/client.rb', line 44 def has_more? !@next_cursor.nil? end |
#initialize_from_list(response_body) ⇒ Object
31 32 33 34 |
# File 'lib/bugsink/client.rb', line 31 def initialize_from_list(response_body) @data = response_body['results'] || [] @next_cursor = response_body['next'] end |
#success? ⇒ Boolean
36 37 38 |
# File 'lib/bugsink/client.rb', line 36 def success? true end |