Class: TelephoneAppointments::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



3
4
5
# File 'lib/telephone_appointments/response.rb', line 3

def initialize(response)
  @response = response
end

Instance Method Details

#errorsObject



11
12
13
14
# File 'lib/telephone_appointments/response.rb', line 11

def errors
  return {} if success? || response.body.nil? || response.body == ''
  JSON.parse(response.body)
end

#success?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/telephone_appointments/response.rb', line 7

def success?
  response.is_a? Net::HTTPSuccess
end