elmas 2.4.2 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/Gemfile +3 -1
  4. data/Guardfile +6 -4
  5. data/README.md +15 -4
  6. data/Rakefile +3 -1
  7. data/elmas.gemspec +17 -15
  8. data/lib/elmas.rb +11 -2
  9. data/lib/elmas/api.rb +2 -0
  10. data/lib/elmas/client.rb +2 -0
  11. data/lib/elmas/config.rb +28 -21
  12. data/lib/elmas/exception.rb +2 -0
  13. data/lib/elmas/oauth.rb +40 -4
  14. data/lib/elmas/parser.rb +2 -0
  15. data/lib/elmas/request.rb +2 -0
  16. data/lib/elmas/resource.rb +7 -5
  17. data/lib/elmas/resources/account.rb +27 -24
  18. data/lib/elmas/resources/aging_receivables_list.rb +8 -6
  19. data/lib/elmas/resources/bank_account.rb +13 -19
  20. data/lib/elmas/resources/bank_entry.rb +6 -4
  21. data/lib/elmas/resources/bank_entry_line.rb +6 -4
  22. data/lib/elmas/resources/base_entry_line.rb +10 -6
  23. data/lib/elmas/resources/cash_entry.rb +22 -0
  24. data/lib/elmas/resources/cash_entry_line.rb +20 -0
  25. data/lib/elmas/resources/contact.rb +10 -8
  26. data/lib/elmas/resources/costcenter.rb +4 -2
  27. data/lib/elmas/resources/costunit.rb +4 -2
  28. data/lib/elmas/resources/division.rb +26 -0
  29. data/lib/elmas/resources/document.rb +7 -5
  30. data/lib/elmas/resources/document_attachment.rb +3 -1
  31. data/lib/elmas/resources/general_journal_entry.rb +4 -2
  32. data/lib/elmas/resources/general_journal_entry_line.rb +2 -0
  33. data/lib/elmas/resources/gl_account.rb +11 -9
  34. data/lib/elmas/resources/item.rb +21 -18
  35. data/lib/elmas/resources/item_group.rb +4 -2
  36. data/lib/elmas/resources/journal.rb +6 -4
  37. data/lib/elmas/resources/layout.rb +6 -4
  38. data/lib/elmas/resources/mailbox.rb +6 -4
  39. data/lib/elmas/resources/payment_condition.rb +9 -7
  40. data/lib/elmas/resources/printed_sales_invoice.rb +12 -10
  41. data/lib/elmas/resources/project.rb +11 -19
  42. data/lib/elmas/resources/purchase_entry.rb +5 -6
  43. data/lib/elmas/resources/purchase_entry_line.rb +2 -0
  44. data/lib/elmas/resources/receivables_list.rb +4 -5
  45. data/lib/elmas/resources/sales_entry.rb +5 -7
  46. data/lib/elmas/resources/sales_entry_line.rb +2 -0
  47. data/lib/elmas/resources/sales_invoice.rb +4 -5
  48. data/lib/elmas/resources/sales_invoice_line.rb +4 -5
  49. data/lib/elmas/resources/sales_item_prices.rb +4 -5
  50. data/lib/elmas/resources/sales_order.rb +4 -5
  51. data/lib/elmas/resources/sales_order_line.rb +4 -5
  52. data/lib/elmas/resources/shared_sales_attributes.rb +6 -11
  53. data/lib/elmas/resources/time_transaction.rb +8 -12
  54. data/lib/elmas/resources/transaction.rb +4 -2
  55. data/lib/elmas/resources/transaction_line.rb +4 -2
  56. data/lib/elmas/resources/vat_code.rb +5 -8
  57. data/lib/elmas/response.rb +5 -2
  58. data/lib/elmas/result_set.rb +4 -2
  59. data/lib/elmas/sanitizer.rb +7 -5
  60. data/lib/elmas/uri.rb +2 -0
  61. data/lib/elmas/utils.rb +2 -0
  62. data/lib/elmas/version.rb +4 -2
  63. metadata +29 -27
  64. data/lib/elmas/log.rb +0 -19
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class Account
3
5
  # An account needs a name
@@ -8,32 +10,33 @@ module Elmas
8
10
  end
9
11
 
10
12
  def mandatory_attributes
11
- [:name]
13
+ %i[name]
12
14
  end
13
15
 
14
- # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMAccounts
15
- def other_attributes # rubocop:disable Metrics/MethodLength
16
- [
17
- :accountant, :account_manager, :activity_sector,
18
- :activity_sub_sector, :address_line1, :address_line2,
19
- :address_line3, :blocked, :business_type, :can_drop_ship,
20
- :chamber_of_commerce, :city, :code, :code_at_supplier,
21
- :company_size, :consolidation_scenario, :controlled_date,
22
- :cost_paid, :country, :credit_line_purchase, :credit_line_sales,
23
- :discount_purchase, :discount_sales, :email, :end_date, :fax,
24
- :intra_stat_area, :intra_stat_delivery_term, :intra_stat_system,
25
- :intra_stat_transaction_a, :intra_stat_transaction_b,
26
- :intra_stat_transport_method, :invoice_acount, :invoice_attachment_type,
27
- :invoicing_method, :is_accountant, :is_agency, :is_competitor, :is_mailing,
28
- :is_pilot, :is_reseller, :is_sales, :is_supplier, :language, :latitude,
29
- :lead_source, :logo, :logo_file_name, :longitude, :main_contact,
30
- :payment_condition_purchase, :payment_condition_sales, :phone,
31
- :phone_extension, :postcode, :price_list, :purchase_currency,
32
- :purchase_lead_days, :purchase_VAT_code, :recipient_of_commissions,
33
- :remarks, :reseller, :sales_currency, :sales_tax_schedule, :sales_VAT_code,
34
- :search_code, :security_level, :seperate_inv_per_project, :seperate_inv_per_subscription,
35
- :shipping_lead_days, :shipping_method, :start_date, :state, :status,
36
- :VAT_liability, :VAT_number, :website
16
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMAccounts
17
+ # rubocop:disable Metrics/MethodLength
18
+ def other_attributes
19
+ %i[
20
+ accountant account_manager activity_sector
21
+ activity_sub_sector address_line1 address_line2
22
+ address_line3 blocked business_type can_drop_ship
23
+ chamber_of_commerce city code code_at_supplier
24
+ company_size consolidation_scenario controlled_date
25
+ cost_paid country credit_line_purchase credit_line_sales
26
+ discount_purchase discount_sales email end_date fax
27
+ intra_stat_area intra_stat_delivery_term intra_stat_system
28
+ intra_stat_transaction_a intra_stat_transaction_b
29
+ intra_stat_transport_method invoice_acount invoice_attachment_type
30
+ invoicing_method is_accountant is_agency is_competitor is_mailing
31
+ is_pilot is_reseller is_sales is_supplier language latitude
32
+ lead_source logo logo_file_name longitude main_contact
33
+ payment_condition_purchase payment_condition_sales phone
34
+ phone_extension postcode price_list purchase_currency
35
+ purchase_lead_days purchase_VAT_code recipient_of_commissions
36
+ remarks reseller sales_currency sales_tax_schedule sales_VAT_code
37
+ search_code security_level seperate_inv_per_project seperate_inv_per_subscription
38
+ shipping_lead_days shipping_method start_date state status
39
+ VAT_liability VAT_number website
37
40
  ]
38
41
  end
39
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  # We can use the AgingReceivablesList to change the status of SalesInvoices from
3
5
  # Open to 'Verwerkt' while at the same time sending a PDF of the invoice to the
@@ -9,7 +11,7 @@ module Elmas
9
11
  include Elmas::Resource
10
12
 
11
13
  def valid_actions
12
- [:get]
14
+ %i[get]
13
15
  end
14
16
 
15
17
  def base_path
@@ -20,12 +22,12 @@ module Elmas
20
22
  []
21
23
  end
22
24
 
23
- # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesInvoiceAgingReceivablesLists
25
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesInvoiceAgingReceivablesLists
24
26
  def other_attributes
25
- [
26
- :account_id, :account_code, :account_name, :age_group1, :age_group1_amount, :age_group1_description,
27
- :age_group2, :age_group2_amount, :age_group2_description, :age_group3, :age_group3_amount, :age_group3_description,
28
- :age_group4, :age_group4_amount, :age_group4_description, :currency_code, :total_amount
27
+ %i[
28
+ account_id account_code account_name age_group1 age_group1_amount age_group1_description
29
+ age_group2 age_group2_amount age_group2_description age_group3 age_group3_amount age_group3_description
30
+ age_group4 age_group4_amount age_group4_description currency_code total_amount
29
31
  ]
30
32
  end
31
33
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class BankAccount
3
5
  # An account needs a name
4
6
  include Elmas::Resource
5
7
 
6
8
  def valid_actions
7
- [:get]
9
+ %i[get]
8
10
  end
9
11
 
10
12
  def base_path
@@ -12,26 +14,18 @@ module Elmas
12
14
  end
13
15
 
14
16
  def mandatory_attributes
15
- [:account]
17
+ %i[account]
16
18
  end
17
19
 
18
- # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMAccounts
19
- def other_attributes # rubocop:disable Metrics/MethodLength
20
- [
21
- :id,
22
- :account,
23
- :account_name,
24
- :bank,
25
- :bank_account,
26
- :bank_description,
27
- :bank_name,
28
- :BIC_code,
29
- :description,
30
- :division,
31
- :format,
32
- :IBAN,
33
- :type,
34
- :type_description
20
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMAccounts
21
+ # rubocopdisable Metrics/MethodLength
22
+ def other_attributes
23
+ %i[
24
+ id account account_name bank
25
+ bank_account bank_description
26
+ bank_name BIC_code description
27
+ division format IBAN type
28
+ type_description
35
29
  ]
36
30
  end
37
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class BankEntry
3
5
  include Elmas::Resource
@@ -7,13 +9,13 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:journal_code, :bank_entry_lines]
12
+ %i[journal_code bank_entry_lines]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [
15
- :currency, :bank_statement_document, :closing_balance_FC, :entry_number,
16
- :financial_period, :financial_year, :opening_balance_FC
16
+ %i[
17
+ currency bank_statement_document closing_balance_FC entry_number
18
+ financial_period financial_year opening_balance_FC
17
19
  ]
18
20
  end
19
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class BankEntryLine < Elmas::BaseEntryLine
3
5
  # A sales entry line belongs to a sales entry
@@ -8,10 +10,10 @@ module Elmas
8
10
  end
9
11
 
10
12
  def other_attributes
11
- [
12
- :account, :amount_VATFC, :asset, :cost_center, :cost_unit, :date,
13
- :description, :notes, :document, :exchange_rate, :our_ref,
14
- :project, :quantity, :VAT_code, :VAT_percentage, :VAT_type
13
+ %i[
14
+ account amount_VATFC asset cost_center cost_unit date
15
+ description notes document exchange_rate our_ref
16
+ project quantity VAT_code VAT_percentage VAT_type
15
17
  ]
16
18
  end
17
19
  end
@@ -1,15 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class BaseEntryLine
5
+ include Elmas::Resource
6
+
3
7
  def mandatory_attributes
4
- [:amount_FC, :GL_account, :entry_ID]
8
+ %i[amount_FC GL_account entry_ID]
5
9
  end
6
10
 
7
11
  def other_attributes
8
- [
9
- :serial_number, :asset, :cost_center, :cost_unit, :description, :notes,
10
- :project, :quantity, :serial_number, :subscription, :tracking_number,
11
- :VAT_amount_FC, :VAT_base_amount_DC, :VAT_base_amount_FC, :VAT_code,
12
- :VAT_percentage, :account
12
+ %i[
13
+ serial_number asset cost_center cost_unit description notes
14
+ project quantity serial_number subscription tracking_number
15
+ VAT_amount_FC VAT_base_amount_DC VAT_base_amount_FC VAT_code
16
+ VAT_percentage account
13
17
  ]
14
18
  end
15
19
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Elmas
4
+ class CashEntry
5
+ include Elmas::Resource
6
+
7
+ def base_path
8
+ "financialtransaction/CashEntries"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[journal_code cash_entry_lines]
13
+ end
14
+
15
+ def other_attributes
16
+ %i[
17
+ currency closing_balance_FC entry_number
18
+ financial_period financial_year openening_balance_FC
19
+ ]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Elmas
4
+ class CashEntryLine < Elmas::BaseEntryLine
5
+ # A sales entry line belongs to a sales entry
6
+ include Elmas::Resource
7
+
8
+ def base_path
9
+ "financialtransaction/CashEntryLines"
10
+ end
11
+
12
+ def other_attributes
13
+ %i[
14
+ account amount_VATFC asset cost_center cost_unit date
15
+ description notes document exchange_rate our_ref
16
+ project quantity VAT_code VAT_percentage VAT_type
17
+ ]
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class Contact
3
5
  # A contact needs a First and Last name and a reference to an account
@@ -8,17 +10,17 @@ module Elmas
8
10
  end
9
11
 
10
12
  def mandatory_attributes
11
- [:first_name, :last_name, :account]
13
+ %i[first_name last_name account]
12
14
  end
13
15
 
14
16
  def other_attributes
15
- [
16
- :account_name, :birt_date, :birth_name, :birth_name_prefix, :birth_place,
17
- :business_email, :business_fax, :business_mobile, :business_phone, :business_phone_extention,
18
- :email, :end_date, :first_name, :gender, :HID, :initials, :is_mailing_excluded,
19
- :job_title_description, :language, :marketing_notes, :middle_name,
20
- :mobile, :nationality, :notes, :person, :phone, :picture, :picture_name,
21
- :social_security_number, :start_date, :title
17
+ %i[
18
+ account_name birt_date birth_name birth_name_prefix birth_place
19
+ business_email business_fax business_mobile business_phone business_phone_extention
20
+ email end_date first_name gender HID initials is_mailing_excluded
21
+ job_title_description language marketing_notes middle_name
22
+ mobile nationality notes person phone picture picture_name
23
+ social_security_number start_date title
22
24
  ]
23
25
  end
24
26
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class Costcenter
3
5
  include Elmas::Resource
@@ -7,11 +9,11 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:code, :description]
12
+ %i[code description]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [:active]
16
+ %i[active]
15
17
  end
16
18
  end
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class Costunit
3
5
  include Elmas::Resource
@@ -7,11 +9,11 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:code, :description]
12
+ %i[code description]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [:account]
16
+ %i[account]
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Elmas
4
+ class Division
5
+ include Elmas::Resource
6
+
7
+ def base_path
8
+ "system/Divisions"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ []
13
+ end
14
+
15
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SystemSystemDivisions
16
+ def other_attributes
17
+ %i[
18
+ code address_line1 address_line2 address_line3
19
+ chamber_of_commerce_number city country created currency
20
+ current customer customer_code customer_name description
21
+ email hid is_main_division modified phone postcode state
22
+ status VAT_number
23
+ ]
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class Document
3
5
  include Elmas::Resource
@@ -7,14 +9,14 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:subject, :type]
12
+ %i[subject type]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [
15
- :account, :amount_FC, :body, :category, :category_description, :creator_full_name,
16
- :currency, :document_date, :document_folder, :financial_transaction_entry_ID,
17
- :HID, :language, :opportunity, :sales_invoice_number, :shop_order_number
16
+ %i[
17
+ account amount_FC body category category_description creator_full_name
18
+ currency document_date document_folder financial_transaction_entry_ID
19
+ HID language opportunity sales_invoice_number shop_order_number
18
20
  ]
19
21
  end
20
22
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class DocumentAttachment
3
5
  include Elmas::Resource
@@ -7,7 +9,7 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:attachment, :document, :file_name]
12
+ %i[attachment document file_name]
11
13
  end
12
14
 
13
15
  def other_attributes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class GeneralJournalEntry
3
5
  include Elmas::Resource
@@ -7,11 +9,11 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:journal_code, :general_journal_entry_lines]
12
+ %i[journal_code general_journal_entry_lines]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [:financial_period, :financial_year, :currency, :exchange_rate, :reversal]
16
+ %i[financial_period financial_year currency exchange_rate reversal]
15
17
  end
16
18
  end
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class GeneralJournalEntryLine < Elmas::BaseEntryLine
3
5
  include Elmas::Resource
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Elmas
2
4
  class GLAccount
3
5
  include Elmas::Resource
@@ -7,18 +9,18 @@ module Elmas
7
9
  end
8
10
 
9
11
  def mandatory_attributes
10
- [:code, :description]
12
+ %i[code description]
11
13
  end
12
14
 
13
15
  def other_attributes
14
- [
15
- :assimilated_VAT_box, :balance_side, :balance_type, :belcotax_type, :compress,
16
- :cost_center, :cost_unit, :exclude_VAT_listing, :expense_non_deductible_percentage,
17
- :is_blocked, :matching, :private_GL_account, :private_percentage, :reporting_code,
18
- :revalue_currency, :searc_code, :type, :use_cost_center, :use_cost_unit,
19
- :VAT_code, :VAT_GL_account_type, :VAT_non_deductible_GL_account,
20
- :VAT_non_deductible_percentage, :VAT_system, :year_end_cost_GL_account,
21
- :year_end_reflection_GL_account
16
+ %i[
17
+ assimilated_VAT_box balance_side balance_type belcotax_type compress
18
+ cost_center cost_unit exclude_VAT_listing expense_non_deductible_percentage
19
+ is_blocked matching private_GL_account private_percentage reporting_code
20
+ revalue_currency searc_code type use_cost_center use_cost_unit
21
+ VAT_code VAT_GL_account_type VAT_non_deductible_GL_account
22
+ VAT_non_deductible_percentage VAT_system year_end_cost_GL_account
23
+ year_end_reflection_GL_account
22
24
  ]
23
25
  end
24
26
  end