cashctrl 0.0.1 → 0.1.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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -0
  3. data/README.md +549 -14
  4. data/lib/cashctrl/client.rb +216 -0
  5. data/lib/cashctrl/collection.rb +77 -0
  6. data/lib/cashctrl/configuration.rb +30 -0
  7. data/lib/cashctrl/error.rb +27 -0
  8. data/lib/cashctrl/localized_string.rb +115 -0
  9. data/lib/cashctrl/models/account.rb +35 -0
  10. data/lib/cashctrl/models/article.rb +40 -0
  11. data/lib/cashctrl/models/asset.rb +32 -0
  12. data/lib/cashctrl/models/bank.rb +16 -0
  13. data/lib/cashctrl/models/category.rb +13 -0
  14. data/lib/cashctrl/models/certificate_document.rb +14 -0
  15. data/lib/cashctrl/models/certificate_template.rb +13 -0
  16. data/lib/cashctrl/models/cost_center.rb +15 -0
  17. data/lib/cashctrl/models/currency.rb +18 -0
  18. data/lib/cashctrl/models/custom_field.rb +18 -0
  19. data/lib/cashctrl/models/custom_field_group.rb +12 -0
  20. data/lib/cashctrl/models/file.rb +19 -0
  21. data/lib/cashctrl/models/fiscal_period.rb +16 -0
  22. data/lib/cashctrl/models/fiscal_period_task.rb +14 -0
  23. data/lib/cashctrl/models/history.rb +19 -0
  24. data/lib/cashctrl/models/insurance_type.rb +13 -0
  25. data/lib/cashctrl/models/journal.rb +56 -0
  26. data/lib/cashctrl/models/journal_import.rb +18 -0
  27. data/lib/cashctrl/models/journal_import_entry.rb +20 -0
  28. data/lib/cashctrl/models/loader.rb +52 -0
  29. data/lib/cashctrl/models/location.rb +22 -0
  30. data/lib/cashctrl/models/order.rb +46 -0
  31. data/lib/cashctrl/models/order_book_entry.rb +17 -0
  32. data/lib/cashctrl/models/order_document.rb +15 -0
  33. data/lib/cashctrl/models/order_layout.rb +18 -0
  34. data/lib/cashctrl/models/order_payment.rb +16 -0
  35. data/lib/cashctrl/models/person.rb +72 -0
  36. data/lib/cashctrl/models/report.rb +15 -0
  37. data/lib/cashctrl/models/report_collection.rb +13 -0
  38. data/lib/cashctrl/models/report_element.rb +16 -0
  39. data/lib/cashctrl/models/rounding.rb +15 -0
  40. data/lib/cashctrl/models/salary_book_entry.rb +16 -0
  41. data/lib/cashctrl/models/salary_certificate.rb +15 -0
  42. data/lib/cashctrl/models/salary_document.rb +15 -0
  43. data/lib/cashctrl/models/salary_field.rb +16 -0
  44. data/lib/cashctrl/models/salary_layout.rb +13 -0
  45. data/lib/cashctrl/models/salary_payment.rb +16 -0
  46. data/lib/cashctrl/models/salary_setting.rb +12 -0
  47. data/lib/cashctrl/models/salary_statement.rb +17 -0
  48. data/lib/cashctrl/models/salary_status.rb +12 -0
  49. data/lib/cashctrl/models/salary_sum.rb +14 -0
  50. data/lib/cashctrl/models/salary_template.rb +12 -0
  51. data/lib/cashctrl/models/salary_type.rb +14 -0
  52. data/lib/cashctrl/models/sequence_number.rb +13 -0
  53. data/lib/cashctrl/models/setting.rb +33 -0
  54. data/lib/cashctrl/models/tax.rb +17 -0
  55. data/lib/cashctrl/models/text.rb +13 -0
  56. data/lib/cashctrl/models/title.rb +13 -0
  57. data/lib/cashctrl/models/unit.rb +11 -0
  58. data/lib/cashctrl/resource.rb +190 -0
  59. data/lib/cashctrl/resources/account/bank.rb +24 -0
  60. data/lib/cashctrl/resources/account/category.rb +22 -0
  61. data/lib/cashctrl/resources/account/cost_center/category.rb +24 -0
  62. data/lib/cashctrl/resources/account/cost_center.rb +48 -0
  63. data/lib/cashctrl/resources/account.rb +54 -0
  64. data/lib/cashctrl/resources/base.rb +161 -0
  65. data/lib/cashctrl/resources/currency.rb +26 -0
  66. data/lib/cashctrl/resources/custom_field/group.rb +24 -0
  67. data/lib/cashctrl/resources/custom_field.rb +30 -0
  68. data/lib/cashctrl/resources/file/category.rb +22 -0
  69. data/lib/cashctrl/resources/file.rb +66 -0
  70. data/lib/cashctrl/resources/fiscal_period/task.rb +30 -0
  71. data/lib/cashctrl/resources/fiscal_period.rb +96 -0
  72. data/lib/cashctrl/resources/history.rb +44 -0
  73. data/lib/cashctrl/resources/inventory/article/category.rb +24 -0
  74. data/lib/cashctrl/resources/inventory/article.rb +34 -0
  75. data/lib/cashctrl/resources/inventory/asset/category.rb +24 -0
  76. data/lib/cashctrl/resources/inventory/asset.rb +34 -0
  77. data/lib/cashctrl/resources/inventory/unit.rb +12 -0
  78. data/lib/cashctrl/resources/journal/import/entry.rb +54 -0
  79. data/lib/cashctrl/resources/journal/import.rb +22 -0
  80. data/lib/cashctrl/resources/journal.rb +94 -0
  81. data/lib/cashctrl/resources/location.rb +10 -0
  82. data/lib/cashctrl/resources/order/book_entry.rb +12 -0
  83. data/lib/cashctrl/resources/order/category.rb +32 -0
  84. data/lib/cashctrl/resources/order/document.rb +38 -0
  85. data/lib/cashctrl/resources/order/layout.rb +12 -0
  86. data/lib/cashctrl/resources/order/payment.rb +56 -0
  87. data/lib/cashctrl/resources/order.rb +94 -0
  88. data/lib/cashctrl/resources/person/category.rb +22 -0
  89. data/lib/cashctrl/resources/person/title.rb +12 -0
  90. data/lib/cashctrl/resources/person.rb +40 -0
  91. data/lib/cashctrl/resources/report/collection.rb +72 -0
  92. data/lib/cashctrl/resources/report/element.rb +80 -0
  93. data/lib/cashctrl/resources/report.rb +60 -0
  94. data/lib/cashctrl/resources/rounding.rb +10 -0
  95. data/lib/cashctrl/resources/salary/book_entry.rb +12 -0
  96. data/lib/cashctrl/resources/salary/category.rb +22 -0
  97. data/lib/cashctrl/resources/salary/certificate/document.rb +72 -0
  98. data/lib/cashctrl/resources/salary/certificate/template.rb +24 -0
  99. data/lib/cashctrl/resources/salary/certificate.rb +30 -0
  100. data/lib/cashctrl/resources/salary/document.rb +62 -0
  101. data/lib/cashctrl/resources/salary/field.rb +38 -0
  102. data/lib/cashctrl/resources/salary/insurance/type.rb +14 -0
  103. data/lib/cashctrl/resources/salary/layout.rb +12 -0
  104. data/lib/cashctrl/resources/salary/payment.rb +56 -0
  105. data/lib/cashctrl/resources/salary/setting.rb +12 -0
  106. data/lib/cashctrl/resources/salary/statement.rb +77 -0
  107. data/lib/cashctrl/resources/salary/status.rb +24 -0
  108. data/lib/cashctrl/resources/salary/sum.rb +12 -0
  109. data/lib/cashctrl/resources/salary/template.rb +22 -0
  110. data/lib/cashctrl/resources/salary/type.rb +24 -0
  111. data/lib/cashctrl/resources/sequence_number.rb +20 -0
  112. data/lib/cashctrl/resources/setting.rb +52 -0
  113. data/lib/cashctrl/resources/tax.rb +10 -0
  114. data/lib/cashctrl/resources/text.rb +10 -0
  115. data/lib/cashctrl/schema.yml +601 -0
  116. data/lib/cashctrl/version.rb +1 -1
  117. data/lib/cashctrl.rb +114 -2
  118. data/lib/generators/model_generator.rb +92 -0
  119. metadata +115 -1
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Certificate < Base
7
+ api_path "salary/certificate"
8
+ model_class Models::SalaryCertificate
9
+
10
+ class << self
11
+ def create(**params)
12
+ raise NotImplementedError, "Salary::Certificate does not support create"
13
+ end
14
+
15
+ def delete(ids:)
16
+ raise NotImplementedError, "Salary::Certificate does not support delete"
17
+ end
18
+ end
19
+
20
+ def create(**params)
21
+ raise NotImplementedError, "Salary::Certificate does not support create"
22
+ end
23
+
24
+ def delete(ids:)
25
+ raise NotImplementedError, "Salary::Certificate does not support delete"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Document < Base
7
+ api_path "salary/document"
8
+ model_class Models::SalaryDocument
9
+
10
+ class << self
11
+ def list
12
+ raise NotImplementedError, "Salary::Document does not support list"
13
+ end
14
+
15
+ def create(**params)
16
+ raise NotImplementedError, "Salary::Document does not support create"
17
+ end
18
+
19
+ def delete(ids:)
20
+ raise NotImplementedError, "Salary::Document does not support delete"
21
+ end
22
+
23
+ def read_pdf(id:)
24
+ client.get_raw("#{api_path}/read.pdf", id: id)
25
+ end
26
+
27
+ def read_zip(id:)
28
+ client.get_raw("#{api_path}/read.zip", id: id)
29
+ end
30
+
31
+ def mail(id:, recipient_email:, **params)
32
+ client.post("#{api_path}/mail.json", { id: id, recipientEmail: recipient_email, **params })
33
+ end
34
+ end
35
+
36
+ def list
37
+ raise NotImplementedError, "Salary::Document does not support list"
38
+ end
39
+
40
+ def create(**params)
41
+ raise NotImplementedError, "Salary::Document does not support create"
42
+ end
43
+
44
+ def delete(ids:)
45
+ raise NotImplementedError, "Salary::Document does not support delete"
46
+ end
47
+
48
+ def read_pdf(id:)
49
+ client.get_raw("#{api_path}/read.pdf", id: id)
50
+ end
51
+
52
+ def read_zip(id:)
53
+ client.get_raw("#{api_path}/read.zip", id: id)
54
+ end
55
+
56
+ def mail(id:, recipient_email:, **params)
57
+ client.post("#{api_path}/mail.json", { id: id, recipientEmail: recipient_email, **params })
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Field < Base
7
+ api_path "salary/field"
8
+ model_class Models::SalaryField
9
+
10
+ class << self
11
+ def create(**params)
12
+ raise NotImplementedError, "Salary::Field does not support create"
13
+ end
14
+
15
+ def update(id:, **params)
16
+ raise NotImplementedError, "Salary::Field does not support update"
17
+ end
18
+
19
+ def delete(ids:)
20
+ raise NotImplementedError, "Salary::Field does not support delete"
21
+ end
22
+ end
23
+
24
+ def create(**params)
25
+ raise NotImplementedError, "Salary::Field does not support create"
26
+ end
27
+
28
+ def update(id:, **params)
29
+ raise NotImplementedError, "Salary::Field does not support update"
30
+ end
31
+
32
+ def delete(ids:)
33
+ raise NotImplementedError, "Salary::Field does not support delete"
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ module Insurance
7
+ class Type < Base
8
+ api_path "salary/insurance/type"
9
+ model_class Models::InsuranceType
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Layout < Base
7
+ api_path "salary/layout"
8
+ model_class Models::SalaryLayout
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Payment < Base
7
+ api_path "salary/payment"
8
+ model_class Models::SalaryPayment
9
+
10
+ class << self
11
+ def list
12
+ raise NotImplementedError, "Salary::Payment does not support list"
13
+ end
14
+
15
+ def read(id:)
16
+ raise NotImplementedError, "Salary::Payment does not support read"
17
+ end
18
+
19
+ def update(id:, **params)
20
+ raise NotImplementedError, "Salary::Payment does not support update"
21
+ end
22
+
23
+ def delete(ids:)
24
+ raise NotImplementedError, "Salary::Payment does not support delete"
25
+ end
26
+
27
+ def download(ids:)
28
+ ids_param = Array(ids).join(",")
29
+ client.get_raw("#{api_path}/download", ids: ids_param)
30
+ end
31
+ end
32
+
33
+ def list
34
+ raise NotImplementedError, "Salary::Payment does not support list"
35
+ end
36
+
37
+ def read(id:)
38
+ raise NotImplementedError, "Salary::Payment does not support read"
39
+ end
40
+
41
+ def update(id:, **params)
42
+ raise NotImplementedError, "Salary::Payment does not support update"
43
+ end
44
+
45
+ def delete(ids:)
46
+ raise NotImplementedError, "Salary::Payment does not support delete"
47
+ end
48
+
49
+ def download(ids:)
50
+ ids_param = Array(ids).join(",")
51
+ client.get_raw("#{api_path}/download", ids: ids_param)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Setting < Base
7
+ api_path "salary/setting"
8
+ model_class Models::SalarySetting
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Statement < Base
7
+ api_path "salary/statement"
8
+ model_class Models::SalaryStatement
9
+
10
+ class << self
11
+ def update_multiple(ids:, **params)
12
+ ids_param = Array(ids).join(",")
13
+ client.post("#{api_path}/update_multiple.json", { ids: ids_param, **params })
14
+ end
15
+
16
+ def update_status(id:, status:)
17
+ client.post("#{api_path}/update_status.json", id: id, status: status)
18
+ end
19
+
20
+ def update_recurrence(id:, recurrence: nil, start_date: nil, end_date: nil, days_before: nil, notify_type: nil, notify_person_id: nil, notify_user_id: nil, notify_email: nil)
21
+ params = { id: id }
22
+ params[:recurrence] = recurrence if recurrence
23
+ params[:startDate] = start_date if start_date
24
+ params[:endDate] = end_date if end_date
25
+ params[:daysBefore] = days_before if days_before
26
+ params[:notifyType] = notify_type if notify_type
27
+ params[:notifyPersonId] = notify_person_id if notify_person_id
28
+ params[:notifyUserId] = notify_user_id if notify_user_id
29
+ params[:notifyEmail] = notify_email if notify_email
30
+ client.post("#{api_path}/update_recurrence.json", params)
31
+ end
32
+
33
+ def calculate(id:)
34
+ client.post("#{api_path}/calculate.json", id: id)
35
+ end
36
+
37
+ def update_attachments(id:, file_ids:)
38
+ file_ids_param = Array(file_ids).join(",")
39
+ client.post("#{api_path}/update_attachments.json", id: id, fileIds: file_ids_param)
40
+ end
41
+ end
42
+
43
+ def update_multiple(ids:, **params)
44
+ ids_param = Array(ids).join(",")
45
+ client.post("#{api_path}/update_multiple.json", { ids: ids_param, **params })
46
+ end
47
+
48
+ def update_status(id:, status:)
49
+ client.post("#{api_path}/update_status.json", id: id, status: status)
50
+ end
51
+
52
+ def update_recurrence(id:, recurrence: nil, start_date: nil, end_date: nil, days_before: nil,
53
+ notify_type: nil, notify_person_id: nil, notify_user_id: nil, notify_email: nil)
54
+ params = { id: id }
55
+ params[:recurrence] = recurrence if recurrence
56
+ params[:startDate] = start_date if start_date
57
+ params[:endDate] = end_date if end_date
58
+ params[:daysBefore] = days_before if days_before
59
+ params[:notifyType] = notify_type if notify_type
60
+ params[:notifyPersonId] = notify_person_id if notify_person_id
61
+ params[:notifyUserId] = notify_user_id if notify_user_id
62
+ params[:notifyEmail] = notify_email if notify_email
63
+ client.post("#{api_path}/update_recurrence.json", params)
64
+ end
65
+
66
+ def calculate(id:)
67
+ client.post("#{api_path}/calculate.json", id: id)
68
+ end
69
+
70
+ def update_attachments(id:, file_ids:)
71
+ file_ids_param = Array(file_ids).join(",")
72
+ client.post("#{api_path}/update_attachments.json", id: id, fileIds: file_ids_param)
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Status < Base
7
+ api_path "salary/status"
8
+ model_class Models::SalaryStatus
9
+
10
+ class << self
11
+ def reorder(ids:)
12
+ ids_param = Array(ids).join(",")
13
+ client.post("#{api_path}/reorder.json", ids: ids_param)
14
+ end
15
+ end
16
+
17
+ def reorder(ids:)
18
+ ids_param = Array(ids).join(",")
19
+ client.post("#{api_path}/reorder.json", ids: ids_param)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Sum < Base
7
+ api_path "salary/sum"
8
+ model_class Models::SalarySum
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Template < Base
7
+ api_path "salary/template"
8
+ model_class Models::SalaryTemplate
9
+
10
+ class << self
11
+ def tree
12
+ client.get("#{api_path}/tree.json")
13
+ end
14
+ end
15
+
16
+ def tree
17
+ client.get("#{api_path}/tree.json")
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ module Salary
6
+ class Type < Base
7
+ api_path "salary/type"
8
+ model_class Models::SalaryType
9
+
10
+ class << self
11
+ def categorize(ids:, target:)
12
+ ids_param = Array(ids).join(",")
13
+ client.post("#{api_path}/categorize.json", ids: ids_param, target: target)
14
+ end
15
+ end
16
+
17
+ def categorize(ids:, target:)
18
+ ids_param = Array(ids).join(",")
19
+ client.post("#{api_path}/categorize.json", ids: ids_param, target: target)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ class SequenceNumber < Base
6
+ api_path "sequencenumber"
7
+ model_class Models::SequenceNumber
8
+
9
+ class << self
10
+ def get(id:)
11
+ client.get("#{api_path}/get", id: id)
12
+ end
13
+ end
14
+
15
+ def get(id:)
16
+ client.get("#{api_path}/get", id: id)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ class Setting < Base
6
+ api_path "setting"
7
+ model_class Models::Setting
8
+
9
+ class << self
10
+ def list
11
+ raise NotImplementedError, "Setting does not support list, use read instead"
12
+ end
13
+
14
+ def read
15
+ client.get("#{api_path}/read.json")
16
+ end
17
+
18
+ def get(name:)
19
+ client.get("#{api_path}/get", name: name)
20
+ end
21
+
22
+ def create(**params)
23
+ raise NotImplementedError, "Setting does not support create, use update instead"
24
+ end
25
+
26
+ def delete(ids:)
27
+ raise NotImplementedError, "Setting does not support delete"
28
+ end
29
+ end
30
+
31
+ def list
32
+ raise NotImplementedError, "Setting does not support list, use read instead"
33
+ end
34
+
35
+ def read
36
+ client.get("#{api_path}/read.json")
37
+ end
38
+
39
+ def get(name:)
40
+ client.get("#{api_path}/get", name: name)
41
+ end
42
+
43
+ def create(**params)
44
+ raise NotImplementedError, "Setting does not support create, use update instead"
45
+ end
46
+
47
+ def delete(ids:)
48
+ raise NotImplementedError, "Setting does not support delete"
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ class Tax < Base
6
+ api_path "tax"
7
+ model_class Models::Tax
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ module Resources
5
+ class Text < Base
6
+ api_path "text"
7
+ model_class Models::Text
8
+ end
9
+ end
10
+ end