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.



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

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, payments



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

def array_wrapped_response_item
  Array(response_item)
end

#errorObject



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

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

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  status == "OK"
end