Class: Bugsink::Client::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsink/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



24
25
26
# File 'lib/bugsink/client.rb', line 24

def data
  @data
end

#next_cursorObject (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

Returns:

  • (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

Returns:

  • (Boolean)


36
37
38
# File 'lib/bugsink/client.rb', line 36

def success?
  true
end