eol-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.drone.yaml +12 -0
  3. data/.gitignore +16 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +60 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +11 -0
  8. data/Changelog.md +3 -0
  9. data/Gemfile +6 -0
  10. data/Guardfile +13 -0
  11. data/LICENSE +21 -0
  12. data/README.md +247 -0
  13. data/Rakefile +13 -0
  14. data/bin/console +16 -0
  15. data/bin/setup +7 -0
  16. data/eol.gemspec +40 -0
  17. data/jenkins.sh +33 -0
  18. data/lib/eol.rb +79 -0
  19. data/lib/eol/api.rb +32 -0
  20. data/lib/eol/client.rb +13 -0
  21. data/lib/eol/config.rb +105 -0
  22. data/lib/eol/exception.rb +21 -0
  23. data/lib/eol/oauth.rb +117 -0
  24. data/lib/eol/parser.rb +42 -0
  25. data/lib/eol/request.rb +63 -0
  26. data/lib/eol/resource.rb +104 -0
  27. data/lib/eol/resources/account.rb +43 -0
  28. data/lib/eol/resources/address.rb +36 -0
  29. data/lib/eol/resources/aging_receivables_list.rb +34 -0
  30. data/lib/eol/resources/bank_account.rb +32 -0
  31. data/lib/eol/resources/bank_entry.rb +22 -0
  32. data/lib/eol/resources/bank_entry_line.rb +20 -0
  33. data/lib/eol/resources/base_entry_line.rb +20 -0
  34. data/lib/eol/resources/cash_entry.rb +22 -0
  35. data/lib/eol/resources/cash_entry_line.rb +20 -0
  36. data/lib/eol/resources/contact.rb +27 -0
  37. data/lib/eol/resources/costcenter.rb +19 -0
  38. data/lib/eol/resources/costunit.rb +19 -0
  39. data/lib/eol/resources/division.rb +26 -0
  40. data/lib/eol/resources/document.rb +23 -0
  41. data/lib/eol/resources/document_attachment.rb +19 -0
  42. data/lib/eol/resources/general_journal_entry.rb +19 -0
  43. data/lib/eol/resources/general_journal_entry_line.rb +11 -0
  44. data/lib/eol/resources/gl_account.rb +27 -0
  45. data/lib/eol/resources/goods_delivery.rb +37 -0
  46. data/lib/eol/resources/goods_delivery_line.rb +38 -0
  47. data/lib/eol/resources/item.rb +36 -0
  48. data/lib/eol/resources/item_group.rb +23 -0
  49. data/lib/eol/resources/journal.rb +23 -0
  50. data/lib/eol/resources/layout.rb +26 -0
  51. data/lib/eol/resources/mailbox.rb +22 -0
  52. data/lib/eol/resources/payment_condition.rb +25 -0
  53. data/lib/eol/resources/printed_sales_invoice.rb +37 -0
  54. data/lib/eol/resources/project.rb +26 -0
  55. data/lib/eol/resources/purchase_entry.rb +20 -0
  56. data/lib/eol/resources/purchase_entry_line.rb +11 -0
  57. data/lib/eol/resources/receivables_list.rb +31 -0
  58. data/lib/eol/resources/sales_entry.rb +22 -0
  59. data/lib/eol/resources/sales_entry_line.rb +12 -0
  60. data/lib/eol/resources/sales_invoice.rb +25 -0
  61. data/lib/eol/resources/sales_invoice_line.rb +24 -0
  62. data/lib/eol/resources/sales_item_prices.rb +18 -0
  63. data/lib/eol/resources/sales_order.rb +23 -0
  64. data/lib/eol/resources/sales_order_line.rb +23 -0
  65. data/lib/eol/resources/shared_sales_attributes.rb +11 -0
  66. data/lib/eol/resources/time_transaction.rb +24 -0
  67. data/lib/eol/resources/transaction.rb +23 -0
  68. data/lib/eol/resources/transaction_line.rb +23 -0
  69. data/lib/eol/resources/user.rb +27 -0
  70. data/lib/eol/resources/vat_code.rb +20 -0
  71. data/lib/eol/response.rb +72 -0
  72. data/lib/eol/result_set.rb +62 -0
  73. data/lib/eol/sanitizer.rb +54 -0
  74. data/lib/eol/uri.rb +87 -0
  75. data/lib/eol/utils.rb +50 -0
  76. data/lib/eol/version.rb +15 -0
  77. metadata +356 -0
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class CashEntryLine < Eol::BaseEntryLine
5
+ # A sales entry line belongs to a sales entry
6
+ include Eol::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
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Contact
5
+ # A contact needs a First and Last name and a reference to an account
6
+ include Eol::Resource
7
+
8
+ def base_path
9
+ "crm/Contacts"
10
+ end
11
+
12
+ def mandatory_attributes
13
+ %i[first_name last_name account]
14
+ end
15
+
16
+ def other_attributes
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
24
+ ]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Costcenter
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "hrm/Costcenters"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[code description]
13
+ end
14
+
15
+ def other_attributes
16
+ %i[active]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Costunit
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "hrm/Costunits"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[code description]
13
+ end
14
+
15
+ def other_attributes
16
+ %i[account]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Division
5
+ include Eol::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
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Document
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "documents/Documents"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[subject type]
13
+ end
14
+
15
+ def other_attributes
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
20
+ ]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class DocumentAttachment
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "documents/DocumentAttachments"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[attachment document file_name]
13
+ end
14
+
15
+ def other_attributes
16
+ []
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class GeneralJournalEntry
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "generaljournalentry/GeneralJournalEntries"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[journal_code general_journal_entry_lines]
13
+ end
14
+
15
+ def other_attributes
16
+ %i[financial_period financial_year currency exchange_rate reversal]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class GeneralJournalEntryLine < Eol::BaseEntryLine
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "generaljournalentry/GeneralJournalEntryLines"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class GLAccount
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "financial/GLAccounts"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[code description]
13
+ end
14
+
15
+ def other_attributes
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
24
+ ]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,37 @@
1
+ module Eol
2
+ class GoodsDelivery
3
+ include Eol::Resource
4
+ include Eol::SharedSalesAttributes
5
+
6
+ # For some reason the Exact API for GoodsDelivery requires us to specify
7
+ # the fields we want returned. This isn't required for other calls. :/
8
+ # We get around this by specifying a wildcard on the $select param.
9
+ def find_all(options = {})
10
+ @order_by = options[:order_by]
11
+ @select = options[:select] ||= ['*']
12
+ response = get(uri([:order, :select]))
13
+ response.results if response
14
+ end
15
+
16
+ def base_path
17
+ "salesorder/GoodsDeliveries"
18
+ end
19
+
20
+ def mandatory_attributes
21
+ [:goods_delivery_lines]
22
+ end
23
+
24
+ def other_attributes
25
+ SHARED_SALES_ATTRIBUTES.inject(
26
+ [
27
+ :delivery_account, :delivery_account_code, :delivery_account_name,
28
+ :delivery_address, :delivery_contact, :delivery_contact_person_full_name,
29
+ :delivery_date, :delivery_number,
30
+ :shipping_method, :shipping_method_code, :shipping_method_description,
31
+ :tracking_number, :warehouse, :warehouse_code, :warehouse_description
32
+ ],
33
+ :<<
34
+ )
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ module Eol
2
+ class GoodsDeliveryLine
3
+ # TODO: Fill out mandatory and other attributes
4
+ include Eol::Resource
5
+ include Eol::SharedSalesAttributes
6
+
7
+ # For some reason the Exact API for GoodsDelivery requires us to specify
8
+ # the fields we want returned. This isn't required for other calls. :/
9
+ # We get around this by specifying a wildcard on the $select param.
10
+ def find_all(options = {})
11
+ @order_by = options[:order_by]
12
+ @select = options[:select] ||= ['*']
13
+ response = get(uri([:order, :select]))
14
+ response.results if response
15
+ end
16
+
17
+ def base_path
18
+ "salesorder/GoodsDeliveryLines"
19
+ end
20
+
21
+ def mandatory_attributes
22
+ [:delivery_date, :item, :line_number, :sales_order_number]
23
+ end
24
+
25
+ def other_attributes
26
+ SHARED_LINE_ATTRIBUTES.inject(
27
+ [
28
+ :quantity_delivered, :quantity_ordered,
29
+ :sales_order_line_id, :sales_order_line_number,
30
+ :serial_numbers, :storage_location,
31
+ :tracking_number, :unit_code
32
+ ],
33
+ :<<
34
+ )
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Item
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "logistics/Items"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[code description]
13
+ end
14
+
15
+ # rubocop:disable Metrics/MethodLength
16
+ def other_attributes
17
+ %i[
18
+ class_01 class_02 class_03 class_04 class_05 copy_remarks
19
+ cost_price_currency cost_price_new cost_price_standard end_date
20
+ extra_description free_bool_field_01 free_bool_field_02 free_bool_field_03
21
+ free_bool_field_04 free_bool_field_05 free_date_field_01 free_date_field_02
22
+ free_date_field_03 free_date_field_04 free_date_field_05 free_number_field_01
23
+ free_number_field_02 free_number_field_03 free_number_field_04 free_number_field_05
24
+ free_number_field_06 free_number_field_07 free_number_field_08 free_text_field_01
25
+ free_text_field_02 free_text_field_03 free_text_field_04 free_text_field_05
26
+ free_text_field_06 free_text_field_07 free_text_field_08 free_text_field_09
27
+ free_text_field_10 GL_costs GL_revenue GL_stock is_batch_item
28
+ is_batch_number_item is_fraction_allowed_item is_make_item is_new_contract
29
+ is_on_demand_item is_package_item is_registration_code_item is_purchase_item
30
+ is_sales_item is_serial_item is_serial_number_item is_stock_item
31
+ is_subcontracted_item is_time is_webshop_item item_group notes
32
+ sales_vat_code search_code security_level start_date unit
33
+ ]
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class ItemGroup
5
+ include Eol::Resource
6
+
7
+ def valid_actions
8
+ %i[get]
9
+ end
10
+
11
+ def base_path
12
+ "logistics/ItemGroups"
13
+ end
14
+
15
+ def other_attributes
16
+ %i[code]
17
+ end
18
+
19
+ def mandatory_attributes
20
+ []
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Journal
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "financial/Journals"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ []
13
+ end
14
+
15
+ def other_attributes
16
+ %i[
17
+ code description allow_variable_currency allow_variable_exchange_rate
18
+ allow_VAT auto_save bank bank_account_ID bank_account_including_mask
19
+ currency GL_account payment_in_transit_account type
20
+ ]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Layout
5
+ include Eol::Resource
6
+
7
+ def valid_actions
8
+ %i[get]
9
+ end
10
+
11
+ def base_path
12
+ "salesinvoice/Layouts"
13
+ end
14
+
15
+ def mandatory_attributes
16
+ []
17
+ end
18
+
19
+ def other_attributes
20
+ %i[
21
+ id created creator creator_full_name division
22
+ modified modifier modifier_full_name subject type
23
+ ]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Mailbox
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "mailbox/Mailboxes"
9
+ end
10
+
11
+ def other_attributes
12
+ %i[
13
+ account description for_division publish
14
+ type valid_from valid_to
15
+ ]
16
+ end
17
+
18
+ def mandatory_attributes
19
+ %i[mailbox]
20
+ end
21
+ end
22
+ end