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,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class PaymentCondition
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "cashflow/PaymentConditions"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[code]
13
+ end
14
+
15
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CashflowPaymentConditions
16
+ def other_attributes
17
+ %i[
18
+ created description discount_payment_days
19
+ discount_percentage payment_days payment_discount_type
20
+ payment_end_of_months payment_method percentage
21
+ VAT_calculation
22
+ ]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ # We can use the PrintedSalesInvoice to change the status of SalesInvoices from
5
+ # Open to 'Verwerkt' while at the same time sending a PDF of the invoice to the
6
+ # end user by e-mail.
7
+ #
8
+ # This endpoint only supports the POST method.
9
+ #
10
+ class PrintedSalesInvoice
11
+ include Eol::Resource
12
+
13
+ def valid_actions
14
+ %i[post]
15
+ end
16
+
17
+ def base_path
18
+ "salesinvoice/PrintedSalesInvoices"
19
+ end
20
+
21
+ def mandatory_attributes
22
+ %i[invoice_ID]
23
+ end
24
+
25
+ # https//start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesInvoicePrintedSalesInvoices
26
+ def other_attributes
27
+ %i[
28
+ division document document_creation_error document_creation_success
29
+ document_layout email_creation_error email_creation_success email_layout
30
+ extra_text invoice_date postbox_message_creation_error
31
+ postbox_message_creation_success postbox_sender reporting_period
32
+ reporting_year send_email_to_customer sender_email_address
33
+ send_invoice_to_customer_postbox send_output_based_on_account
34
+ ]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Project
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "project/Projects"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[account description code type]
13
+ end
14
+
15
+ # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=ProjectProjects
16
+ def other_attributes
17
+ %i[account account_code AccountContact account_name allow_additional_invoicing block_entry block_rebilling budgeted_amount budgeted_costs
18
+ budgeted_hours_per_hour_type BudgetedRevenue BudgetType BudgetTypeDescription clasification classification_description code costs_amount_fc
19
+ created creator creator_full_name customer_p_onumber description division division_name end_date fixed_price_item
20
+ fixed_price_item_description invoice_as_quoted invoice_terms manager manager_fullname markup_percentage modified modifier modifier_full_name
21
+ notes prepaid_item prepaid_item_description prepaid_type prepaid_type_description project_restriction_employees project_restriction_items
22
+ project_restriction_rebillings sales_time_quantity source_quotation start_date time_quantity_to_alert type type_description
23
+ use_billing_milestones]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class PurchaseEntry
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "purchaseentry/PurchaseEntries"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[journal purchase_entry_lines supplier]
13
+ end
14
+
15
+ def other_attributes
16
+ %i[currency batch_number description document due_date entry_date entry_number external_link_reference invoice_number rate reporting_period
17
+ reporting_year reversal VAT_amount_FC your_ref]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class PurchaseEntryLine < Eol::BaseEntryLine
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "purchaseentry/PurchaseEntryLines"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ # We can use the AgingReceivablesList to change the status of SalesInvoices from
5
+ # Open to 'Verwerkt' while at the same time sending a PDF of the invoice to the
6
+ # end user by e-mail.
7
+ #
8
+ # This endpoint only supports the POST method.
9
+ #
10
+ class ReceivablesList
11
+ include Eol::Resource
12
+
13
+ def valid_actions
14
+ [:get]
15
+ end
16
+
17
+ def base_path
18
+ "read/financial/ReceivablesList"
19
+ end
20
+
21
+ def mandatory_attributes
22
+ []
23
+ end
24
+
25
+ # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=ReadFinancialReceivablesList
26
+ def other_attributes
27
+ %i[description hid account_code account_id account_name amount amount_in_transit currency_code description due_date entry_number id
28
+ invoice_date invoice_number journal_code journal_description your_ref]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesEntry
5
+ # A sales entry needs multiple sales entry lines
6
+ # It should also have a journal id and a contact id who ordered it
7
+ include Eol::Resource
8
+
9
+ def base_path
10
+ "salesentry/SalesEntries"
11
+ end
12
+
13
+ def mandatory_attributes
14
+ %i[journal customer sales_entry_lines]
15
+ end
16
+
17
+ def other_attributes
18
+ %i[batch_number currency document due_date entry_date entry_number invoice_number order_number payment_condition payment_reference
19
+ process_number rate reporting_period reporting_year reversal VAT_amount_FC your_ref description]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesEntryLine < Eol::BaseEntryLine
5
+ # A sales entry line belongs to a sales entry
6
+ include Eol::Resource
7
+
8
+ def base_path
9
+ "salesentry/SalesEntryLines"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesInvoice
5
+ # An sales_invoice usually has multiple sales_invoice lines
6
+ # It should also have a journal id and a contact id who ordered it
7
+ include Eol::Resource
8
+ include Eol::SharedSalesAttributes
9
+
10
+ def base_path
11
+ "salesinvoice/SalesInvoices"
12
+ end
13
+
14
+ def mandatory_attributes
15
+ [:ordered_by]
16
+ end
17
+
18
+ def other_attributes
19
+ SHARED_SALES_ATTRIBUTES.inject(
20
+ %i[sales_invoice_lines due_date salesperson starter_sales_invoice_status type journal],
21
+ :<<
22
+ )
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesInvoiceLine
5
+ # An sales_invoice_line should always have a reference to an item and to an sales_invoice.
6
+ include Eol::Resource
7
+ include Eol::SharedSalesAttributes
8
+
9
+ def base_path
10
+ "salesinvoice/SalesInvoiceLines"
11
+ end
12
+
13
+ def mandatory_attributes
14
+ %i[item invoice_ID]
15
+ end
16
+
17
+ def other_attributes
18
+ SHARED_LINE_ATTRIBUTES.inject(
19
+ %i[employee end_time line_number start_time subscription VAT_amount_DC VAT_amount_FC GL_account discount unit_price],
20
+ :<<
21
+ )
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesItemPrices
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "logistics/SalesItemPrices"
9
+ end
10
+
11
+ def mandatory_attributes; end
12
+
13
+ def other_attributes
14
+ %i[account account_name created creator creator_full_name currency default_item_unit default_item_unit_description division end_date item
15
+ item_code item_description modified modifier modifier_full_name number_of_items_per_unit price quantity start_date unit unit_description]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesOrder
5
+ include Eol::Resource
6
+ include Eol::SharedSalesAttributes
7
+
8
+ def base_path
9
+ "salesorder/SalesOrders"
10
+ end
11
+
12
+ def mandatory_attributes
13
+ %i[sales_order_lines ordered_by]
14
+ end
15
+
16
+ def other_attributes
17
+ SHARED_SALES_ATTRIBUTES.inject(
18
+ %i[deliver_to_contact_person delivery_date delivery_status sales_person shipping_method status tax_schedule warehouse_ID],
19
+ :<<
20
+ )
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class SalesOrderLine
5
+ include Eol::Resource
6
+ include Eol::SharedSalesAttributes
7
+
8
+ def base_path
9
+ "salesorder/SalesOrderLines"
10
+ end
11
+
12
+ def mandatory_attributes
13
+ %i[item order_ID]
14
+ end
15
+
16
+ def other_attributes
17
+ SHARED_LINE_ATTRIBUTES.inject(
18
+ %i[amount_FC delivery_date item_version order_number unit_price use_drop_shipment VAT_amount],
19
+ :<<
20
+ )
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ module SharedSalesAttributes
5
+ SHARED_SALES_ATTRIBUTES = %i[currency invoice_to invoice_to_contact_person invoice_date description document order_date ordered_by_contact_person
6
+ tax_schedule order_number payment_condition payment_reference remarks your_ref amount_DC].freeze
7
+
8
+ SHARED_LINE_ATTRIBUTES = %i[discount quantity amount_FC description VAT_code cost_center cost_unit VAT_percentage unit_code tax_schedule
9
+ net_price notes pricelist project amount_DC].freeze
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class TimeTransaction
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "project/TimeTransactions"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ %i[account item quantity]
13
+ end
14
+
15
+ # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=ProjectTimeTransactions
16
+ def other_attributes
17
+ %i[account account_name activity activity_description amount amount_fc attachment created creator creator_full_name currency date division
18
+ division_description employee end_time entry_number error_text hour_status item item_description item_divisable modified modifier
19
+ modifier_full_name notes price price_fc project project_account project_account_code project_account_name project_description quantity
20
+ start_time subscription subscription_account subscription_account_code subscription_account_name subscription_description
21
+ subscription_number type]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class Transaction
5
+ include Eol::Resource
6
+
7
+ def valid_actions
8
+ %i[get]
9
+ end
10
+
11
+ def base_path
12
+ "financialtransaction/Transactions"
13
+ end
14
+
15
+ def mandatory_attributes
16
+ []
17
+ end
18
+
19
+ def other_attributes
20
+ %i[description]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class TransactionLine
5
+ include Eol::Resource
6
+
7
+ def valid_actions
8
+ %i[get]
9
+ end
10
+
11
+ def base_path
12
+ "financialtransaction/TransactionLines"
13
+ end
14
+
15
+ def mandatory_attributes
16
+ []
17
+ end
18
+
19
+ def other_attributes
20
+ %i[asset_code]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class User
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "users/Users"
9
+ end
10
+
11
+ def mandatory_attributes
12
+ []
13
+ end
14
+
15
+ # https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=UsersUsers
16
+ def other_attributes
17
+ %i[
18
+ birth_date birth_name created creator creator_full_name customer
19
+ customer_name email end_date first_name full_name gender
20
+ has_registered_for_two_step_verification has_two_step_verification
21
+ initials language last_login last_name middle_name mobile modified
22
+ modifier modifier_full_name nationality notes phone phone_extension
23
+ profile_code start_date start_division title user_name
24
+ ]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eol
4
+ class VatCode
5
+ include Eol::Resource
6
+
7
+ def base_path
8
+ "vat/VATCodes"
9
+ end
10
+
11
+ def other_attributes
12
+ %i[account calculation_basis charged EU_sales_listing GL_discount_purchase GL_discount_sales GL_to_claim GL_to_pay intra_stat is_blocked
13
+ legal_text tax_return_type type vat_doc_type vat_margin VAT_partial_ratio VAT_percentages VAT_transaction_type]
14
+ end
15
+
16
+ def mandatory_attributes
17
+ %i[code description]
18
+ end
19
+ end
20
+ end