cashctrl 0.0.1 → 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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -0
  3. data/README.md +831 -14
  4. data/cashctrl.gemspec +1 -1
  5. data/lib/cashctrl/client.rb +219 -0
  6. data/lib/cashctrl/collection.rb +78 -0
  7. data/lib/cashctrl/configuration.rb +30 -0
  8. data/lib/cashctrl/error.rb +29 -0
  9. data/lib/cashctrl/errors.rb +76 -0
  10. data/lib/cashctrl/localized_string.rb +115 -0
  11. data/lib/cashctrl/models/account.rb +39 -0
  12. data/lib/cashctrl/models/article.rb +48 -0
  13. data/lib/cashctrl/models/asset.rb +37 -0
  14. data/lib/cashctrl/models/attachment.rb +14 -0
  15. data/lib/cashctrl/models/bank.rb +18 -0
  16. data/lib/cashctrl/models/category.rb +13 -0
  17. data/lib/cashctrl/models/certificate_document.rb +14 -0
  18. data/lib/cashctrl/models/certificate_template.rb +13 -0
  19. data/lib/cashctrl/models/cost_center.rb +17 -0
  20. data/lib/cashctrl/models/currency.rb +18 -0
  21. data/lib/cashctrl/models/custom_field.rb +18 -0
  22. data/lib/cashctrl/models/custom_field_group.rb +12 -0
  23. data/lib/cashctrl/models/file.rb +20 -0
  24. data/lib/cashctrl/models/fiscal_period.rb +16 -0
  25. data/lib/cashctrl/models/fiscal_period_task.rb +14 -0
  26. data/lib/cashctrl/models/history.rb +19 -0
  27. data/lib/cashctrl/models/insurance_type.rb +13 -0
  28. data/lib/cashctrl/models/journal.rb +65 -0
  29. data/lib/cashctrl/models/journal_import.rb +18 -0
  30. data/lib/cashctrl/models/journal_import_entry.rb +20 -0
  31. data/lib/cashctrl/models/journal_item.rb +20 -0
  32. data/lib/cashctrl/models/loader.rb +55 -0
  33. data/lib/cashctrl/models/location.rb +22 -0
  34. data/lib/cashctrl/models/order.rb +53 -0
  35. data/lib/cashctrl/models/order_book_entry.rb +17 -0
  36. data/lib/cashctrl/models/order_document.rb +15 -0
  37. data/lib/cashctrl/models/order_item.rb +23 -0
  38. data/lib/cashctrl/models/order_layout.rb +18 -0
  39. data/lib/cashctrl/models/order_payment.rb +16 -0
  40. data/lib/cashctrl/models/person.rb +78 -0
  41. data/lib/cashctrl/models/report.rb +15 -0
  42. data/lib/cashctrl/models/report_collection.rb +13 -0
  43. data/lib/cashctrl/models/report_element.rb +16 -0
  44. data/lib/cashctrl/models/rounding.rb +16 -0
  45. data/lib/cashctrl/models/salary_book_entry.rb +16 -0
  46. data/lib/cashctrl/models/salary_certificate.rb +16 -0
  47. data/lib/cashctrl/models/salary_document.rb +15 -0
  48. data/lib/cashctrl/models/salary_field.rb +16 -0
  49. data/lib/cashctrl/models/salary_layout.rb +13 -0
  50. data/lib/cashctrl/models/salary_payment.rb +16 -0
  51. data/lib/cashctrl/models/salary_setting.rb +12 -0
  52. data/lib/cashctrl/models/salary_statement.rb +19 -0
  53. data/lib/cashctrl/models/salary_status.rb +12 -0
  54. data/lib/cashctrl/models/salary_sum.rb +14 -0
  55. data/lib/cashctrl/models/salary_template.rb +12 -0
  56. data/lib/cashctrl/models/salary_type.rb +14 -0
  57. data/lib/cashctrl/models/sequence_number.rb +13 -0
  58. data/lib/cashctrl/models/setting.rb +33 -0
  59. data/lib/cashctrl/models/tax.rb +18 -0
  60. data/lib/cashctrl/models/text.rb +13 -0
  61. data/lib/cashctrl/models/title.rb +13 -0
  62. data/lib/cashctrl/models/unit.rb +11 -0
  63. data/lib/cashctrl/relation.rb +271 -0
  64. data/lib/cashctrl/resource.rb +433 -0
  65. data/lib/cashctrl/resources/account/bank.rb +14 -0
  66. data/lib/cashctrl/resources/account/category.rb +16 -0
  67. data/lib/cashctrl/resources/account/cost_center/category.rb +18 -0
  68. data/lib/cashctrl/resources/account/cost_center.rb +26 -0
  69. data/lib/cashctrl/resources/account.rb +28 -0
  70. data/lib/cashctrl/resources/attachments.rb +32 -0
  71. data/lib/cashctrl/resources/base.rb +237 -0
  72. data/lib/cashctrl/resources/currency.rb +17 -0
  73. data/lib/cashctrl/resources/custom_field/group.rb +16 -0
  74. data/lib/cashctrl/resources/custom_field.rb +18 -0
  75. data/lib/cashctrl/resources/file/category.rb +16 -0
  76. data/lib/cashctrl/resources/file.rb +82 -0
  77. data/lib/cashctrl/resources/fiscal_period/task.rb +20 -0
  78. data/lib/cashctrl/resources/fiscal_period.rb +54 -0
  79. data/lib/cashctrl/resources/history.rb +26 -0
  80. data/lib/cashctrl/resources/import_session.rb +43 -0
  81. data/lib/cashctrl/resources/inventory/article/category.rb +18 -0
  82. data/lib/cashctrl/resources/inventory/article/import.rb +13 -0
  83. data/lib/cashctrl/resources/inventory/article.rb +19 -0
  84. data/lib/cashctrl/resources/inventory/asset/category.rb +18 -0
  85. data/lib/cashctrl/resources/inventory/asset.rb +19 -0
  86. data/lib/cashctrl/resources/inventory/unit.rb +12 -0
  87. data/lib/cashctrl/resources/journal/import/entry.rb +33 -0
  88. data/lib/cashctrl/resources/journal/import.rb +16 -0
  89. data/lib/cashctrl/resources/journal.rb +56 -0
  90. data/lib/cashctrl/resources/location.rb +10 -0
  91. data/lib/cashctrl/resources/order/book_entry.rb +12 -0
  92. data/lib/cashctrl/resources/order/category.rb +21 -0
  93. data/lib/cashctrl/resources/order/document.rb +30 -0
  94. data/lib/cashctrl/resources/order/layout.rb +12 -0
  95. data/lib/cashctrl/resources/order/payment.rb +36 -0
  96. data/lib/cashctrl/resources/order.rb +47 -0
  97. data/lib/cashctrl/resources/organization.rb +13 -0
  98. data/lib/cashctrl/resources/person/category.rb +16 -0
  99. data/lib/cashctrl/resources/person/import.rb +11 -0
  100. data/lib/cashctrl/resources/person/title.rb +12 -0
  101. data/lib/cashctrl/resources/person.rb +21 -0
  102. data/lib/cashctrl/resources/report/collection.rb +40 -0
  103. data/lib/cashctrl/resources/report/element.rb +48 -0
  104. data/lib/cashctrl/resources/report.rb +34 -0
  105. data/lib/cashctrl/resources/rounding.rb +10 -0
  106. data/lib/cashctrl/resources/salary/book_entry.rb +12 -0
  107. data/lib/cashctrl/resources/salary/category.rb +16 -0
  108. data/lib/cashctrl/resources/salary/certificate/document.rb +47 -0
  109. data/lib/cashctrl/resources/salary/certificate/template.rb +18 -0
  110. data/lib/cashctrl/resources/salary/certificate.rb +20 -0
  111. data/lib/cashctrl/resources/salary/document.rb +42 -0
  112. data/lib/cashctrl/resources/salary/field.rb +24 -0
  113. data/lib/cashctrl/resources/salary/insurance/type.rb +14 -0
  114. data/lib/cashctrl/resources/salary/layout.rb +12 -0
  115. data/lib/cashctrl/resources/salary/payment.rb +36 -0
  116. data/lib/cashctrl/resources/salary/setting.rb +12 -0
  117. data/lib/cashctrl/resources/salary/statement.rb +42 -0
  118. data/lib/cashctrl/resources/salary/status.rb +16 -0
  119. data/lib/cashctrl/resources/salary/sum.rb +12 -0
  120. data/lib/cashctrl/resources/salary/template.rb +16 -0
  121. data/lib/cashctrl/resources/salary/type.rb +17 -0
  122. data/lib/cashctrl/resources/sequence_number.rb +14 -0
  123. data/lib/cashctrl/resources/setting.rb +34 -0
  124. data/lib/cashctrl/resources/tax.rb +10 -0
  125. data/lib/cashctrl/resources/text.rb +10 -0
  126. data/lib/cashctrl/schema.yml +712 -0
  127. data/lib/cashctrl/version.rb +2 -2
  128. data/lib/cashctrl.rb +125 -3
  129. data/lib/generators/model_generator.rb +104 -0
  130. data/sig/cashctrl.rbs +1 -1
  131. metadata +126 -2
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Journal < Base
6
+ include Attachments
7
+
8
+ api_path "journal"
9
+ model_class Models::Journal
10
+
11
+ def update_recurrence(id:, recurrence: nil, start_date: nil, end_date: nil, days_before: nil,
12
+ notify_type: nil, notify_person_id: nil, notify_user_id: nil, notify_email: nil)
13
+ params = { id: id }
14
+ params[:recurrence] = recurrence if recurrence
15
+ params[:startDate] = start_date if start_date
16
+ params[:endDate] = end_date if end_date
17
+ params[:daysBefore] = days_before if days_before
18
+ params[:notifyType] = notify_type if notify_type
19
+ params[:notifyPersonId] = notify_person_id if notify_person_id
20
+ params[:notifyUserId] = notify_user_id if notify_user_id
21
+ params[:notifyEmail] = notify_email if notify_email
22
+ client.post("#{api_path}/update_recurrence.json", params)
23
+ end
24
+
25
+ private
26
+
27
+ def record_attributes(record)
28
+ attributes = super
29
+ attributes.delete("items") if Array(record.items).empty?
30
+ attributes
31
+ end
32
+
33
+ def normalize_attributes(attributes)
34
+ attributes = attributes.transform_keys(&:to_sym)
35
+ debit = attributes.delete(:debit)
36
+ credit = attributes.delete(:credit)
37
+ attributes[:debit_id] = resolve_account_id(debit) if debit
38
+ attributes[:credit_id] = resolve_account_id(credit) if credit
39
+ super
40
+ end
41
+
42
+ def resolve_account_id(account)
43
+ case account
44
+ when Integer
45
+ account
46
+ when Models::Account
47
+ account.id
48
+ when String
49
+ Account.with_client(client).find_by_number(account)&.id || raise(ArgumentError, "Account not found: #{account}")
50
+ else
51
+ raise ArgumentError, "Invalid account: #{account.inspect}. Expected Integer, Account, or account number String."
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Location < Base
6
+ api_path "location"
7
+ model_class Models::Location
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order
6
+ class BookEntry < Base
7
+ api_path "order/bookentry"
8
+ model_class Models::OrderBookEntry
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order
6
+ class Category < Base
7
+ api_path "order/category"
8
+ model_class Models::Category
9
+ list_params :type
10
+
11
+ def read_status(id:)
12
+ client.get("#{api_path}/read_status.json", id: id)
13
+ end
14
+
15
+ def reorder(ids:, target:, before: nil, type: nil)
16
+ client.post("#{api_path}/reorder.json", api_params(ids: csv(ids), target: target, before: before, type: type))
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order
6
+ class Document < Base
7
+ api_path "order/document"
8
+ model_class Models::OrderDocument
9
+
10
+ def read_pdf(ids:)
11
+ client.get_raw("#{api_path}/read.pdf", ids: csv(ids))
12
+ end
13
+
14
+ def read_zip(ids:)
15
+ client.get_raw("#{api_path}/read.zip", ids: csv(ids))
16
+ end
17
+
18
+ def mail(order_ids:, mail_from:, mail_subject:, mail_text:, mail_to: nil, mail_cc: nil, mail_bcc: nil,
19
+ is_copy_to_me: nil, sent_status_id: nil)
20
+ params = api_params(
21
+ order_ids: csv(order_ids), mail_from: mail_from, mail_subject: mail_subject, mail_text: mail_text,
22
+ mail_to: mail_to, mail_cc: mail_cc, mail_bcc: mail_bcc, is_copy_to_me: is_copy_to_me,
23
+ sent_status_id: sent_status_id
24
+ )
25
+ client.post("#{api_path}/mail.json", params)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order
6
+ class Layout < Base
7
+ api_path "order/layout"
8
+ model_class Models::OrderLayout
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order
6
+ class Payment < Base
7
+ api_path "order/payment"
8
+ model_class Models::OrderPayment
9
+
10
+ def list
11
+ raise NotImplementedError, "Order::Payment does not support list"
12
+ end
13
+
14
+ def read(id:)
15
+ raise NotImplementedError, "Order::Payment does not support read"
16
+ end
17
+
18
+ def update(*, **)
19
+ raise NotImplementedError, "Order::Payment does not support update"
20
+ end
21
+
22
+ def delete(*)
23
+ raise NotImplementedError, "Order::Payment does not support delete"
24
+ end
25
+
26
+ def download(order_ids:, date:, amount: nil, is_combine: nil, status_id: nil, type: nil)
27
+ params = api_params(
28
+ order_ids: csv(order_ids), date: date, amount: amount, is_combine: is_combine, status_id: status_id,
29
+ type: type
30
+ )
31
+ client.get_raw("#{api_path}/download", params)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Order < Base
6
+ include Attachments
7
+
8
+ api_path "order"
9
+ model_class Models::Order
10
+ list_params :type
11
+
12
+ def update_status(ids:, status_id:)
13
+ client.post("#{api_path}/update_status.json", ids: csv(ids), statusId: status_id)
14
+ end
15
+
16
+ def update_recurrence(id:, recurrence: nil, start_date: nil, end_date: nil, days_before: nil,
17
+ notify_type: nil, notify_person_id: nil, notify_user_id: nil, notify_email: nil)
18
+ params = api_params(
19
+ id: id, recurrence: recurrence, start_date: start_date, end_date: end_date, days_before: days_before,
20
+ notify_type: notify_type, notify_person_id: notify_person_id, notify_user_id: notify_user_id,
21
+ notify_email: notify_email
22
+ )
23
+ client.post("#{api_path}/update_recurrence.json", params)
24
+ end
25
+
26
+ def continue(ids:, category_id:, associate_id: nil, date: nil, notes: nil, status_id: nil)
27
+ params = api_params(
28
+ ids: csv(ids), category_id: category_id, associate_id: associate_id, date: date, notes: notes,
29
+ status_id: status_id
30
+ )
31
+ client.post("#{api_path}/continue.json", params)
32
+ end
33
+
34
+ def dossier(id:)
35
+ client.get("#{api_path}/dossier.json", id: id)
36
+ end
37
+
38
+ def dossier_add(group_id:, ids:)
39
+ client.post("#{api_path}/dossier_add.json", groupId: group_id, ids: csv(ids))
40
+ end
41
+
42
+ def dossier_remove(group_id:, ids:)
43
+ client.post("#{api_path}/dossier_remove.json", groupId: group_id, ids: csv(ids))
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Organization < Base
6
+ api_path "domain/current"
7
+
8
+ def logo
9
+ client.get_raw("#{api_path}/logo")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Person
6
+ class Category < Base
7
+ api_path "person/category"
8
+ model_class Models::Category
9
+
10
+ def tree(id = nil)
11
+ tree_collection(client.get("#{api_path}/tree.json", api_params(id: id)))
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Person
6
+ class Import < ImportSession
7
+ api_path "person/import"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Person
6
+ class Title < Base
7
+ api_path "person/title"
8
+ model_class Models::Title
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Person < Base
6
+ include Attachments
7
+
8
+ api_path "person"
9
+ model_class Models::Person
10
+
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
+
16
+ def list_vcf(**params)
17
+ client.get_raw("#{api_path}/list.vcf", api_params(**params))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Report
6
+ class Collection < Base
7
+ api_path "report/collection"
8
+ model_class Models::ReportCollection
9
+
10
+ def list
11
+ raise NotImplementedError, "Report::Collection does not support list"
12
+ end
13
+
14
+ def meta(id:, **params)
15
+ client.get("#{api_path}/meta.json", api_params(collection_id: id, **params))
16
+ end
17
+
18
+ def download_pdf(id:, **params)
19
+ client.get_raw("#{api_path}/download.pdf", api_params(collection_id: id, **params))
20
+ end
21
+
22
+ def download_csv(id:, **params)
23
+ client.get_raw("#{api_path}/download.csv", api_params(collection_id: id, **params))
24
+ end
25
+
26
+ def download_xlsx(id:, **params)
27
+ client.get_raw("#{api_path}/download.xlsx", api_params(collection_id: id, **params))
28
+ end
29
+
30
+ def download_annual_report(fiscal_period_id: nil)
31
+ client.get_raw("#{api_path}/download_annualreport.pdf", api_params(fiscal_period_id: fiscal_period_id))
32
+ end
33
+
34
+ def reorder(ids:, target:, before: nil)
35
+ client.post("#{api_path}/reorder.json", api_params(ids: csv(ids), target: target, before: before))
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Report
6
+ class Element < Base
7
+ api_path "report/element"
8
+ model_class Models::ReportElement
9
+
10
+ def list
11
+ raise NotImplementedError, "Report::Element does not support list"
12
+ end
13
+
14
+ def data(id:, **params)
15
+ client.get("#{api_path}/data.json", api_params(element_id: id, **params))
16
+ end
17
+
18
+ def data_html(id:, **params)
19
+ client.get_raw("#{api_path}/data.html", api_params(element_id: id, **params))
20
+ end
21
+
22
+ def meta(id:, **params)
23
+ client.get("#{api_path}/meta.json", api_params(element_id: id, **params))
24
+ end
25
+
26
+ def download_pdf(id:, **params)
27
+ client.get_raw("#{api_path}/download.pdf", api_params(element_id: id, **params))
28
+ end
29
+
30
+ def download_csv(id:, **params)
31
+ client.get_raw("#{api_path}/download.csv", api_params(element_id: id, **params))
32
+ end
33
+
34
+ def download_xlsx(id:, **params)
35
+ client.get_raw("#{api_path}/download.xlsx", api_params(element_id: id, **params))
36
+ end
37
+
38
+ def download_xml(id:, **params)
39
+ client.get_raw("#{api_path}/download.xml", api_params(element_id: id, **params))
40
+ end
41
+
42
+ def reorder(ids:, target:, before: nil)
43
+ client.post("#{api_path}/reorder.json", api_params(ids: csv(ids), target: target, before: before))
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Report < Base
6
+ api_path "report"
7
+ model_class Models::Report
8
+
9
+ def list
10
+ raise NotImplementedError, "Report does not support list, use tree instead"
11
+ end
12
+
13
+ def read(id:)
14
+ raise NotImplementedError, "Report does not support read"
15
+ end
16
+
17
+ def create(**params)
18
+ raise NotImplementedError, "Report does not support create"
19
+ end
20
+
21
+ def update(*, **)
22
+ raise NotImplementedError, "Report does not support update"
23
+ end
24
+
25
+ def delete(*)
26
+ raise NotImplementedError, "Report does not support delete"
27
+ end
28
+
29
+ def tree
30
+ tree_collection(client.get("#{api_path}/tree.json"))
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ class Rounding < Base
6
+ api_path "rounding"
7
+ model_class Models::Rounding
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ module Salary
6
+ class BookEntry < Base
7
+ api_path "salary/bookentry"
8
+ model_class Models::SalaryBookEntry
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ module Salary
6
+ class Category < Base
7
+ api_path "salary/category"
8
+ model_class Models::Category
9
+
10
+ def tree(id = nil)
11
+ tree_collection(client.get("#{api_path}/tree.json", api_params(id: id)))
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ module Salary
6
+ class Certificate
7
+ class Document < Base
8
+ api_path "salary/certificate/document"
9
+ model_class Models::CertificateDocument
10
+
11
+ def list
12
+ raise NotImplementedError, "Salary::Certificate::Document does not support list"
13
+ end
14
+
15
+ def create(**params)
16
+ raise NotImplementedError, "Salary::Certificate::Document does not support create"
17
+ end
18
+
19
+ def update(*, **)
20
+ raise NotImplementedError, "Salary::Certificate::Document does not support update"
21
+ end
22
+
23
+ def delete(*)
24
+ raise NotImplementedError, "Salary::Certificate::Document does not support delete"
25
+ end
26
+
27
+ def read_pdf(ids:)
28
+ client.get_raw("#{api_path}/read.pdf", ids: csv(ids))
29
+ end
30
+
31
+ def read_zip(ids:)
32
+ client.get_raw("#{api_path}/read.zip", ids: csv(ids))
33
+ end
34
+
35
+ def mail(certificate_ids:, mail_from:, mail_subject:, mail_text:, mail_to: nil, mail_cc: nil, mail_bcc: nil,
36
+ is_copy_to_me: nil)
37
+ params = api_params(
38
+ certificate_ids: csv(certificate_ids), mail_from: mail_from, mail_subject: mail_subject, mail_text: mail_text,
39
+ mail_to: mail_to, mail_cc: mail_cc, mail_bcc: mail_bcc, is_copy_to_me: is_copy_to_me
40
+ )
41
+ client.post("#{api_path}/mail.json", params)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CashCtrl
4
+ module Resources
5
+ module Salary
6
+ class Certificate
7
+ class Template < Base
8
+ api_path "salary/certificate/template"
9
+ model_class Models::CertificateTemplate
10
+
11
+ def tree
12
+ tree_collection(client.get("#{api_path}/tree.json"))
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
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
+ def create(**params)
11
+ raise NotImplementedError, "Salary::Certificate does not support create"
12
+ end
13
+
14
+ def delete(*)
15
+ raise NotImplementedError, "Salary::Certificate does not support delete"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,42 @@
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
+ def list
11
+ raise NotImplementedError, "Salary::Document does not support list"
12
+ end
13
+
14
+ def create(**params)
15
+ raise NotImplementedError, "Salary::Document does not support create"
16
+ end
17
+
18
+ def delete(*)
19
+ raise NotImplementedError, "Salary::Document does not support delete"
20
+ end
21
+
22
+ def read_pdf(ids:)
23
+ client.get_raw("#{api_path}/read.pdf", ids: csv(ids))
24
+ end
25
+
26
+ def read_zip(ids:)
27
+ client.get_raw("#{api_path}/read.zip", ids: csv(ids))
28
+ end
29
+
30
+ def mail(statement_ids:, mail_from:, mail_subject:, mail_text:, mail_to: nil, mail_cc: nil, mail_bcc: nil,
31
+ is_copy_to_me: nil, sent_status_id: nil)
32
+ params = api_params(
33
+ statement_ids: csv(statement_ids), mail_from: mail_from, mail_subject: mail_subject, mail_text: mail_text,
34
+ mail_to: mail_to, mail_cc: mail_cc, mail_bcc: mail_bcc, is_copy_to_me: is_copy_to_me,
35
+ sent_status_id: sent_status_id
36
+ )
37
+ client.post("#{api_path}/mail.json", params)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
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
+ def create(**params)
11
+ raise NotImplementedError, "Salary::Field does not support create"
12
+ end
13
+
14
+ def update(*, **)
15
+ raise NotImplementedError, "Salary::Field does not support update"
16
+ end
17
+
18
+ def delete(*)
19
+ raise NotImplementedError, "Salary::Field does not support delete"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ 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