class Economic::Session
The Economic::Session
contains details and behaviors for a current connection to the API endpoint.
Attributes
Public Class Methods
# File lib/economic/session.rb, line 15 def initialize yield endpoint if block_given? end
Public Instance Methods
# File lib/economic/session.rb, line 77 def accounts @accounts ||= AccountProxy.new(self) end
# File lib/economic/session.rb, line 73 def cash_book_entries @cash_book_entries ||= CashBookEntryProxy.new(self) end
# File lib/economic/session.rb, line 69 def cash_books @cash_books ||= CashBookProxy.new(self) end
# File lib/economic/session.rb, line 98 def company @company ||= CompanyProxy.new(self) end
Connect/authenticate with an API token and app id
Reference: techtalk.e-conomic.com/why-were-implementing-a-new-api-connection-model/
Attributes¶ ↑
-
private_app_id
- The App ID created in your developer agreement -
access_id
- The Access ID or token for your App ID
# File lib/economic/session.rb, line 28 def connect_with_token(private_app_id, access_id) endpoint.call( :connect_with_token, :token => access_id, :appToken => private_app_id ) do |response| store_authentication_cookies(response) end end
Provides access to the DebtorContacts
# File lib/economic/session.rb, line 39 def contacts @contacts ||= DebtorContactProxy.new(self) end
# File lib/economic/session.rb, line 85 def creditor_entries @creditor_entries ||= CreditorEntryProxy.new(self) end
Provides access to creditors
# File lib/economic/session.rb, line 65 def creditors @creditors ||= CreditorProxy.new(self) end
Provides access to the current invoices - ie invoices that haven't yet been booked
# File lib/economic/session.rb, line 45 def current_invoices @current_invoices ||= CurrentInvoiceProxy.new(self) end
# File lib/economic/session.rb, line 81 def debtor_entries @debtor_entries ||= DebtorEntryProxy.new(self) end
Provides access to the debtors
# File lib/economic/session.rb, line 60 def debtors @debtors ||= DebtorProxy.new(self) end
Returns the SOAP endpoint to connect to
# File lib/economic/session.rb, line 113 def endpoint @endpoint ||= Economic::Endpoint.new end
# File lib/economic/session.rb, line 89 def entries @entries ||= EntryProxy.new(self) end
Provides access to the invoices
# File lib/economic/session.rb, line 50 def invoices @invoices ||= InvoiceProxy.new(self) end
Provides access to the orders
# File lib/economic/session.rb, line 55 def orders @orders ||= OrderProxy.new(self) end
Provides access to products
# File lib/economic/session.rb, line 94 def products @products ||= ProductProxy.new(self) end
Requests an action from the API endpoint
# File lib/economic/session.rb, line 103 def request(soap_action, data = nil) endpoint.call(soap_action, data, authentication_cookies) end
Returns self - used by proxies to access the session of their owner
# File lib/economic/session.rb, line 108 def session self end