class SageWorld::ResponseHandler
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/sage_world/response_handler.rb, line 7 def initialize(response) validate_response(response) @response = response end
Public Instance Methods
body()
click to toggle source
# File lib/sage_world/response_handler.rb, line 12 def body @response.body.with_indifferent_access end
method_missing(method_name)
click to toggle source
# File lib/sage_world/response_handler.rb, line 16 def method_missing(method_name) key_name = method_name.to_s.camelize find_in_hash(key_name) end
Private Instance Methods
validate_response(response)
click to toggle source
# File lib/sage_world/response_handler.rb, line 21 def validate_response(response) if response.body[SageWorld::Constants::ROOT_KEY].key?(SageWorld::Constants::ERROR_KEY) raise SageWorld::GeneralError.new(response.body[SageWorld::Constants::ROOT_KEY][SageWorld::Constants::ERROR_KEY]) end end