class Checkmobi::SDK::Response
Attributes
body[RW]
code[RW]
Public Class Methods
new(response)
click to toggle source
# File lib/checkmobi/response.rb, line 7 def initialize(response) @body = response.body @code = response.code end
Public Instance Methods
to_h()
click to toggle source
# File lib/checkmobi/response.rb, line 12 def to_h JSON.parse(@body) rescue => err raise err end
to_h!()
click to toggle source
Replace @body with Ruby Hash
@return [Hash] A standard Ruby Hash containing the HTTP result.
# File lib/checkmobi/response.rb, line 21 def to_h! @body = JSON.parse(@body) rescue => err raise ParseError.new(err), err end
to_yaml()
click to toggle source
Return response as Yaml
@return [String] A string containing response as YAML
# File lib/checkmobi/response.rb, line 30 def to_yaml YAML.dump(to_h) rescue => err raise err end
to_yaml!()
click to toggle source
Replace @body with YAML
@return [String] A string containing response as YAML
# File lib/checkmobi/response.rb, line 39 def to_yaml! @body = YAML.dump(to_h) rescue => err raise ParseError.new(err), err end