cashctrl 0.1.0 → 0.2.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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +418 -136
  3. data/cashctrl.gemspec +1 -1
  4. data/lib/cashctrl/client.rb +106 -103
  5. data/lib/cashctrl/collection.rb +6 -5
  6. data/lib/cashctrl/configuration.rb +1 -1
  7. data/lib/cashctrl/error.rb +3 -1
  8. data/lib/cashctrl/errors.rb +76 -0
  9. data/lib/cashctrl/localized_string.rb +2 -2
  10. data/lib/cashctrl/models/account.rb +5 -1
  11. data/lib/cashctrl/models/article.rb +9 -1
  12. data/lib/cashctrl/models/asset.rb +6 -1
  13. data/lib/cashctrl/models/attachment.rb +14 -0
  14. data/lib/cashctrl/models/bank.rb +3 -1
  15. data/lib/cashctrl/models/category.rb +1 -1
  16. data/lib/cashctrl/models/certificate_document.rb +1 -1
  17. data/lib/cashctrl/models/certificate_template.rb +1 -1
  18. data/lib/cashctrl/models/cost_center.rb +3 -1
  19. data/lib/cashctrl/models/currency.rb +1 -1
  20. data/lib/cashctrl/models/custom_field.rb +1 -1
  21. data/lib/cashctrl/models/custom_field_group.rb +1 -1
  22. data/lib/cashctrl/models/file.rb +2 -1
  23. data/lib/cashctrl/models/fiscal_period.rb +1 -1
  24. data/lib/cashctrl/models/fiscal_period_task.rb +1 -1
  25. data/lib/cashctrl/models/history.rb +1 -1
  26. data/lib/cashctrl/models/insurance_type.rb +1 -1
  27. data/lib/cashctrl/models/journal.rb +10 -1
  28. data/lib/cashctrl/models/journal_import.rb +1 -1
  29. data/lib/cashctrl/models/journal_import_entry.rb +1 -1
  30. data/lib/cashctrl/models/journal_item.rb +20 -0
  31. data/lib/cashctrl/models/loader.rb +3 -0
  32. data/lib/cashctrl/models/location.rb +1 -1
  33. data/lib/cashctrl/models/order.rb +8 -1
  34. data/lib/cashctrl/models/order_book_entry.rb +1 -1
  35. data/lib/cashctrl/models/order_document.rb +1 -1
  36. data/lib/cashctrl/models/order_item.rb +23 -0
  37. data/lib/cashctrl/models/order_layout.rb +1 -1
  38. data/lib/cashctrl/models/order_payment.rb +1 -1
  39. data/lib/cashctrl/models/person.rb +7 -1
  40. data/lib/cashctrl/models/report.rb +1 -1
  41. data/lib/cashctrl/models/report_collection.rb +1 -1
  42. data/lib/cashctrl/models/report_element.rb +1 -1
  43. data/lib/cashctrl/models/rounding.rb +2 -1
  44. data/lib/cashctrl/models/salary_book_entry.rb +1 -1
  45. data/lib/cashctrl/models/salary_certificate.rb +2 -1
  46. data/lib/cashctrl/models/salary_document.rb +1 -1
  47. data/lib/cashctrl/models/salary_field.rb +1 -1
  48. data/lib/cashctrl/models/salary_layout.rb +1 -1
  49. data/lib/cashctrl/models/salary_payment.rb +1 -1
  50. data/lib/cashctrl/models/salary_setting.rb +1 -1
  51. data/lib/cashctrl/models/salary_statement.rb +3 -1
  52. data/lib/cashctrl/models/salary_status.rb +1 -1
  53. data/lib/cashctrl/models/salary_sum.rb +1 -1
  54. data/lib/cashctrl/models/salary_template.rb +1 -1
  55. data/lib/cashctrl/models/salary_type.rb +1 -1
  56. data/lib/cashctrl/models/sequence_number.rb +1 -1
  57. data/lib/cashctrl/models/setting.rb +1 -1
  58. data/lib/cashctrl/models/tax.rb +2 -1
  59. data/lib/cashctrl/models/text.rb +1 -1
  60. data/lib/cashctrl/models/title.rb +1 -1
  61. data/lib/cashctrl/models/unit.rb +1 -1
  62. data/lib/cashctrl/relation.rb +271 -0
  63. data/lib/cashctrl/resource.rb +300 -57
  64. data/lib/cashctrl/resources/account/bank.rb +3 -13
  65. data/lib/cashctrl/resources/account/category.rb +3 -9
  66. data/lib/cashctrl/resources/account/cost_center/category.rb +3 -9
  67. data/lib/cashctrl/resources/account/cost_center.rb +3 -25
  68. data/lib/cashctrl/resources/account.rb +4 -30
  69. data/lib/cashctrl/resources/attachments.rb +32 -0
  70. data/lib/cashctrl/resources/base.rb +160 -84
  71. data/lib/cashctrl/resources/currency.rb +1 -10
  72. data/lib/cashctrl/resources/custom_field/group.rb +3 -11
  73. data/lib/cashctrl/resources/custom_field.rb +3 -15
  74. data/lib/cashctrl/resources/file/category.rb +4 -10
  75. data/lib/cashctrl/resources/file.rb +44 -28
  76. data/lib/cashctrl/resources/fiscal_period/task.rb +2 -12
  77. data/lib/cashctrl/resources/fiscal_period.rb +17 -59
  78. data/lib/cashctrl/resources/history.rb +3 -21
  79. data/lib/cashctrl/resources/import_session.rb +43 -0
  80. data/lib/cashctrl/resources/inventory/article/category.rb +3 -9
  81. data/lib/cashctrl/resources/inventory/article/import.rb +13 -0
  82. data/lib/cashctrl/resources/inventory/article.rb +3 -18
  83. data/lib/cashctrl/resources/inventory/asset/category.rb +3 -9
  84. data/lib/cashctrl/resources/inventory/asset.rb +3 -18
  85. data/lib/cashctrl/resources/inventory/unit.rb +1 -1
  86. data/lib/cashctrl/resources/journal/import/entry.rb +1 -22
  87. data/lib/cashctrl/resources/journal/import.rb +1 -7
  88. data/lib/cashctrl/resources/journal.rb +19 -57
  89. data/lib/cashctrl/resources/location.rb +1 -1
  90. data/lib/cashctrl/resources/order/book_entry.rb +1 -1
  91. data/lib/cashctrl/resources/order/category.rb +4 -15
  92. data/lib/cashctrl/resources/order/document.rb +13 -21
  93. data/lib/cashctrl/resources/order/layout.rb +1 -1
  94. data/lib/cashctrl/resources/order/payment.rb +9 -29
  95. data/lib/cashctrl/resources/order.rb +21 -68
  96. data/lib/cashctrl/resources/organization.rb +13 -0
  97. data/lib/cashctrl/resources/person/category.rb +3 -9
  98. data/lib/cashctrl/resources/person/import.rb +11 -0
  99. data/lib/cashctrl/resources/person/title.rb +1 -1
  100. data/lib/cashctrl/resources/person.rb +4 -23
  101. data/lib/cashctrl/resources/report/collection.rb +10 -42
  102. data/lib/cashctrl/resources/report/element.rb +14 -46
  103. data/lib/cashctrl/resources/report.rb +4 -30
  104. data/lib/cashctrl/resources/rounding.rb +1 -1
  105. data/lib/cashctrl/resources/salary/book_entry.rb +1 -1
  106. data/lib/cashctrl/resources/salary/category.rb +3 -9
  107. data/lib/cashctrl/resources/salary/certificate/document.rb +14 -39
  108. data/lib/cashctrl/resources/salary/certificate/template.rb +2 -8
  109. data/lib/cashctrl/resources/salary/certificate.rb +2 -12
  110. data/lib/cashctrl/resources/salary/document.rb +14 -34
  111. data/lib/cashctrl/resources/salary/field.rb +3 -17
  112. data/lib/cashctrl/resources/salary/insurance/type.rb +1 -1
  113. data/lib/cashctrl/resources/salary/layout.rb +1 -1
  114. data/lib/cashctrl/resources/salary/payment.rb +9 -29
  115. data/lib/cashctrl/resources/salary/setting.rb +1 -1
  116. data/lib/cashctrl/resources/salary/statement.rb +19 -54
  117. data/lib/cashctrl/resources/salary/status.rb +3 -11
  118. data/lib/cashctrl/resources/salary/sum.rb +1 -1
  119. data/lib/cashctrl/resources/salary/template.rb +2 -8
  120. data/lib/cashctrl/resources/salary/type.rb +1 -8
  121. data/lib/cashctrl/resources/sequence_number.rb +1 -7
  122. data/lib/cashctrl/resources/setting.rb +6 -24
  123. data/lib/cashctrl/resources/tax.rb +1 -1
  124. data/lib/cashctrl/resources/text.rb +1 -1
  125. data/lib/cashctrl/schema.yml +111 -0
  126. data/lib/cashctrl/version.rb +2 -2
  127. data/lib/cashctrl.rb +35 -25
  128. data/lib/generators/model_generator.rb +19 -7
  129. data/sig/cashctrl.rbs +1 -1
  130. metadata +12 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class InsuranceType < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Journal < Resource
8
8
  attribute :debit_id, type: :integer
@@ -26,6 +26,7 @@ module Cashctrl
26
26
  attribute :notes, type: :string
27
27
  attribute :reference, type: :string
28
28
  attribute :amount, type: :decimal
29
+ attribute :items, type: :json
29
30
  attribute :currency_id, type: :integer
30
31
  attribute :currency_rate, type: :decimal
31
32
  attribute :currency_code, type: :string, readonly: true
@@ -51,6 +52,14 @@ module Cashctrl
51
52
  attribute :imported, type: :datetime, readonly: true
52
53
  attribute :imported_by, type: :string, readonly: true
53
54
  attribute :is_recurring, type: :boolean, readonly: true
55
+ belongs_to :debit, resource: "Account"
56
+ belongs_to :credit, resource: "Account"
57
+ belongs_to :associate, resource: "Person"
58
+ belongs_to :tax, resource: "Tax"
59
+ belongs_to :currency, resource: "Currency"
60
+ belongs_to :order, resource: "Order"
61
+ nested :items, model: "JournalItem"
62
+ nested :attachments, model: "Attachment"
54
63
  end
55
64
  end
56
65
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class JournalImport < Resource
8
8
  attribute :account_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class JournalImportEntry < Resource
8
8
  attribute :import_id, type: :integer
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated from schema.yml. Do not edit manually.
4
+
5
+ module CashCtrl
6
+ module Models
7
+ class JournalItem < Resource
8
+ attribute :account_id, type: :integer
9
+ attribute :debit, type: :decimal
10
+ attribute :credit, type: :decimal
11
+ attribute :description, type: :string
12
+ attribute :tax_id, type: :integer
13
+ attribute :associate_id, type: :integer
14
+ attribute :amount, type: :decimal, readonly: true
15
+ belongs_to :account, resource: "Account"
16
+ belongs_to :tax, resource: "Tax"
17
+ belongs_to :associate, resource: "Person"
18
+ end
19
+ end
20
+ end
@@ -50,3 +50,6 @@ require_relative "salary_type"
50
50
  require_relative "insurance_type"
51
51
  require_relative "certificate_document"
52
52
  require_relative "certificate_template"
53
+ require_relative "journal_item"
54
+ require_relative "order_item"
55
+ require_relative "attachment"
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Location < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Order < Resource
8
8
  attribute :category_id, type: :integer
@@ -41,6 +41,13 @@ module Cashctrl
41
41
  attribute :notify_user_id, type: :integer
42
42
  attribute :notify_email, type: :string
43
43
  attribute :is_recurring, type: :boolean, readonly: true
44
+ belongs_to :category, resource: "Order::Category"
45
+ belongs_to :associate, resource: "Person"
46
+ belongs_to :responsible_person, resource: "Person"
47
+ belongs_to :currency, resource: "Currency"
48
+ belongs_to :rounding, resource: "Rounding"
49
+ nested :items, model: "OrderItem"
50
+ nested :attachments, model: "Attachment"
44
51
  end
45
52
  end
46
53
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class OrderBookEntry < Resource
8
8
  attribute :order_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class OrderDocument < Resource
8
8
  attribute :order_id, type: :integer
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated from schema.yml. Do not edit manually.
4
+
5
+ module CashCtrl
6
+ module Models
7
+ class OrderItem < Resource
8
+ attribute :account_id, type: :integer
9
+ attribute :tax_id, type: :integer
10
+ attribute :unit_id, type: :integer
11
+ attribute :name, type: :string
12
+ attribute :description, type: :string
13
+ attribute :article_nr, type: :string
14
+ attribute :quantity, type: :decimal
15
+ attribute :unit_price, type: :decimal
16
+ attribute :discount_percentage, type: :decimal
17
+ attribute :type, type: :string
18
+ belongs_to :account, resource: "Account"
19
+ belongs_to :tax, resource: "Tax"
20
+ belongs_to :unit, resource: "Inventory::Unit"
21
+ end
22
+ end
23
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class OrderLayout < Resource
8
8
  attribute :type, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class OrderPayment < Resource
8
8
  attribute :order_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Person < Resource
8
8
  attribute :category_id, type: :integer
@@ -67,6 +67,12 @@ module Cashctrl
67
67
  attribute :is_family, type: :boolean
68
68
  attribute :is_auto_fill_responsible_person, type: :boolean
69
69
  attribute :is_inactive, type: :boolean
70
+ belongs_to :category, resource: "Person::Category"
71
+ belongs_to :superior, resource: "Person"
72
+ belongs_to :location, resource: "Location"
73
+ has_many :orders, resource: "Order", foreign_key: :associate_id
74
+ has_many :journals, resource: "Journal", foreign_key: :associate_id
75
+ nested :attachments, model: "Attachment"
70
76
  end
71
77
  end
72
78
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Report < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class ReportCollection < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class ReportElement < Resource
8
8
  attribute :collection_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Rounding < Resource
8
8
  attribute :name, type: :string
@@ -10,6 +10,7 @@ module Cashctrl
10
10
  attribute :account_name, type: :string, readonly: true
11
11
  attribute :mode, type: :string
12
12
  attribute :value, type: :decimal
13
+ belongs_to :account, resource: "Account"
13
14
  end
14
15
  end
15
16
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryBookEntry < Resource
8
8
  attribute :salary_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryCertificate < Resource
8
8
  attribute :person_id, type: :integer
@@ -10,6 +10,7 @@ module Cashctrl
10
10
  attribute :template_id, type: :integer
11
11
  attribute :year, type: :integer
12
12
  attribute :values, type: :json
13
+ belongs_to :person, resource: "Person"
13
14
  end
14
15
  end
15
16
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryDocument < Resource
8
8
  attribute :salary_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryField < Resource
8
8
  attribute :type_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryLayout < Resource
8
8
  attribute :type, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryPayment < Resource
8
8
  attribute :statement_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalarySetting < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryStatement < Resource
8
8
  attribute :person_id, type: :integer
@@ -12,6 +12,8 @@ module Cashctrl
12
12
  attribute :status, type: :string
13
13
  attribute :total_gross, type: :decimal, readonly: true
14
14
  attribute :total_net, type: :decimal, readonly: true
15
+ belongs_to :person, resource: "Person"
16
+ nested :attachments, model: "Attachment"
15
17
  end
16
18
  end
17
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryStatus < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalarySum < Resource
8
8
  attribute :type_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryTemplate < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SalaryType < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class SequenceNumber < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Setting < Resource
8
8
  attribute :fiscal_period_id, type: :integer
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Tax < Resource
8
8
  attribute :name, type: :string
@@ -12,6 +12,7 @@ module Cashctrl
12
12
  attribute :account_id, type: :integer
13
13
  attribute :account_name, type: :string, readonly: true
14
14
  attribute :is_inactive, type: :boolean
15
+ belongs_to :account, resource: "Account"
15
16
  end
16
17
  end
17
18
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Text < Resource
8
8
  attribute :type, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Title < Resource
8
8
  attribute :name, type: :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is auto-generated from schema.yml. Do not edit manually.
4
4
 
5
- module Cashctrl
5
+ module CashCtrl
6
6
  module Models
7
7
  class Unit < Resource
8
8
  attribute :name, type: :string