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,216 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "json"
5
+
6
+ module Cashctrl
7
+ class Client
8
+ attr_reader :config
9
+
10
+ def initialize(org: nil, api_key: nil, language: "en")
11
+ @config = Configuration.new
12
+ @config.org = org
13
+ @config.api_key = api_key
14
+ @config.language = language
15
+ end
16
+
17
+ def connection
18
+ @connection ||= build_connection
19
+ end
20
+
21
+ def get(path, params = {})
22
+ params = params.merge(lang: config.language) if config.language
23
+ response = connection.get(path, params)
24
+ handle_response(response)
25
+ end
26
+
27
+ def post(path, params = {})
28
+ params = params.merge(lang: config.language) if config.language
29
+ response = connection.post(path, params)
30
+ handle_response(response)
31
+ end
32
+
33
+ def get_raw(path, params = {})
34
+ params = params.merge(lang: config.language) if config.language
35
+ response = raw_connection.get(path, params)
36
+ handle_raw_response(response)
37
+ end
38
+
39
+ def accounts
40
+ Resources::Account.new(self)
41
+ end
42
+
43
+ def account_categories
44
+ Resources::Account::Category.new(self)
45
+ end
46
+
47
+ def account_cost_centers
48
+ Resources::Account::CostCenter.new(self)
49
+ end
50
+
51
+ def bank_accounts
52
+ Resources::Account::Bank.new(self)
53
+ end
54
+
55
+ def currencies
56
+ Resources::Currency.new(self)
57
+ end
58
+
59
+ def custom_fields
60
+ Resources::CustomField.new(self)
61
+ end
62
+
63
+ def files
64
+ Resources::CashctrlFile.new(self)
65
+ end
66
+
67
+ def file_categories
68
+ Resources::CashctrlFile::Category.new(self)
69
+ end
70
+
71
+ def fiscal_periods
72
+ Resources::FiscalPeriod.new(self)
73
+ end
74
+
75
+ def inventory_articles
76
+ Resources::Inventory::Article.new(self)
77
+ end
78
+
79
+ def inventory_assets
80
+ Resources::Inventory::Asset.new(self)
81
+ end
82
+
83
+ def inventory_units
84
+ Resources::Inventory::Unit.new(self)
85
+ end
86
+
87
+ def journal_entries
88
+ Resources::Journal.new(self)
89
+ end
90
+
91
+ def locations
92
+ Resources::Location.new(self)
93
+ end
94
+
95
+ def orders
96
+ Resources::Order.new(self)
97
+ end
98
+
99
+ def order_categories
100
+ Resources::Order::Category.new(self)
101
+ end
102
+
103
+ def order_documents
104
+ Resources::Order::Document.new(self)
105
+ end
106
+
107
+ def persons
108
+ Resources::Person.new(self)
109
+ end
110
+
111
+ def person_categories
112
+ Resources::Person::Category.new(self)
113
+ end
114
+
115
+ def person_titles
116
+ Resources::Person::Title.new(self)
117
+ end
118
+
119
+ def reports
120
+ Resources::Report.new(self)
121
+ end
122
+
123
+ def roundings
124
+ Resources::Rounding.new(self)
125
+ end
126
+
127
+ def sequence_numbers
128
+ Resources::SequenceNumber.new(self)
129
+ end
130
+
131
+ def settings
132
+ Resources::Setting.new(self)
133
+ end
134
+
135
+ def taxes
136
+ Resources::Tax.new(self)
137
+ end
138
+
139
+ def texts
140
+ Resources::Text.new(self)
141
+ end
142
+
143
+ private
144
+
145
+ def build_connection
146
+ config.validate!
147
+
148
+ Faraday.new(url: config.base_url) do |f|
149
+ f.request :url_encoded
150
+ f.request :authorization, :basic, config.api_key, ""
151
+ f.response :json, content_type: /\bjson$/
152
+ f.adapter Faraday.default_adapter
153
+ end
154
+ end
155
+
156
+ def raw_connection
157
+ @raw_connection ||= begin
158
+ config.validate!
159
+
160
+ Faraday.new(url: config.base_url) do |f|
161
+ f.request :url_encoded
162
+ f.request :authorization, :basic, config.api_key, ""
163
+ f.adapter Faraday.default_adapter
164
+ end
165
+ end
166
+ end
167
+
168
+ def handle_response(response)
169
+ case response.status
170
+ when 200
171
+ handle_success_response(response)
172
+ when 401
173
+ raise AuthenticationError.new("Invalid API key", response: response)
174
+ when 404
175
+ raise NotFoundError.new("Resource not found", response: response)
176
+ when 429
177
+ raise RateLimitError.new("Rate limit exceeded", response: response)
178
+ when 500..599
179
+ raise ServerError.new("Server error: #{response.status}", response: response)
180
+ else
181
+ raise Error.new("Unexpected response: #{response.status}", response: response)
182
+ end
183
+ end
184
+
185
+ def handle_success_response(response)
186
+ body = response.body
187
+
188
+ return body unless body.is_a?(Hash)
189
+
190
+ if body["success"] == false
191
+ errors = body["errors"] || []
192
+ message = body["message"] || errors.map { |e| e["message"] }.join(", ")
193
+ raise ValidationError.new(message, errors: errors, response: response)
194
+ end
195
+
196
+ body
197
+ end
198
+
199
+ def handle_raw_response(response)
200
+ case response.status
201
+ when 200
202
+ response.body
203
+ when 401
204
+ raise AuthenticationError.new("Invalid API key", response: response)
205
+ when 404
206
+ raise NotFoundError.new("Resource not found", response: response)
207
+ when 429
208
+ raise RateLimitError.new("Rate limit exceeded", response: response)
209
+ when 500..599
210
+ raise ServerError.new("Server error: #{response.status}", response: response)
211
+ else
212
+ raise Error.new("Unexpected response: #{response.status}", response: response)
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ class Collection
5
+ include Enumerable
6
+
7
+ attr_reader :data, :total, :summary, :properties, :resource_class
8
+
9
+ def self.from_response(response, resource_class: Resource)
10
+ data = response.is_a?(Array) ? response : (response["data"] || [])
11
+
12
+ new(
13
+ data: data,
14
+ total: response.is_a?(Hash) ? response["total"] : nil,
15
+ summary: response.is_a?(Hash) ? response["summary"] : nil,
16
+ properties: response.is_a?(Hash) ? response["properties"] : nil,
17
+ resource_class: resource_class
18
+ )
19
+ end
20
+
21
+ def initialize(data:, total: nil, summary: nil, properties: nil, resource_class: Resource)
22
+ @resource_class = resource_class
23
+ @data = data.map { |item| resource_class.from_response(item) }
24
+ @total = total || @data.size
25
+ @summary = summary
26
+ @properties = properties
27
+ end
28
+
29
+ def each(&)
30
+ @data.each(&)
31
+ end
32
+
33
+ def size
34
+ @data.size
35
+ end
36
+
37
+ alias length size
38
+ alias count size
39
+
40
+ def empty?
41
+ @data.empty?
42
+ end
43
+
44
+ def first
45
+ @data.first
46
+ end
47
+
48
+ def last
49
+ @data.last
50
+ end
51
+
52
+ def [](index)
53
+ @data[index]
54
+ end
55
+
56
+ def to_a
57
+ @data.dup
58
+ end
59
+
60
+ def to_h
61
+ {
62
+ "data" => @data.map(&:to_h),
63
+ "total" => @total,
64
+ "summary" => @summary,
65
+ "properties" => @properties,
66
+ }
67
+ end
68
+
69
+ def to_json(*)
70
+ to_h.to_json(*)
71
+ end
72
+
73
+ def inspect
74
+ "#<#{self.class.name} total=#{@total} size=#{size} resource_class=#{@resource_class.name}>"
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ class Configuration
5
+ attr_accessor :org, :api_key, :language
6
+
7
+ def initialize
8
+ @org = ENV.fetch("CASHCTRL_ORG", nil)
9
+ @api_key = ENV.fetch("CASHCTRL_API_KEY", nil)
10
+ @language = ENV.fetch("CASHCTRL_LANGUAGE", "en")
11
+ end
12
+
13
+ def base_url
14
+ raise ConfigurationError, "org must be configured" if org.nil? || org.empty?
15
+
16
+ "https://#{org}.cashctrl.com/api/v1"
17
+ end
18
+
19
+ def valid?
20
+ !org.nil? && !org.empty? && !api_key.nil? && !api_key.empty?
21
+ end
22
+
23
+ def validate! # rubocop:disable Naming/PredicateMethod
24
+ raise ConfigurationError, "org must be configured" if org.nil? || org.empty?
25
+ raise ConfigurationError, "api_key must be configured" if api_key.nil? || api_key.empty?
26
+
27
+ true
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cashctrl
4
+ class Error < StandardError
5
+ attr_reader :response
6
+
7
+ def initialize(message = nil, response: nil)
8
+ @response = response
9
+ super(message)
10
+ end
11
+ end
12
+
13
+ class ConfigurationError < Error; end
14
+ class AuthenticationError < Error; end
15
+ class NotFoundError < Error; end
16
+ class RateLimitError < Error; end
17
+ class ServerError < Error; end
18
+
19
+ class ValidationError < Error
20
+ attr_reader :errors
21
+
22
+ def initialize(message = nil, errors: [], response: nil)
23
+ @errors = errors
24
+ super(message, response: response)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rexml/document"
4
+
5
+ module Cashctrl
6
+ class LocalizedString
7
+ LOCALIZED_PATTERN = %r{<values>.*?</values>}m
8
+
9
+ attr_reader :translations, :raw, :prefix
10
+
11
+ def self.localized?(value)
12
+ return false unless value.is_a?(String)
13
+
14
+ value.match?(LOCALIZED_PATTERN)
15
+ end
16
+
17
+ def self.parse(value)
18
+ return value unless localized?(value)
19
+
20
+ new(value)
21
+ end
22
+
23
+ def initialize(xml_string)
24
+ @translations = {}
25
+ @raw = xml_string
26
+ @prefix = ""
27
+
28
+ parse_xml(xml_string)
29
+ end
30
+
31
+ def [](locale)
32
+ value = @translations[locale.to_s.downcase]
33
+ return nil unless value
34
+
35
+ @prefix.empty? ? value : "#{@prefix}#{value}"
36
+ end
37
+
38
+ def to_s
39
+ current_locale = if defined?(I18n) && I18n.respond_to?(:locale)
40
+ I18n.locale.to_s.downcase
41
+ else
42
+ Cashctrl.configuration&.language&.downcase || "en"
43
+ end
44
+
45
+ value = @translations[current_locale] || @translations["en"] || @translations.values.first
46
+ return @raw unless value
47
+
48
+ @prefix.empty? ? value : "#{@prefix}#{value}"
49
+ end
50
+
51
+ def to_h
52
+ @translations.dup
53
+ end
54
+
55
+ def inspect
56
+ if @prefix.empty?
57
+ "#<#{self.class.name} #{@translations.inspect}>"
58
+ else
59
+ "#<#{self.class.name} prefix=#{@prefix.inspect} #{@translations.inspect}>"
60
+ end
61
+ end
62
+
63
+ def ==(other)
64
+ case other
65
+ when LocalizedString
66
+ @translations == other.translations
67
+ when String
68
+ to_s == other
69
+ else
70
+ false
71
+ end
72
+ end
73
+
74
+ alias eql? ==
75
+
76
+ def hash
77
+ @translations.hash
78
+ end
79
+
80
+ def method_missing(method_name, *args)
81
+ locale = method_name.to_s.downcase
82
+
83
+ if @translations.key?(locale)
84
+ value = @translations[locale]
85
+ @prefix.empty? ? value : "#{@prefix}#{value}"
86
+ else
87
+ super
88
+ end
89
+ end
90
+
91
+ def respond_to_missing?(method_name, include_private = false)
92
+ @translations.key?(method_name.to_s.downcase) || super
93
+ end
94
+
95
+ private
96
+
97
+ def parse_xml(xml_string)
98
+ match = xml_string.match(LOCALIZED_PATTERN)
99
+
100
+ return unless match
101
+
102
+ @prefix = xml_string[0...match.begin(0)]
103
+ values_xml = match[0]
104
+
105
+ doc = REXML::Document.new(values_xml)
106
+
107
+ doc.root&.elements&.each do |element|
108
+ locale = element.name.downcase
109
+ @translations[locale] = element.text || ""
110
+ end
111
+ rescue REXML::ParseException
112
+ @translations["raw"] = xml_string
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,35 @@
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 Account < Resource
8
+ attribute :category_id, type: :integer
9
+ attribute :category_display, type: :string, readonly: true
10
+ attribute :account_class, type: :string
11
+ attribute :tax_id, type: :integer
12
+ attribute :tax_name, type: :string, readonly: true
13
+ attribute :currency_id, type: :integer
14
+ attribute :currency_code, type: :string
15
+ attribute :number, type: :string
16
+ attribute :name, type: :string
17
+ attribute :custom, type: :string
18
+ attribute :notes, type: :string
19
+ attribute :attachment_count, type: :integer, readonly: true
20
+ attribute :allocation_count, type: :integer, readonly: true
21
+ attribute :cost_center_ids, type: :string
22
+ attribute :cost_center_numbers, type: :string, readonly: true
23
+ attribute :opening_amount, type: :decimal
24
+ attribute :end_amount, type: :decimal, readonly: true
25
+ attribute :target_min, type: :decimal
26
+ attribute :target_max, type: :decimal
27
+ attribute :target_display, type: :string, readonly: true
28
+ attribute :default_currency_opening_amount, type: :decimal, readonly: true
29
+ attribute :default_currency_end_amount, type: :decimal, readonly: true
30
+ attribute :is_inactive, type: :boolean
31
+ attribute :is_in_salary_type, type: :boolean, readonly: true
32
+ attribute :is_bank_account, type: :boolean, readonly: true
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,40 @@
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 Article < Resource
8
+ attribute :category_id, type: :integer
9
+ attribute :category_name, type: :string, readonly: true
10
+ attribute :nr, type: :string
11
+ attribute :name, type: :string
12
+ attribute :description, type: :string
13
+ attribute :unit_id, type: :integer
14
+ attribute :unit_name, type: :string, readonly: true
15
+ attribute :unit_price, type: :decimal
16
+ attribute :sales_account_id, type: :integer
17
+ attribute :sales_account_name, type: :string, readonly: true
18
+ attribute :purchase_account_id, type: :integer
19
+ attribute :purchase_account_name, type: :string, readonly: true
20
+ attribute :sales_tax_id, type: :integer
21
+ attribute :sales_tax_name, type: :string, readonly: true
22
+ attribute :purchase_tax_id, type: :integer
23
+ attribute :purchase_tax_name, type: :string, readonly: true
24
+ attribute :currency_id, type: :integer
25
+ attribute :currency_code, type: :string, readonly: true
26
+ attribute :last_purchase_price, type: :decimal, readonly: true
27
+ attribute :last_sales_price, type: :decimal, readonly: true
28
+ attribute :bin_location, type: :string
29
+ attribute :stock, type: :decimal
30
+ attribute :min_stock, type: :decimal
31
+ attribute :custom, type: :string
32
+ attribute :notes, type: :string
33
+ attribute :attachment_count, type: :integer, readonly: true
34
+ attribute :is_stock_article, type: :boolean
35
+ attribute :is_purchase_price_gross, type: :boolean
36
+ attribute :is_sales_price_gross, type: :boolean
37
+ attribute :is_inactive, type: :boolean
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,32 @@
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 Asset < Resource
8
+ attribute :category_id, type: :integer
9
+ attribute :category_name, type: :string, readonly: true
10
+ attribute :nr, type: :string
11
+ attribute :name, type: :string
12
+ attribute :date_acquired, type: :date
13
+ attribute :value_acquisition, type: :decimal
14
+ attribute :value_current, type: :decimal, readonly: true
15
+ attribute :value_depreciation, type: :decimal, readonly: true
16
+ attribute :value_salvage, type: :decimal
17
+ attribute :depreciation_type, type: :string
18
+ attribute :depreciation_rate, type: :decimal
19
+ attribute :useful_life, type: :integer
20
+ attribute :account_asset_id, type: :integer
21
+ attribute :account_asset_name, type: :string, readonly: true
22
+ attribute :account_depreciation_id, type: :integer
23
+ attribute :account_depreciation_name, type: :string, readonly: true
24
+ attribute :account_expense_id, type: :integer
25
+ attribute :account_expense_name, type: :string, readonly: true
26
+ attribute :custom, type: :string
27
+ attribute :notes, type: :string
28
+ attribute :attachment_count, type: :integer, readonly: true
29
+ attribute :is_inactive, type: :boolean
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,16 @@
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 Bank < Resource
8
+ attribute :account_id, type: :integer
9
+ attribute :account_name, type: :string, readonly: true
10
+ attribute :name, type: :string
11
+ attribute :iban, type: :string
12
+ attribute :bic, type: :string
13
+ attribute :qr_iban, type: :string
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
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 Category < Resource
8
+ attribute :parent_id, type: :integer
9
+ attribute :name, type: :string
10
+ attribute :sequence, type: :integer
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
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 CertificateDocument < Resource
8
+ attribute :certificate_id, type: :integer
9
+ attribute :layout_id, type: :integer
10
+ attribute :name, type: :string
11
+ attribute :file_id, type: :integer, readonly: true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
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 CertificateTemplate < Resource
8
+ attribute :name, type: :string
9
+ attribute :year, type: :integer
10
+ attribute :fields, type: :json
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
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 CostCenter < Resource
8
+ attribute :category_id, type: :integer
9
+ attribute :category_name, type: :string, readonly: true
10
+ attribute :number, type: :string
11
+ attribute :name, type: :string
12
+ attribute :notes, type: :string
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
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 Currency < Resource
8
+ attribute :code, type: :string
9
+ attribute :description, type: :string
10
+ attribute :rate, type: :decimal
11
+ attribute :value, type: :string, readonly: true
12
+ attribute :index, type: :string, readonly: true
13
+ attribute :text, type: :string, readonly: true
14
+ attribute :is_default, type: :boolean
15
+ attribute :is_auto, type: :boolean
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
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 CustomField < Resource
8
+ attribute :type, type: :string
9
+ attribute :group_id, type: :integer
10
+ attribute :group_name, type: :string, readonly: true
11
+ attribute :name, type: :string
12
+ attribute :description, type: :string
13
+ attribute :data_type, type: :string
14
+ attribute :values, type: :string
15
+ attribute :is_multi, type: :boolean
16
+ end
17
+ end
18
+ end