Sha256: 2c0e40a060dad2b8165d624ffe7d1a4c2dd13ad7aaf5dc17c849ed45c8088c8a
Contents?: true
Size: 705 Bytes
Versions: 7
Compression:
Stored size: 705 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 attr_accessor :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
7 entries across 7 versions & 1 rubygems