dynaccount 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +28 -0
- data/lib/dynaccount.rb +104 -0
- data/lib/dynaccount/account.rb +11 -0
- data/lib/dynaccount/accounting.rb +11 -0
- data/lib/dynaccount/accounting_bank.rb +11 -0
- data/lib/dynaccount/action.rb +15 -0
- data/lib/dynaccount/bank.rb +11 -0
- data/lib/dynaccount/bank_recon.rb +11 -0
- data/lib/dynaccount/contact.rb +11 -0
- data/lib/dynaccount/contact_user.rb +11 -0
- data/lib/dynaccount/creditor.rb +11 -0
- data/lib/dynaccount/creditor_accounting_module.rb +11 -0
- data/lib/dynaccount/creditor_group.rb +11 -0
- data/lib/dynaccount/creditor_invoice.rb +11 -0
- data/lib/dynaccount/creditor_invoice_match.rb +11 -0
- data/lib/dynaccount/creditor_invoice_product.rb +11 -0
- data/lib/dynaccount/creditor_order.rb +11 -0
- data/lib/dynaccount/creditor_order_product.rb +11 -0
- data/lib/dynaccount/creditor_order_product_serialno.rb +11 -0
- data/lib/dynaccount/currency.rb +11 -0
- data/lib/dynaccount/data_voucher.rb +11 -0
- data/lib/dynaccount/debtor.rb +11 -0
- data/lib/dynaccount/debtor_accounting_module.rb +11 -0
- data/lib/dynaccount/debtor_creditnote.rb +11 -0
- data/lib/dynaccount/debtor_creditnote_product.rb +11 -0
- data/lib/dynaccount/debtor_creditnote_product_list.rb +11 -0
- data/lib/dynaccount/debtor_group.rb +11 -0
- data/lib/dynaccount/debtor_group_product_discount.rb +11 -0
- data/lib/dynaccount/debtor_group_product_group_discount.rb +11 -0
- data/lib/dynaccount/debtor_invoice.rb +11 -0
- data/lib/dynaccount/debtor_invoice_match.rb +11 -0
- data/lib/dynaccount/debtor_invoice_product.rb +11 -0
- data/lib/dynaccount/debtor_invoice_product_list.rb +11 -0
- data/lib/dynaccount/debtor_order.rb +11 -0
- data/lib/dynaccount/debtor_order_product.rb +11 -0
- data/lib/dynaccount/debtor_order_product_list.rb +11 -0
- data/lib/dynaccount/debtor_order_product_serialno.rb +11 -0
- data/lib/dynaccount/debtor_product_discount.rb +11 -0
- data/lib/dynaccount/debtor_product_group_discount.rb +11 -0
- data/lib/dynaccount/debtor_quote.rb +11 -0
- data/lib/dynaccount/debtor_quote_product.rb +11 -0
- data/lib/dynaccount/debtor_quote_product_list.rb +11 -0
- data/lib/dynaccount/debtor_reminder.rb +11 -0
- data/lib/dynaccount/debtor_subscription.rb +11 -0
- data/lib/dynaccount/debtor_subscription_group.rb +11 -0
- data/lib/dynaccount/debtor_subscription_group_product.rb +11 -0
- data/lib/dynaccount/debtor_subscription_group_product_list.rb +11 -0
- data/lib/dynaccount/debtor_subscription_product.rb +11 -0
- data/lib/dynaccount/debtor_subscription_product_list.rb +11 -0
- data/lib/dynaccount/dimension.rb +11 -0
- data/lib/dynaccount/draft.rb +11 -0
- data/lib/dynaccount/dynaccount_object.rb +53 -0
- data/lib/dynaccount/enclosure.rb +11 -0
- data/lib/dynaccount/followup.rb +11 -0
- data/lib/dynaccount/location.rb +11 -0
- data/lib/dynaccount/opportunity.rb +11 -0
- data/lib/dynaccount/payment.rb +11 -0
- data/lib/dynaccount/product.rb +11 -0
- data/lib/dynaccount/product_currency.rb +11 -0
- data/lib/dynaccount/product_group.rb +11 -0
- data/lib/dynaccount/product_list.rb +11 -0
- data/lib/dynaccount/product_list_product.rb +11 -0
- data/lib/dynaccount/product_supplier.rb +11 -0
- data/lib/dynaccount/stock_adjustment.rb +11 -0
- data/lib/dynaccount/unit.rb +11 -0
- data/lib/dynaccount/vatcode.rb +11 -0
- data/lib/dynaccount/version.rb +3 -0
- data/lib/dynaccount/year.rb +11 -0
- data/lib/dynaccount/year_period.rb +11 -0
- data/lib/tasks/dynaccount_tasks.rake +4 -0
- metadata +165 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorCreditnote < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_booked, :module_id, :invoice_id_, :credit_invoice_id_, :sha1_ref, :lang, :vat_amount, :total_amount, :total_weight, :profit_amount, :attention, :address, :zip, :city, :txt]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_creditnote'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorCreditnoteProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :qty_credited, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_creditnote_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorCreditnoteProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :invoice_product_id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_creditnote_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorInvoice < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_booked, :is_system, :is_matched, :is_reminder, :is_credited, :is_credited_complete, :is_subscription, :module_id, :time_due, :invoice_id_, :currency_rate, :sha1_ref, :is_seen, :fi_payment_id_, :accountoff_id, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_invoice'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorInvoiceMatch < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_matched, :is_creditnote, :time, :invoice_id_, :currency_rate, :amount, :currency_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_invoice_match'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorInvoiceProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :qty_credited, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_invoice_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorInvoiceProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :invoice_product_id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_invoice_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorOrder < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_approved, :is_invoiced, :module_id, :order_id_, :is_seen, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_order'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorOrderProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :qty_invoiced, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_order_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorOrderProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :order_product_id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_order_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorQuote < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :module_id, :quote_id_, :is_seen, :is_transferred_time, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_quote'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorQuoteProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_quote_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorQuoteProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :quote_product_id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_quote_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscription < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_active, :module_id, :time_next_charge, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscriptionGroup < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :is_active, :time_next_charge, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription_group'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscriptionGroupProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription_group_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscriptionGroupProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription_group_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscriptionProduct < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :is_list_listing, :is_list_pricing, :vat_amount, :total_amount, :total_weight, :profit_amount]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription_product'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DebtorSubscriptionProductList < DynaccountObject
|
3
|
+
def self.ignore_put
|
4
|
+
[:id, :product_id, :qty, :price, :discount_percent, :vat_amount, :total_amount, :total_weight, :profit_amount, :name, :list_qty]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.api_path
|
8
|
+
'debtor_subscription_product_list'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Dynaccount
|
2
|
+
class DynaccountObject
|
3
|
+
def initialize(attributes)
|
4
|
+
@keys = attributes.keys
|
5
|
+
attributes.each do |k, v|
|
6
|
+
singleton_class.send(:attr_accessor, k.to_sym)
|
7
|
+
send("#{k}=", v)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def update(attributes = {})
|
12
|
+
return true if attributes.empty?
|
13
|
+
updt = @keys.select { |k| !self.class.ignore_put.include?(k.to_sym) }
|
14
|
+
.map { |k| [k, send(k)] }
|
15
|
+
.to_h
|
16
|
+
attributes.merge!(updt)
|
17
|
+
Dynaccount.request(self.class.url(id, 'put'), attributes, :post).body
|
18
|
+
end
|
19
|
+
|
20
|
+
def save
|
21
|
+
updt = @keys.select { |k| !self.class.ignore_put.include?(k.to_sym) }
|
22
|
+
.map { |k| [k, send(k)] }
|
23
|
+
.to_h
|
24
|
+
Dynaccount.request(self.class.url(id, 'put'), updt, :post).body
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.create(attributes = {})
|
28
|
+
Dynaccount.request(url(nil, 'put'), attributes, :post).body
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.all
|
32
|
+
find(nil)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.find(id)
|
36
|
+
req = JSON.parse(Dynaccount.request(url(id, 'get'), {}, :post).body)['result'].map { |res| new(res) }
|
37
|
+
return req[0] if req.size == 1
|
38
|
+
req
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.find_by(params = {})
|
42
|
+
req = JSON.parse(Dynaccount.request(url(nil, 'get', params), {}, :post).body)['result'].map { |res| new(res) }
|
43
|
+
return req[0] if req.size == 1
|
44
|
+
req
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.url(id, action, params = {})
|
48
|
+
url = "/v5/#{Dynaccount.api_id}/#{Dynaccount.api_key}/#{action}/#{api_path}/json/#{"#{id}/" unless id.nil?}"
|
49
|
+
url += "?" + params.map { |k,v| "#{k}=#{v}" }.join('&') if params.any?
|
50
|
+
url
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|