Class: XeroGateway::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/xero_gateway/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Response

Returns a new instance of Response.



25
26
27
28
29
30
31
32
# File 'lib/xero_gateway/response.rb', line 25

def initialize(params = {})
  params.each do |k,v|
    self.send("#{k}=", v)
  end
  
  @errors ||= []
  @response_item ||= []
end

Instance Attribute Details

#date_timeObject

Returns the value of attribute date_time.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def date_time
  @date_time
end

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def errors
  @errors
end

#providerObject

Returns the value of attribute provider.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def provider
  @provider
end

#request_paramsObject

Returns the value of attribute request_params.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def request_params
  @request_params
end

#request_xmlObject

Returns the value of attribute request_xml.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def request_xml
  @request_xml
end

#response_idObject

Returns the value of attribute response_id.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def response_id
  @response_id
end

#response_itemObject Also known as: invoice, credit_note, bank_transaction, manual_journal, contact, organisation

Returns the value of attribute response_item.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def response_item
  @response_item
end

#response_xmlObject

Returns the value of attribute response_xml.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def response_xml
  @response_xml
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/xero_gateway/response.rb', line 3

def status
  @status
end

Instance Method Details

#array_wrapped_response_itemObject Also known as: invoices, credit_notes, bank_transactions, manual_journals, contacts, accounts, tracking_categories, tax_rates, currencies



5
6
7
# File 'lib/xero_gateway/response.rb', line 5

def array_wrapped_response_item
  Array(response_item)
end

#errorObject



39
40
41
# File 'lib/xero_gateway/response.rb', line 39

def error
  errors.blank? ? nil : errors[0]
end

#success?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/xero_gateway/response.rb', line 35

def success?
  status == "OK"
end