merge_ruby_client 1.1.0 → 2.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.
- checksums.yaml +4 -4
- data/lib/merge_ruby_client/accounting/accounts/client.rb +16 -8
- data/lib/merge_ruby_client/accounting/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/accounting/client.rb +7 -0
- data/lib/merge_ruby_client/accounting/contacts/client.rb +14 -6
- data/lib/merge_ruby_client/accounting/expenses/client.rb +12 -4
- data/lib/merge_ruby_client/accounting/invoices/client.rb +12 -4
- data/lib/merge_ruby_client/accounting/items/client.rb +332 -0
- data/lib/merge_ruby_client/accounting/journal_entries/client.rb +12 -4
- data/lib/merge_ruby_client/accounting/payments/client.rb +12 -4
- data/lib/merge_ruby_client/accounting/projects/client.rb +224 -0
- data/lib/merge_ruby_client/accounting/projects/types/projects_list_request_expand.rb +13 -0
- data/lib/merge_ruby_client/accounting/projects/types/projects_retrieve_request_expand.rb +13 -0
- data/lib/merge_ruby_client/accounting/purchase_orders/client.rb +12 -4
- data/lib/merge_ruby_client/accounting/tracking_categories/client.rb +16 -8
- data/lib/merge_ruby_client/accounting/types/account_details_and_actions.rb +10 -2
- data/lib/merge_ruby_client/accounting/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item_contact.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request_contact.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/event_type_enum.rb +2 -0
- data/lib/merge_ruby_client/accounting/types/expense_line.rb +15 -1
- data/lib/merge_ruby_client/accounting/types/expense_line_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_line_request.rb +15 -1
- data/lib/merge_ruby_client/accounting/types/expense_line_request_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb +12 -1
- data/lib/merge_ruby_client/accounting/types/field_mapping_api_instance_response.rb +12 -1
- data/lib/merge_ruby_client/accounting/types/general_ledger_transaction_line.rb +15 -1
- data/lib/merge_ruby_client/accounting/types/general_ledger_transaction_line_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/invoice_line_item.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/invoice_line_item_contact.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/invoice_line_item_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/invoice_line_item_request.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/invoice_line_item_request_contact.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/invoice_line_item_request_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request.rb +202 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request_purchase_account.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request_purchase_tax_rate.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request_sales_account.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/item_request_request_sales_tax_rate.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/item_response.rb +101 -0
- data/lib/merge_ruby_client/accounting/types/journal_line.rb +15 -1
- data/lib/merge_ruby_client/accounting/types/journal_line_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/journal_line_request.rb +15 -1
- data/lib/merge_ruby_client/accounting/types/journal_line_request_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/paginated_project_list.rb +80 -0
- data/lib/merge_ruby_client/accounting/types/patched_item_request_request.rb +172 -0
- data/lib/merge_ruby_client/accounting/types/project.rb +162 -0
- data/lib/merge_ruby_client/accounting/types/project_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/project_contact.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/remote_field_api_response.rb +12 -1
- data/lib/merge_ruby_client/accounting/types/type_2_bb_enum.rb +16 -0
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line_contact.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb +29 -1
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request_contact.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request_project.rb +55 -0
- data/lib/merge_ruby_client/ats/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/ats/types/account_details_and_actions.rb +10 -2
- data/lib/merge_ruby_client/ats/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/ats/types/event_type_enum.rb +1 -0
- data/lib/merge_ruby_client/crm/accounts/client.rb +6 -2
- data/lib/merge_ruby_client/crm/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/crm/contacts/client.rb +6 -2
- data/lib/merge_ruby_client/crm/custom_objects/client.rb +10 -2
- data/lib/merge_ruby_client/crm/engagement_types/client.rb +6 -2
- data/lib/merge_ruby_client/crm/engagements/client.rb +6 -2
- data/lib/merge_ruby_client/crm/leads/client.rb +6 -2
- data/lib/merge_ruby_client/crm/notes/client.rb +6 -2
- data/lib/merge_ruby_client/crm/opportunities/client.rb +6 -2
- data/lib/merge_ruby_client/crm/stages/client.rb +6 -2
- data/lib/merge_ruby_client/crm/sync_status/client.rb +20 -6
- data/lib/merge_ruby_client/crm/tasks/client.rb +6 -2
- data/lib/merge_ruby_client/crm/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/crm/types/custom_object_request.rb +26 -3
- data/lib/merge_ruby_client/crm/types/event_type_enum.rb +2 -0
- data/lib/merge_ruby_client/crm/users/client.rb +6 -2
- data/lib/merge_ruby_client/filestorage/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/filestorage/files/client.rb +48 -12
- data/lib/merge_ruby_client/filestorage/files/types/files_download_request_meta_list_request_order_by.rb +14 -0
- data/lib/merge_ruby_client/filestorage/files/types/files_list_request_order_by.rb +14 -0
- data/lib/merge_ruby_client/filestorage/sync_status/client.rb +20 -6
- data/lib/merge_ruby_client/filestorage/types/account_details_and_actions.rb +10 -2
- data/lib/merge_ruby_client/filestorage/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/filestorage/types/download_request_meta.rb +2 -9
- data/lib/merge_ruby_client/filestorage/types/event_type_enum.rb +2 -0
- data/lib/merge_ruby_client/filestorage/types/file.rb +13 -1
- data/lib/merge_ruby_client/filestorage/types/file_request.rb +13 -1
- data/lib/merge_ruby_client/hris/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/hris/types/account_details_and_actions.rb +10 -2
- data/lib/merge_ruby_client/hris/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/hris/types/event_type_enum.rb +2 -0
- data/lib/merge_ruby_client/ticketing/audit_trail/client.rb +6 -4
- data/lib/merge_ruby_client/ticketing/tickets/client.rb +26 -10
- data/lib/merge_ruby_client/ticketing/types/account_details_and_actions.rb +10 -2
- data/lib/merge_ruby_client/ticketing/types/audit_log_event.rb +2 -0
- data/lib/merge_ruby_client/ticketing/types/collection.rb +18 -16
- data/lib/merge_ruby_client/ticketing/types/{access_level_enum.rb → collection_access_level_enum.rb} +3 -1
- data/lib/merge_ruby_client/ticketing/types/event_type_enum.rb +2 -0
- data/lib/merge_ruby_client/ticketing/types/patched_ticket_request.rb +20 -1
- data/lib/merge_ruby_client/ticketing/types/ticket.rb +20 -1
- data/lib/merge_ruby_client/ticketing/types/ticket_access_level_enum.rb +16 -0
- data/lib/merge_ruby_client/ticketing/types/ticket_request.rb +20 -1
- data/lib/merge_ruby_client.rb +7 -7
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +243 -208
- metadata +39 -3
@@ -0,0 +1,202 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "status_7_d_1_enum"
|
4
|
+
require_relative "type_2_bb_enum"
|
5
|
+
require_relative "item_request_request_purchase_account"
|
6
|
+
require_relative "item_request_request_sales_account"
|
7
|
+
require_relative "item_request_request_company"
|
8
|
+
require_relative "item_request_request_purchase_tax_rate"
|
9
|
+
require_relative "item_request_request_sales_tax_rate"
|
10
|
+
require "ostruct"
|
11
|
+
require "json"
|
12
|
+
|
13
|
+
module Merge
|
14
|
+
module Accounting
|
15
|
+
# # The Item Object
|
16
|
+
# ### Description
|
17
|
+
# The `Item` object refers to the goods involved in a transaction.
|
18
|
+
# ### Usage Example
|
19
|
+
# Fetch from the `LIST Items` endpoint and view a company's items.
|
20
|
+
class ItemRequestRequest
|
21
|
+
# @return [String] The item's name.
|
22
|
+
attr_reader :name
|
23
|
+
# @return [Merge::Accounting::Status7D1Enum] The item's status.
|
24
|
+
# * `ACTIVE` - ACTIVE
|
25
|
+
# * `ARCHIVED` - ARCHIVED
|
26
|
+
attr_reader :status
|
27
|
+
# @return [Merge::Accounting::Type2BbEnum] The item's type.
|
28
|
+
# * `INVENTORY` - INVENTORY
|
29
|
+
# * `NON_INVENTORY` - NON_INVENTORY
|
30
|
+
# * `SERVICE` - SERVICE
|
31
|
+
# * `UNKNOWN` - UNKNOWN
|
32
|
+
attr_reader :type
|
33
|
+
# @return [Float] The item's unit price.
|
34
|
+
attr_reader :unit_price
|
35
|
+
# @return [Float] The price at which the item is purchased from a vendor.
|
36
|
+
attr_reader :purchase_price
|
37
|
+
# @return [Merge::Accounting::ItemRequestRequestPurchaseAccount] References the default account used to record a purchase of the item.
|
38
|
+
attr_reader :purchase_account
|
39
|
+
# @return [Merge::Accounting::ItemRequestRequestSalesAccount] References the default account used to record a sale.
|
40
|
+
attr_reader :sales_account
|
41
|
+
# @return [Merge::Accounting::ItemRequestRequestCompany] The company the item belongs to.
|
42
|
+
attr_reader :company
|
43
|
+
# @return [Merge::Accounting::ItemRequestRequestPurchaseTaxRate] The default purchase tax rate for this item.
|
44
|
+
attr_reader :purchase_tax_rate
|
45
|
+
# @return [Merge::Accounting::ItemRequestRequestSalesTaxRate] The default sales tax rate for this item.
|
46
|
+
attr_reader :sales_tax_rate
|
47
|
+
# @return [Hash{String => Object}]
|
48
|
+
attr_reader :integration_params
|
49
|
+
# @return [Hash{String => Object}]
|
50
|
+
attr_reader :linked_account_params
|
51
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
52
|
+
attr_reader :additional_properties
|
53
|
+
# @return [Object]
|
54
|
+
attr_reader :_field_set
|
55
|
+
protected :_field_set
|
56
|
+
|
57
|
+
OMIT = Object.new
|
58
|
+
|
59
|
+
# @param name [String] The item's name.
|
60
|
+
# @param status [Merge::Accounting::Status7D1Enum] The item's status.
|
61
|
+
# * `ACTIVE` - ACTIVE
|
62
|
+
# * `ARCHIVED` - ARCHIVED
|
63
|
+
# @param type [Merge::Accounting::Type2BbEnum] The item's type.
|
64
|
+
# * `INVENTORY` - INVENTORY
|
65
|
+
# * `NON_INVENTORY` - NON_INVENTORY
|
66
|
+
# * `SERVICE` - SERVICE
|
67
|
+
# * `UNKNOWN` - UNKNOWN
|
68
|
+
# @param unit_price [Float] The item's unit price.
|
69
|
+
# @param purchase_price [Float] The price at which the item is purchased from a vendor.
|
70
|
+
# @param purchase_account [Merge::Accounting::ItemRequestRequestPurchaseAccount] References the default account used to record a purchase of the item.
|
71
|
+
# @param sales_account [Merge::Accounting::ItemRequestRequestSalesAccount] References the default account used to record a sale.
|
72
|
+
# @param company [Merge::Accounting::ItemRequestRequestCompany] The company the item belongs to.
|
73
|
+
# @param purchase_tax_rate [Merge::Accounting::ItemRequestRequestPurchaseTaxRate] The default purchase tax rate for this item.
|
74
|
+
# @param sales_tax_rate [Merge::Accounting::ItemRequestRequestSalesTaxRate] The default sales tax rate for this item.
|
75
|
+
# @param integration_params [Hash{String => Object}]
|
76
|
+
# @param linked_account_params [Hash{String => Object}]
|
77
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
78
|
+
# @return [Merge::Accounting::ItemRequestRequest]
|
79
|
+
def initialize(name: OMIT, status: OMIT, type: OMIT, unit_price: OMIT, purchase_price: OMIT,
|
80
|
+
purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil)
|
81
|
+
@name = name if name != OMIT
|
82
|
+
@status = status if status != OMIT
|
83
|
+
@type = type if type != OMIT
|
84
|
+
@unit_price = unit_price if unit_price != OMIT
|
85
|
+
@purchase_price = purchase_price if purchase_price != OMIT
|
86
|
+
@purchase_account = purchase_account if purchase_account != OMIT
|
87
|
+
@sales_account = sales_account if sales_account != OMIT
|
88
|
+
@company = company if company != OMIT
|
89
|
+
@purchase_tax_rate = purchase_tax_rate if purchase_tax_rate != OMIT
|
90
|
+
@sales_tax_rate = sales_tax_rate if sales_tax_rate != OMIT
|
91
|
+
@integration_params = integration_params if integration_params != OMIT
|
92
|
+
@linked_account_params = linked_account_params if linked_account_params != OMIT
|
93
|
+
@additional_properties = additional_properties
|
94
|
+
@_field_set = {
|
95
|
+
"name": name,
|
96
|
+
"status": status,
|
97
|
+
"type": type,
|
98
|
+
"unit_price": unit_price,
|
99
|
+
"purchase_price": purchase_price,
|
100
|
+
"purchase_account": purchase_account,
|
101
|
+
"sales_account": sales_account,
|
102
|
+
"company": company,
|
103
|
+
"purchase_tax_rate": purchase_tax_rate,
|
104
|
+
"sales_tax_rate": sales_tax_rate,
|
105
|
+
"integration_params": integration_params,
|
106
|
+
"linked_account_params": linked_account_params
|
107
|
+
}.reject do |_k, v|
|
108
|
+
v == OMIT
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Deserialize a JSON object to an instance of ItemRequestRequest
|
113
|
+
#
|
114
|
+
# @param json_object [String]
|
115
|
+
# @return [Merge::Accounting::ItemRequestRequest]
|
116
|
+
def self.from_json(json_object:)
|
117
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
118
|
+
parsed_json = JSON.parse(json_object)
|
119
|
+
name = parsed_json["name"]
|
120
|
+
status = parsed_json["status"]
|
121
|
+
type = parsed_json["type"]
|
122
|
+
unit_price = parsed_json["unit_price"]
|
123
|
+
purchase_price = parsed_json["purchase_price"]
|
124
|
+
if parsed_json["purchase_account"].nil?
|
125
|
+
purchase_account = nil
|
126
|
+
else
|
127
|
+
purchase_account = parsed_json["purchase_account"].to_json
|
128
|
+
purchase_account = Merge::Accounting::ItemRequestRequestPurchaseAccount.from_json(json_object: purchase_account)
|
129
|
+
end
|
130
|
+
if parsed_json["sales_account"].nil?
|
131
|
+
sales_account = nil
|
132
|
+
else
|
133
|
+
sales_account = parsed_json["sales_account"].to_json
|
134
|
+
sales_account = Merge::Accounting::ItemRequestRequestSalesAccount.from_json(json_object: sales_account)
|
135
|
+
end
|
136
|
+
if parsed_json["company"].nil?
|
137
|
+
company = nil
|
138
|
+
else
|
139
|
+
company = parsed_json["company"].to_json
|
140
|
+
company = Merge::Accounting::ItemRequestRequestCompany.from_json(json_object: company)
|
141
|
+
end
|
142
|
+
if parsed_json["purchase_tax_rate"].nil?
|
143
|
+
purchase_tax_rate = nil
|
144
|
+
else
|
145
|
+
purchase_tax_rate = parsed_json["purchase_tax_rate"].to_json
|
146
|
+
purchase_tax_rate = Merge::Accounting::ItemRequestRequestPurchaseTaxRate.from_json(json_object: purchase_tax_rate)
|
147
|
+
end
|
148
|
+
if parsed_json["sales_tax_rate"].nil?
|
149
|
+
sales_tax_rate = nil
|
150
|
+
else
|
151
|
+
sales_tax_rate = parsed_json["sales_tax_rate"].to_json
|
152
|
+
sales_tax_rate = Merge::Accounting::ItemRequestRequestSalesTaxRate.from_json(json_object: sales_tax_rate)
|
153
|
+
end
|
154
|
+
integration_params = parsed_json["integration_params"]
|
155
|
+
linked_account_params = parsed_json["linked_account_params"]
|
156
|
+
new(
|
157
|
+
name: name,
|
158
|
+
status: status,
|
159
|
+
type: type,
|
160
|
+
unit_price: unit_price,
|
161
|
+
purchase_price: purchase_price,
|
162
|
+
purchase_account: purchase_account,
|
163
|
+
sales_account: sales_account,
|
164
|
+
company: company,
|
165
|
+
purchase_tax_rate: purchase_tax_rate,
|
166
|
+
sales_tax_rate: sales_tax_rate,
|
167
|
+
integration_params: integration_params,
|
168
|
+
linked_account_params: linked_account_params,
|
169
|
+
additional_properties: struct
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Serialize an instance of ItemRequestRequest to a JSON object
|
174
|
+
#
|
175
|
+
# @return [String]
|
176
|
+
def to_json(*_args)
|
177
|
+
@_field_set&.to_json
|
178
|
+
end
|
179
|
+
|
180
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
181
|
+
# hash and check each fields type against the current object's property
|
182
|
+
# definitions.
|
183
|
+
#
|
184
|
+
# @param obj [Object]
|
185
|
+
# @return [Void]
|
186
|
+
def self.validate_raw(obj:)
|
187
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
188
|
+
obj.status&.is_a?(Merge::Accounting::Status7D1Enum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
189
|
+
obj.type&.is_a?(Merge::Accounting::Type2BbEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
190
|
+
obj.unit_price&.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.")
|
191
|
+
obj.purchase_price&.is_a?(Float) != false || raise("Passed value for field obj.purchase_price is not the expected type, validation failed.")
|
192
|
+
obj.purchase_account.nil? || Merge::Accounting::ItemRequestRequestPurchaseAccount.validate_raw(obj: obj.purchase_account)
|
193
|
+
obj.sales_account.nil? || Merge::Accounting::ItemRequestRequestSalesAccount.validate_raw(obj: obj.sales_account)
|
194
|
+
obj.company.nil? || Merge::Accounting::ItemRequestRequestCompany.validate_raw(obj: obj.company)
|
195
|
+
obj.purchase_tax_rate.nil? || Merge::Accounting::ItemRequestRequestPurchaseTaxRate.validate_raw(obj: obj.purchase_tax_rate)
|
196
|
+
obj.sales_tax_rate.nil? || Merge::Accounting::ItemRequestRequestSalesTaxRate.validate_raw(obj: obj.sales_tax_rate)
|
197
|
+
obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.")
|
198
|
+
obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.")
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "company_info"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# The company the item belongs to.
|
9
|
+
class ItemRequestRequestCompany
|
10
|
+
# Deserialize a JSON object to an instance of ItemRequestRequestCompany
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ItemRequestRequestCompany]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
18
|
+
return struct unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Merge::Accounting::CompanyInfo.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::CompanyInfo.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
struct
|
33
|
+
end
|
34
|
+
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
begin
|
43
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
44
|
+
rescue StandardError
|
45
|
+
# noop
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
return Merge::Accounting::CompanyInfo.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
raise("Passed value matched no type within the union, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "account"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# References the default account used to record a purchase of the item.
|
9
|
+
class ItemRequestRequestPurchaseAccount
|
10
|
+
# Deserialize a JSON object to an instance of ItemRequestRequestPurchaseAccount
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ItemRequestRequestPurchaseAccount]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
18
|
+
return struct unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Merge::Accounting::Account.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::Account.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
struct
|
33
|
+
end
|
34
|
+
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
begin
|
43
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
44
|
+
rescue StandardError
|
45
|
+
# noop
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
return Merge::Accounting::Account.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
raise("Passed value matched no type within the union, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "tax_rate"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# The default purchase tax rate for this item.
|
9
|
+
class ItemRequestRequestPurchaseTaxRate
|
10
|
+
# Deserialize a JSON object to an instance of ItemRequestRequestPurchaseTaxRate
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ItemRequestRequestPurchaseTaxRate]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
18
|
+
return struct unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Merge::Accounting::TaxRate.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::TaxRate.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
struct
|
33
|
+
end
|
34
|
+
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
begin
|
43
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
44
|
+
rescue StandardError
|
45
|
+
# noop
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
return Merge::Accounting::TaxRate.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
raise("Passed value matched no type within the union, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "account"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# References the default account used to record a sale.
|
9
|
+
class ItemRequestRequestSalesAccount
|
10
|
+
# Deserialize a JSON object to an instance of ItemRequestRequestSalesAccount
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ItemRequestRequestSalesAccount]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
18
|
+
return struct unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Merge::Accounting::Account.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::Account.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
struct
|
33
|
+
end
|
34
|
+
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
begin
|
43
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
44
|
+
rescue StandardError
|
45
|
+
# noop
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
return Merge::Accounting::Account.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
raise("Passed value matched no type within the union, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "tax_rate"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# The default sales tax rate for this item.
|
9
|
+
class ItemRequestRequestSalesTaxRate
|
10
|
+
# Deserialize a JSON object to an instance of ItemRequestRequestSalesTaxRate
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ItemRequestRequestSalesTaxRate]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
18
|
+
return struct unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Merge::Accounting::TaxRate.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::TaxRate.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
struct
|
33
|
+
end
|
34
|
+
|
35
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
36
|
+
# hash and check each fields type against the current object's property
|
37
|
+
# definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
begin
|
43
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
44
|
+
rescue StandardError
|
45
|
+
# noop
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
return Merge::Accounting::TaxRate.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
raise("Passed value matched no type within the union, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "item"
|
4
|
+
require_relative "warning_validation_problem"
|
5
|
+
require_relative "error_validation_problem"
|
6
|
+
require_relative "debug_mode_log"
|
7
|
+
require "ostruct"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Merge
|
11
|
+
module Accounting
|
12
|
+
class ItemResponse
|
13
|
+
# @return [Merge::Accounting::Item]
|
14
|
+
attr_reader :model
|
15
|
+
# @return [Array<Merge::Accounting::WarningValidationProblem>]
|
16
|
+
attr_reader :warnings
|
17
|
+
# @return [Array<Merge::Accounting::ErrorValidationProblem>]
|
18
|
+
attr_reader :errors
|
19
|
+
# @return [Array<Merge::Accounting::DebugModeLog>]
|
20
|
+
attr_reader :logs
|
21
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
attr_reader :additional_properties
|
23
|
+
# @return [Object]
|
24
|
+
attr_reader :_field_set
|
25
|
+
protected :_field_set
|
26
|
+
|
27
|
+
OMIT = Object.new
|
28
|
+
|
29
|
+
# @param model [Merge::Accounting::Item]
|
30
|
+
# @param warnings [Array<Merge::Accounting::WarningValidationProblem>]
|
31
|
+
# @param errors [Array<Merge::Accounting::ErrorValidationProblem>]
|
32
|
+
# @param logs [Array<Merge::Accounting::DebugModeLog>]
|
33
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
# @return [Merge::Accounting::ItemResponse]
|
35
|
+
def initialize(model:, warnings:, errors:, logs: OMIT, additional_properties: nil)
|
36
|
+
@model = model
|
37
|
+
@warnings = warnings
|
38
|
+
@errors = errors
|
39
|
+
@logs = logs if logs != OMIT
|
40
|
+
@additional_properties = additional_properties
|
41
|
+
@_field_set = { "model": model, "warnings": warnings, "errors": errors, "logs": logs }.reject do |_k, v|
|
42
|
+
v == OMIT
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Deserialize a JSON object to an instance of ItemResponse
|
47
|
+
#
|
48
|
+
# @param json_object [String]
|
49
|
+
# @return [Merge::Accounting::ItemResponse]
|
50
|
+
def self.from_json(json_object:)
|
51
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
52
|
+
parsed_json = JSON.parse(json_object)
|
53
|
+
if parsed_json["model"].nil?
|
54
|
+
model = nil
|
55
|
+
else
|
56
|
+
model = parsed_json["model"].to_json
|
57
|
+
model = Merge::Accounting::Item.from_json(json_object: model)
|
58
|
+
end
|
59
|
+
warnings = parsed_json["warnings"]&.map do |item|
|
60
|
+
item = item.to_json
|
61
|
+
Merge::Accounting::WarningValidationProblem.from_json(json_object: item)
|
62
|
+
end
|
63
|
+
errors = parsed_json["errors"]&.map do |item|
|
64
|
+
item = item.to_json
|
65
|
+
Merge::Accounting::ErrorValidationProblem.from_json(json_object: item)
|
66
|
+
end
|
67
|
+
logs = parsed_json["logs"]&.map do |item|
|
68
|
+
item = item.to_json
|
69
|
+
Merge::Accounting::DebugModeLog.from_json(json_object: item)
|
70
|
+
end
|
71
|
+
new(
|
72
|
+
model: model,
|
73
|
+
warnings: warnings,
|
74
|
+
errors: errors,
|
75
|
+
logs: logs,
|
76
|
+
additional_properties: struct
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Serialize an instance of ItemResponse to a JSON object
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
def to_json(*_args)
|
84
|
+
@_field_set&.to_json
|
85
|
+
end
|
86
|
+
|
87
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
88
|
+
# hash and check each fields type against the current object's property
|
89
|
+
# definitions.
|
90
|
+
#
|
91
|
+
# @param obj [Object]
|
92
|
+
# @return [Void]
|
93
|
+
def self.validate_raw(obj:)
|
94
|
+
Merge::Accounting::Item.validate_raw(obj: obj.model)
|
95
|
+
obj.warnings.is_a?(Array) != false || raise("Passed value for field obj.warnings is not the expected type, validation failed.")
|
96
|
+
obj.errors.is_a?(Array) != false || raise("Passed value for field obj.errors is not the expected type, validation failed.")
|
97
|
+
obj.logs&.is_a?(Array) != false || raise("Passed value for field obj.logs is not the expected type, validation failed.")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -5,6 +5,7 @@ require_relative "journal_line_account"
|
|
5
5
|
require_relative "journal_line_tracking_category"
|
6
6
|
require_relative "journal_line_tracking_categories_item"
|
7
7
|
require_relative "transaction_currency_enum"
|
8
|
+
require_relative "journal_line_project"
|
8
9
|
require_relative "remote_field"
|
9
10
|
require "ostruct"
|
10
11
|
require "json"
|
@@ -346,6 +347,8 @@ module Merge
|
|
346
347
|
attr_reader :company
|
347
348
|
# @return [String]
|
348
349
|
attr_reader :employee
|
350
|
+
# @return [Merge::Accounting::JournalLineProject]
|
351
|
+
attr_reader :project
|
349
352
|
# @return [String]
|
350
353
|
attr_reader :contact
|
351
354
|
# @return [String] The tax rate that applies to this line item.
|
@@ -686,6 +689,7 @@ module Merge
|
|
686
689
|
# * `ZWL` - Zimbabwean Dollar (2009)
|
687
690
|
# @param company [String] The company the journal entry belongs to.
|
688
691
|
# @param employee [String]
|
692
|
+
# @param project [Merge::Accounting::JournalLineProject]
|
689
693
|
# @param contact [String]
|
690
694
|
# @param tax_rate [String] The tax rate that applies to this line item.
|
691
695
|
# @param description [String] The line's description.
|
@@ -698,7 +702,7 @@ module Merge
|
|
698
702
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
699
703
|
# @return [Merge::Accounting::JournalLine]
|
700
704
|
def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, account: OMIT, net_amount: OMIT,
|
701
|
-
tracking_category: OMIT, tracking_categories: OMIT, currency: OMIT, company: OMIT, employee: OMIT, contact: OMIT, tax_rate: OMIT, description: OMIT, exchange_rate: OMIT, remote_was_deleted: OMIT, remote_fields: OMIT, additional_properties: nil)
|
705
|
+
tracking_category: OMIT, tracking_categories: OMIT, currency: OMIT, company: OMIT, employee: OMIT, project: OMIT, contact: OMIT, tax_rate: OMIT, description: OMIT, exchange_rate: OMIT, remote_was_deleted: OMIT, remote_fields: OMIT, additional_properties: nil)
|
702
706
|
@id = id if id != OMIT
|
703
707
|
@remote_id = remote_id if remote_id != OMIT
|
704
708
|
@created_at = created_at if created_at != OMIT
|
@@ -710,6 +714,7 @@ module Merge
|
|
710
714
|
@currency = currency if currency != OMIT
|
711
715
|
@company = company if company != OMIT
|
712
716
|
@employee = employee if employee != OMIT
|
717
|
+
@project = project if project != OMIT
|
713
718
|
@contact = contact if contact != OMIT
|
714
719
|
@tax_rate = tax_rate if tax_rate != OMIT
|
715
720
|
@description = description if description != OMIT
|
@@ -729,6 +734,7 @@ module Merge
|
|
729
734
|
"currency": currency,
|
730
735
|
"company": company,
|
731
736
|
"employee": employee,
|
737
|
+
"project": project,
|
732
738
|
"contact": contact,
|
733
739
|
"tax_rate": tax_rate,
|
734
740
|
"description": description,
|
@@ -771,6 +777,12 @@ module Merge
|
|
771
777
|
currency = parsed_json["currency"]
|
772
778
|
company = parsed_json["company"]
|
773
779
|
employee = parsed_json["employee"]
|
780
|
+
if parsed_json["project"].nil?
|
781
|
+
project = nil
|
782
|
+
else
|
783
|
+
project = parsed_json["project"].to_json
|
784
|
+
project = Merge::Accounting::JournalLineProject.from_json(json_object: project)
|
785
|
+
end
|
774
786
|
contact = parsed_json["contact"]
|
775
787
|
tax_rate = parsed_json["tax_rate"]
|
776
788
|
description = parsed_json["description"]
|
@@ -792,6 +804,7 @@ module Merge
|
|
792
804
|
currency: currency,
|
793
805
|
company: company,
|
794
806
|
employee: employee,
|
807
|
+
project: project,
|
795
808
|
contact: contact,
|
796
809
|
tax_rate: tax_rate,
|
797
810
|
description: description,
|
@@ -827,6 +840,7 @@ module Merge
|
|
827
840
|
obj.currency&.is_a?(Merge::Accounting::TransactionCurrencyEnum) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.")
|
828
841
|
obj.company&.is_a?(String) != false || raise("Passed value for field obj.company is not the expected type, validation failed.")
|
829
842
|
obj.employee&.is_a?(String) != false || raise("Passed value for field obj.employee is not the expected type, validation failed.")
|
843
|
+
obj.project.nil? || Merge::Accounting::JournalLineProject.validate_raw(obj: obj.project)
|
830
844
|
obj.contact&.is_a?(String) != false || raise("Passed value for field obj.contact is not the expected type, validation failed.")
|
831
845
|
obj.tax_rate&.is_a?(String) != false || raise("Passed value for field obj.tax_rate is not the expected type, validation failed.")
|
832
846
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|