Class: ResponseHandler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, single_from_list: false) ⇒ ResponseHandler

Returns a new instance of ResponseHandler.



3
4
5
6
# File 'lib/response_handler.rb', line 3

def initialize(response, single_from_list: false)
  @response = response
  @single_from_list = single_from_list
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/response_handler.rb', line 8

def response
  @response
end

#single_from_listObject (readonly)

Returns the value of attribute single_from_list.



8
9
10
# File 'lib/response_handler.rb', line 8

def single_from_list
  @single_from_list
end

Instance Method Details

#parse!Object



10
11
12
# File 'lib/response_handler.rb', line 10

def parse!
  success? ? handle_success : handle_error
end