Sha256: 04af72a9062e008816d4b2c48806a3b330024a64aa4166f06a28576325df5f73
Contents?: true
Size: 1.14 KB
Versions: 9
Compression:
Stored size: 1.14 KB
Contents
module XeroGateway class Response attr_accessor :response_id, :status, :errors, :provider, :date_time, :response_item, :request_params, :request_xml, :response_xml def array_wrapped_response_item Array(response_item) end alias_method :invoice, :response_item alias_method :credit_note, :response_item alias_method :contact, :response_item alias_method :organisation, :response_item alias_method :invoices, :array_wrapped_response_item alias_method :credit_notes, :array_wrapped_response_item alias_method :contacts, :array_wrapped_response_item alias_method :accounts, :array_wrapped_response_item alias_method :tracking_categories, :array_wrapped_response_item alias_method :tax_rates, :array_wrapped_response_item alias_method :currencies, :array_wrapped_response_item def initialize(params = {}) params.each do |k,v| self.send("#{k}=", v) end @errors ||= [] @response_item ||= [] end def success? status == "OK" end def error errors.blank? ? nil : errors[0] end end end
Version data entries
9 entries across 9 versions & 1 rubygems