Module: Dynaccount
- Defined in:
- lib/dynaccount.rb,
lib/dynaccount/bank.rb,
lib/dynaccount/unit.rb,
lib/dynaccount/year.rb,
lib/dynaccount/draft.rb,
lib/dynaccount/action.rb,
lib/dynaccount/debtor.rb,
lib/dynaccount/account.rb,
lib/dynaccount/contact.rb,
lib/dynaccount/payment.rb,
lib/dynaccount/product.rb,
lib/dynaccount/vatcode.rb,
lib/dynaccount/version.rb,
lib/dynaccount/creditor.rb,
lib/dynaccount/currency.rb,
lib/dynaccount/followup.rb,
lib/dynaccount/location.rb,
lib/dynaccount/dimension.rb,
lib/dynaccount/enclosure.rb,
lib/dynaccount/accounting.rb,
lib/dynaccount/bank_recon.rb,
lib/dynaccount/opportunity.rb,
lib/dynaccount/year_period.rb,
lib/dynaccount/contact_user.rb,
lib/dynaccount/data_voucher.rb,
lib/dynaccount/debtor_group.rb,
lib/dynaccount/debtor_order.rb,
lib/dynaccount/debtor_quote.rb,
lib/dynaccount/product_list.rb,
lib/dynaccount/product_group.rb,
lib/dynaccount/query_builder.rb,
lib/dynaccount/creditor_group.rb,
lib/dynaccount/creditor_order.rb,
lib/dynaccount/debtor_invoice.rb,
lib/dynaccount/accounting_bank.rb,
lib/dynaccount/debtor_reminder.rb,
lib/dynaccount/creditor_invoice.rb,
lib/dynaccount/product_currency.rb,
lib/dynaccount/product_supplier.rb,
lib/dynaccount/stock_adjustment.rb,
lib/dynaccount/debtor_creditnote.rb,
lib/dynaccount/dynaccount_object.rb,
lib/dynaccount/debtor_subscription.rb,
lib/dynaccount/debtor_invoice_match.rb,
lib/dynaccount/debtor_order_product.rb,
lib/dynaccount/debtor_quote_product.rb,
lib/dynaccount/product_list_product.rb,
lib/dynaccount/creditor_invoice_match.rb,
lib/dynaccount/creditor_order_product.rb,
lib/dynaccount/debtor_invoice_product.rb,
lib/dynaccount/debtor_product_discount.rb,
lib/dynaccount/creditor_invoice_product.rb,
lib/dynaccount/debtor_accounting_module.rb,
lib/dynaccount/debtor_creditnote_product.rb,
lib/dynaccount/debtor_order_product_list.rb,
lib/dynaccount/debtor_quote_product_list.rb,
lib/dynaccount/debtor_subscription_group.rb,
lib/dynaccount/creditor_accounting_module.rb,
lib/dynaccount/debtor_invoice_product_list.rb,
lib/dynaccount/debtor_subscription_product.rb,
lib/dynaccount/debtor_group_product_discount.rb,
lib/dynaccount/debtor_order_product_serialno.rb,
lib/dynaccount/debtor_product_group_discount.rb,
lib/dynaccount/debtor_creditnote_product_list.rb,
lib/dynaccount/creditor_order_product_serialno.rb,
lib/dynaccount/debtor_subscription_product_list.rb,
lib/dynaccount/debtor_subscription_group_product.rb,
lib/dynaccount/debtor_group_product_group_discount.rb,
lib/dynaccount/debtor_subscription_group_product_list.rb
Defined Under Namespace
Classes: Account, Accounting, AccountingBank, Action, Bank, BankRecon, Contact, ContactUser, Creditor, CreditorAccountingModule, CreditorGroup, CreditorInvoice, CreditorInvoiceMatch, CreditorInvoiceProduct, CreditorOrder, CreditorOrderProduct, CreditorOrderProductSerialno, Currency, DataVoucher, Debtor, DebtorAccountingModule, DebtorCreditnote, DebtorCreditnoteProduct, DebtorCreditnoteProductList, DebtorGroup, DebtorGroupProductDiscount, DebtorGroupProductGroupDiscount, DebtorInvoice, DebtorInvoiceMatch, DebtorInvoiceProduct, DebtorInvoiceProductList, DebtorOrder, DebtorOrderProduct, DebtorOrderProductList, DebtorOrderProductSerialno, DebtorProductDiscount, DebtorProductGroupDiscount, DebtorQuote, DebtorQuoteProduct, DebtorQuoteProductList, DebtorReminder, DebtorSubscription, DebtorSubscriptionGroup, DebtorSubscriptionGroupProduct, DebtorSubscriptionGroupProductList, DebtorSubscriptionProduct, DebtorSubscriptionProductList, Dimension, Draft, DynaccountObject, Enclosure, Followup, Location, Opportunity, Payment, Product, ProductCurrency, ProductGroup, ProductList, ProductListProduct, ProductSupplier, QueryBuilder, StockAdjustment, Unit, Vatcode, Year, YearPeriod
Constant Summary collapse
- VERSION =
'0.9.10'.freeze
Class Attribute Summary collapse
-
.api_base ⇒ Object
Returns the value of attribute api_base.
-
.api_id ⇒ Object
Returns the value of attribute api_id.
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.api_secret ⇒ Object
Returns the value of attribute api_secret.
-
.debug ⇒ Object
Returns the value of attribute debug.
Class Method Summary collapse
- .api_hash(url, params = {}) ⇒ Object
- .request(url, params = {}, _method = :post) ⇒ Object
- .request_url(url) ⇒ Object
Class Attribute Details
.api_base ⇒ Object
Returns the value of attribute api_base.
81 82 83 |
# File 'lib/dynaccount.rb', line 81 def api_base @api_base end |
.api_id ⇒ Object
Returns the value of attribute api_id.
81 82 83 |
# File 'lib/dynaccount.rb', line 81 def api_id @api_id end |
.api_key ⇒ Object
Returns the value of attribute api_key.
81 82 83 |
# File 'lib/dynaccount.rb', line 81 def api_key @api_key end |
.api_secret ⇒ Object
Returns the value of attribute api_secret.
81 82 83 |
# File 'lib/dynaccount.rb', line 81 def api_secret @api_secret end |
.debug ⇒ Object
Returns the value of attribute debug.
81 82 83 |
# File 'lib/dynaccount.rb', line 81 def debug @debug end |
Class Method Details
.api_hash(url, params = {}) ⇒ Object
103 104 105 |
# File 'lib/dynaccount.rb', line 103 def api_hash(url, params = {}) (Digest::SHA1.new << "#{url}#{URI.encode_www_form(params)}#{api_secret}").to_s end |
.request(url, params = {}, _method = :post) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/dynaccount.rb', line 83 def request(url, params = {}, _method = :post) @api_connection ||= Faraday.new(url: "https://#{@base_url}") do |faraday| faraday.request :url_encoded logger = Logger.new STDOUT logger.level = debug ? Logger::DEBUG : Logger::INFO faraday.response :logger, logger, bodies: true faraday.adapter :net_http_persistent end @api_connection.post do |req| req.url url req.headers['X-Hash'] = api_hash(request_url(url), params) req.body = URI.encode_www_form(params).to_s end end |
.request_url(url) ⇒ Object
99 100 101 |
# File 'lib/dynaccount.rb', line 99 def request_url(url) @base_url + url end |