Sha256: 6205bbd8fab31ccd8e96629d238e20c19c071d35476a3d8c6c50d91e113ef79f
Contents?: true
Size: 686 Bytes
Versions: 5
Compression:
Stored size: 686 Bytes
Contents
require 'howitzer/exceptions' module Howitzer module MailgunApi # A MailgunApi::Response object is instantiated for each response generated # by the Client request. The Response object supports deserialization of # the JSON result. class Response attr_accessor :body, :code def initialize(response) @body = response.body @code = response.code end # Return a response as a Ruby Hash # @raise [ParseError] in case of an json parsing error # @return [Hash] HTTP result as hash. def to_h JSON.parse(@body) rescue StandardError => e raise ParseError, e.message end end end end
Version data entries
5 entries across 5 versions & 1 rubygems