Class: Economic::Session
- Inherits:
-
Object
- Object
- Economic::Session
- Extended by:
- Forwardable
- Defined in:
- lib/economic/session.rb
Overview
The Economic::Session contains details and behaviors for a current connection to the API endpoint.
Instance Attribute Summary collapse
-
#authentication_cookies ⇒ Object
readonly
Returns the value of attribute authentication_cookies.
Instance Method Summary collapse
- #accounts ⇒ Object
- #cash_book_entries ⇒ Object
- #cash_books ⇒ Object
- #company ⇒ Object
-
#connect_with_token(private_app_id, access_id) ⇒ Object
Connect/authenticate with an API token and app id.
-
#contacts ⇒ Object
Provides access to the DebtorContacts.
- #creditor_entries ⇒ Object
-
#creditors ⇒ Object
Provides access to creditors.
-
#current_invoices ⇒ Object
Provides access to the current invoices - ie invoices that haven’t yet been booked.
- #debtor_entries ⇒ Object
-
#debtors ⇒ Object
Provides access to the debtors.
-
#endpoint ⇒ Object
Returns the SOAP endpoint to connect to.
- #entries ⇒ Object
-
#initialize {|endpoint| ... } ⇒ Session
constructor
A new instance of Session.
-
#invoices ⇒ Object
Provides access to the invoices.
-
#orders ⇒ Object
Provides access to the orders.
-
#products ⇒ Object
Provides access to products.
-
#request(soap_action, data = nil) ⇒ Object
Requests an action from the API endpoint.
-
#session ⇒ Object
Returns self - used by proxies to access the session of their owner.
Constructor Details
#initialize {|endpoint| ... } ⇒ Session
Returns a new instance of Session.
15 16 17 |
# File 'lib/economic/session.rb', line 15 def initialize yield endpoint if block_given? end |
Instance Attribute Details
#authentication_cookies ⇒ Object (readonly)
Returns the value of attribute authentication_cookies.
13 14 15 |
# File 'lib/economic/session.rb', line 13 def @authentication_cookies end |
Instance Method Details
#accounts ⇒ Object
77 78 79 |
# File 'lib/economic/session.rb', line 77 def accounts @accounts ||= AccountProxy.new(self) end |
#cash_book_entries ⇒ Object
73 74 75 |
# File 'lib/economic/session.rb', line 73 def cash_book_entries @cash_book_entries ||= CashBookEntryProxy.new(self) end |
#cash_books ⇒ Object
69 70 71 |
# File 'lib/economic/session.rb', line 69 def cash_books @cash_books ||= CashBookProxy.new(self) end |
#company ⇒ Object
98 99 100 |
# File 'lib/economic/session.rb', line 98 def company @company ||= CompanyProxy.new(self) end |
#connect_with_token(private_app_id, access_id) ⇒ Object
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
28 29 30 31 32 33 34 35 36 |
# 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| (response) end end |
#contacts ⇒ Object
Provides access to the DebtorContacts
39 40 41 |
# File 'lib/economic/session.rb', line 39 def contacts @contacts ||= DebtorContactProxy.new(self) end |
#creditor_entries ⇒ Object
85 86 87 |
# File 'lib/economic/session.rb', line 85 def creditor_entries @creditor_entries ||= CreditorEntryProxy.new(self) end |
#creditors ⇒ Object
Provides access to creditors
65 66 67 |
# File 'lib/economic/session.rb', line 65 def creditors @creditors ||= CreditorProxy.new(self) end |
#current_invoices ⇒ Object
Provides access to the current invoices - ie invoices that haven’t yet been booked
45 46 47 |
# File 'lib/economic/session.rb', line 45 def current_invoices @current_invoices ||= CurrentInvoiceProxy.new(self) end |
#debtor_entries ⇒ Object
81 82 83 |
# File 'lib/economic/session.rb', line 81 def debtor_entries @debtor_entries ||= DebtorEntryProxy.new(self) end |
#debtors ⇒ Object
Provides access to the debtors
60 61 62 |
# File 'lib/economic/session.rb', line 60 def debtors @debtors ||= DebtorProxy.new(self) end |
#endpoint ⇒ Object
Returns the SOAP endpoint to connect to
113 114 115 |
# File 'lib/economic/session.rb', line 113 def endpoint @endpoint ||= Economic::Endpoint.new end |
#entries ⇒ Object
89 90 91 |
# File 'lib/economic/session.rb', line 89 def entries @entries ||= EntryProxy.new(self) end |
#invoices ⇒ Object
Provides access to the invoices
50 51 52 |
# File 'lib/economic/session.rb', line 50 def invoices @invoices ||= InvoiceProxy.new(self) end |
#orders ⇒ Object
Provides access to the orders
55 56 57 |
# File 'lib/economic/session.rb', line 55 def orders @orders ||= OrderProxy.new(self) end |
#products ⇒ Object
Provides access to products
94 95 96 |
# File 'lib/economic/session.rb', line 94 def products @products ||= ProductProxy.new(self) end |
#request(soap_action, data = nil) ⇒ Object
Requests an action from the API endpoint
103 104 105 |
# File 'lib/economic/session.rb', line 103 def request(soap_action, data = nil) endpoint.call(soap_action, data, ) end |
#session ⇒ Object
Returns self - used by proxies to access the session of their owner
108 109 110 |
# File 'lib/economic/session.rb', line 108 def session self end |