class CheckMot::Response
Attributes
raw_response[R]
Public Class Methods
new(raw_response)
click to toggle source
# File lib/check_mot/response.rb, line 4 def initialize(raw_response) @raw_response = raw_response end
Public Instance Methods
raw()
click to toggle source
# File lib/check_mot/response.rb, line 21 def raw raw_response.body end
sanitized()
click to toggle source
# File lib/check_mot/response.rb, line 10 def sanitized return unless success? case parsed_response when Array parsed_response.map(&method(:transform)) else transform(parsed_response) end end
Private Instance Methods
parsed_response()
click to toggle source
# File lib/check_mot/response.rb, line 33 def parsed_response @_parsed_response ||= JSON.parse(raw_response.body) end
transform(response_hash)
click to toggle source
# File lib/check_mot/response.rb, line 29 def transform(response_hash) response_hash.deep_transform_keys { |key| key.underscore.to_sym } end