Sha256: b6a2d8ea95d423dd36d64ce2dd8d32606a44ba6c620986972b026cfe2ca5d958
Contents?: true
Size: 645 Bytes
Versions: 5
Compression:
Stored size: 645 Bytes
Contents
module SynapsePay class APIError < SynapsePayError attr_reader :api_method def initialize(message=nil, api_method=nil) @message = message @api_method = api_method end def code @api_method.response_code if @api_method end def body @api_method.response_body if @api_method end def json begin if @api_method hash = @api_method.response_json return APIObject.construct(hash) end rescue APIError nil end end def to_s prefix = code.nil? ? "" : "(Status #{code}) " "#{prefix}#{@message}" end end end
Version data entries
5 entries across 5 versions & 1 rubygems