class Howitzer::MailgunApi::Response
A MailgunApi::Response
object is instantiated for each response generated by the Client
request. The Response
object supports deserialization of the JSON result.
Attributes
body[RW]
code[RW]
Public Class Methods
new(response)
click to toggle source
# File lib/howitzer/mailgun_api/response.rb, line 11 def initialize(response) @body = response.body @code = response.code end
Public Instance Methods
to_h()
click to toggle source
Return a response as a Ruby Hash @raise [ParseError] in case of an json parsing error @return [Hash] HTTP result as hash.
# File lib/howitzer/mailgun_api/response.rb, line 20 def to_h JSON.parse(@body) rescue StandardError => e raise ParseError, e.message end