merge_ruby_client 2.0.0 → 2.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.
- checksums.yaml +4 -4
- data/lib/merge_ruby_client/accounting/accounting_periods/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/accounts/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/attachments/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/balance_sheets/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/bank_feed_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/bank_feed_transactions/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/cash_flow_statements/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/client.rb +7 -0
- data/lib/merge_ruby_client/accounting/company_info/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/contacts/client.rb +173 -4
- data/lib/merge_ruby_client/accounting/credit_notes/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/employees/client.rb +35 -8
- data/lib/merge_ruby_client/accounting/expense_reports/client.rb +765 -0
- data/lib/merge_ruby_client/accounting/expense_reports/types/expense_reports_lines_list_request_expand.rb +73 -0
- data/lib/merge_ruby_client/accounting/expense_reports/types/expense_reports_list_request_expand.rb +25 -0
- data/lib/merge_ruby_client/accounting/expense_reports/types/expense_reports_retrieve_request_expand.rb +25 -0
- data/lib/merge_ruby_client/accounting/expenses/client.rb +6 -6
- data/lib/merge_ruby_client/accounting/general_ledger_transactions/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/income_statements/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/invoices/client.rb +6 -6
- data/lib/merge_ruby_client/accounting/issues/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/items/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/journal_entries/client.rb +6 -6
- data/lib/merge_ruby_client/accounting/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/payment_methods/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/payment_terms/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/payments/client.rb +6 -6
- data/lib/merge_ruby_client/accounting/projects/client.rb +35 -8
- data/lib/merge_ruby_client/accounting/purchase_orders/client.rb +6 -6
- data/lib/merge_ruby_client/accounting/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/tax_rates/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/tracking_categories/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/transactions/client.rb +2 -2
- data/lib/merge_ruby_client/accounting/transactions/types/transactions_list_request_expand.rb +32 -0
- data/lib/merge_ruby_client/accounting/transactions/types/transactions_retrieve_request_expand.rb +32 -0
- data/lib/merge_ruby_client/accounting/types/expense_report.rb +869 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line.rb +921 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_account.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_contact.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_employee.rb +57 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request.rb +899 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_account.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_contact.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_employee.rb +57 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_project.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_request_tax_rate.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_line_tax_rate.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_request.rb +819 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_request_accounting_period.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_request_company.rb +56 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_request_employee.rb +57 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_response.rb +101 -0
- data/lib/merge_ruby_client/accounting/types/expense_report_status_enum.rb +16 -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/item.rb +18 -1
- data/lib/merge_ruby_client/accounting/types/paginated_expense_report_line_list.rb +80 -0
- data/lib/merge_ruby_client/accounting/types/paginated_expense_report_list.rb +80 -0
- data/lib/merge_ruby_client/accounting/types/patched_contact_request.rb +188 -0
- data/lib/merge_ruby_client/accounting/types/patched_contact_request_addresses_item.rb +55 -0
- data/lib/merge_ruby_client/accounting/types/remote_field_class.rb +9 -1
- data/lib/merge_ruby_client/accounting/vendor_credits/client.rb +2 -2
- data/lib/merge_ruby_client/ats/activities/client.rb +2 -2
- data/lib/merge_ruby_client/ats/applications/client.rb +2 -2
- data/lib/merge_ruby_client/ats/attachments/client.rb +2 -2
- data/lib/merge_ruby_client/ats/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/ats/candidates/client.rb +2 -2
- data/lib/merge_ruby_client/ats/departments/client.rb +2 -2
- data/lib/merge_ruby_client/ats/eeocs/client.rb +2 -2
- data/lib/merge_ruby_client/ats/interviews/client.rb +2 -2
- data/lib/merge_ruby_client/ats/issues/client.rb +2 -2
- data/lib/merge_ruby_client/ats/job_interview_stages/client.rb +2 -2
- data/lib/merge_ruby_client/ats/job_postings/client.rb +2 -2
- data/lib/merge_ruby_client/ats/jobs/client.rb +4 -4
- data/lib/merge_ruby_client/ats/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/ats/offers/client.rb +2 -2
- data/lib/merge_ruby_client/ats/offices/client.rb +2 -2
- data/lib/merge_ruby_client/ats/reject_reasons/client.rb +2 -2
- data/lib/merge_ruby_client/ats/scorecards/client.rb +2 -2
- data/lib/merge_ruby_client/ats/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/ats/tags/client.rb +2 -2
- data/lib/merge_ruby_client/ats/types/event_type_enum.rb +1 -0
- data/lib/merge_ruby_client/ats/users/client.rb +2 -2
- data/lib/merge_ruby_client/crm/accounts/client.rb +4 -4
- data/lib/merge_ruby_client/crm/association_types/client.rb +2 -2
- data/lib/merge_ruby_client/crm/associations/client.rb +10 -2
- data/lib/merge_ruby_client/crm/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/crm/contacts/client.rb +4 -4
- data/lib/merge_ruby_client/crm/custom_object_classes/client.rb +2 -2
- data/lib/merge_ruby_client/crm/custom_objects/client.rb +4 -4
- data/lib/merge_ruby_client/crm/engagement_types/client.rb +4 -4
- data/lib/merge_ruby_client/crm/engagements/client.rb +4 -4
- data/lib/merge_ruby_client/crm/issues/client.rb +2 -2
- data/lib/merge_ruby_client/crm/leads/client.rb +4 -4
- data/lib/merge_ruby_client/crm/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/crm/notes/client.rb +4 -4
- data/lib/merge_ruby_client/crm/opportunities/client.rb +4 -4
- data/lib/merge_ruby_client/crm/stages/client.rb +4 -4
- data/lib/merge_ruby_client/crm/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/crm/tasks/client.rb +4 -4
- data/lib/merge_ruby_client/crm/types/remote_field_class.rb +9 -1
- data/lib/merge_ruby_client/crm/users/client.rb +4 -4
- data/lib/merge_ruby_client/filestorage/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/drives/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/files/client.rb +28 -10
- data/lib/merge_ruby_client/filestorage/folders/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/groups/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/issues/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/filestorage/users/client.rb +2 -2
- data/lib/merge_ruby_client/hris/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/hris/bank_info/client.rb +2 -2
- data/lib/merge_ruby_client/hris/benefits/client.rb +2 -2
- data/lib/merge_ruby_client/hris/companies/client.rb +2 -2
- data/lib/merge_ruby_client/hris/dependents/client.rb +8 -4
- data/lib/merge_ruby_client/hris/employee_payroll_runs/client.rb +2 -2
- data/lib/merge_ruby_client/hris/employees/client.rb +8 -4
- data/lib/merge_ruby_client/hris/employer_benefits/client.rb +2 -2
- data/lib/merge_ruby_client/hris/employments/client.rb +2 -2
- data/lib/merge_ruby_client/hris/groups/client.rb +2 -2
- data/lib/merge_ruby_client/hris/issues/client.rb +2 -2
- data/lib/merge_ruby_client/hris/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/hris/locations/client.rb +2 -2
- data/lib/merge_ruby_client/hris/pay_groups/client.rb +2 -2
- data/lib/merge_ruby_client/hris/payroll_runs/client.rb +2 -2
- data/lib/merge_ruby_client/hris/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/hris/teams/client.rb +2 -2
- data/lib/merge_ruby_client/hris/time_off/client.rb +2 -2
- data/lib/merge_ruby_client/hris/time_off_balances/client.rb +2 -2
- data/lib/merge_ruby_client/hris/timesheet_entries/client.rb +2 -2
- data/lib/merge_ruby_client/hris/types/benefit.rb +9 -9
- data/lib/merge_ruby_client/ticketing/accounts/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/attachments/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/audit_trail/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/collections/client.rb +4 -4
- data/lib/merge_ruby_client/ticketing/comments/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/contacts/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/issues/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/linked_accounts/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/projects/client.rb +4 -4
- data/lib/merge_ruby_client/ticketing/roles/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/sync_status/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/tags/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/teams/client.rb +2 -2
- data/lib/merge_ruby_client/ticketing/tickets/client.rb +14 -10
- data/lib/merge_ruby_client/ticketing/types/patched_ticket_request.rb +9 -9
- data/lib/merge_ruby_client/ticketing/types/remote_field_class.rb +9 -1
- data/lib/merge_ruby_client/ticketing/users/client.rb +2 -2
- data/lib/merge_ruby_client.rb +7 -7
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +230 -201
- metadata +32 -2
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "accounting_period"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# The accounting period the report was posted in
|
9
|
+
class ExpenseReportRequestAccountingPeriod
|
10
|
+
# Deserialize a JSON object to an instance of ExpenseReportRequestAccountingPeriod
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ExpenseReportRequestAccountingPeriod]
|
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::AccountingPeriod.validate_raw(obj: struct)
|
26
|
+
return Merge::Accounting::AccountingPeriod.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::AccountingPeriod.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 "company_info"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# The subsidiary that the expense report is created in
|
9
|
+
class ExpenseReportRequestCompany
|
10
|
+
# Deserialize a JSON object to an instance of ExpenseReportRequestCompany
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Merge::Accounting::ExpenseReportRequestCompany]
|
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,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "employee"
|
5
|
+
|
6
|
+
module Merge
|
7
|
+
module Accounting
|
8
|
+
# Identifier for the employee who submitted or is associated with the expense
|
9
|
+
# report
|
10
|
+
class ExpenseReportRequestEmployee
|
11
|
+
# Deserialize a JSON object to an instance of ExpenseReportRequestEmployee
|
12
|
+
#
|
13
|
+
# @param json_object [String]
|
14
|
+
# @return [Merge::Accounting::ExpenseReportRequestEmployee]
|
15
|
+
def self.from_json(json_object:)
|
16
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
17
|
+
begin
|
18
|
+
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
19
|
+
return struct unless struct.nil?
|
20
|
+
|
21
|
+
return nil
|
22
|
+
rescue StandardError
|
23
|
+
# noop
|
24
|
+
end
|
25
|
+
begin
|
26
|
+
Merge::Accounting::Employee.validate_raw(obj: struct)
|
27
|
+
return Merge::Accounting::Employee.from_json(json_object: struct) unless struct.nil?
|
28
|
+
|
29
|
+
return nil
|
30
|
+
rescue StandardError
|
31
|
+
# noop
|
32
|
+
end
|
33
|
+
struct
|
34
|
+
end
|
35
|
+
|
36
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
37
|
+
# hash and check each fields type against the current object's property
|
38
|
+
# definitions.
|
39
|
+
#
|
40
|
+
# @param obj [Object]
|
41
|
+
# @return [Void]
|
42
|
+
def self.validate_raw(obj:)
|
43
|
+
begin
|
44
|
+
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
45
|
+
rescue StandardError
|
46
|
+
# noop
|
47
|
+
end
|
48
|
+
begin
|
49
|
+
return Merge::Accounting::Employee.validate_raw(obj: obj)
|
50
|
+
rescue StandardError
|
51
|
+
# noop
|
52
|
+
end
|
53
|
+
raise("Passed value matched no type within the union, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "expense_report"
|
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 ExpenseReportResponse
|
13
|
+
# @return [Merge::Accounting::ExpenseReport]
|
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::ExpenseReport]
|
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::ExpenseReportResponse]
|
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 ExpenseReportResponse
|
47
|
+
#
|
48
|
+
# @param json_object [String]
|
49
|
+
# @return [Merge::Accounting::ExpenseReportResponse]
|
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::ExpenseReport.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 ExpenseReportResponse 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::ExpenseReport.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
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Merge
|
4
|
+
module Accounting
|
5
|
+
# * `DRAFT` - DRAFT
|
6
|
+
# * `SUBMITTED` - SUBMITTED
|
7
|
+
# * `APPROVED` - APPROVED
|
8
|
+
# * `REJECTED` - REJECTED
|
9
|
+
class ExpenseReportStatusEnum
|
10
|
+
DRAFT = "DRAFT"
|
11
|
+
SUBMITTED = "SUBMITTED"
|
12
|
+
APPROVED = "APPROVED"
|
13
|
+
REJECTED = "REJECTED"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -28,6 +28,8 @@ module Merge
|
|
28
28
|
# @return [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
29
29
|
attr_reader :purchase_order
|
30
30
|
# @return [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
31
|
+
attr_reader :expense_report
|
32
|
+
# @return [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
31
33
|
attr_reader :tracking_category
|
32
34
|
# @return [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
33
35
|
attr_reader :journal_entry
|
@@ -75,6 +77,7 @@ module Merge
|
|
75
77
|
# @param credit_note [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
76
78
|
# @param item [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
77
79
|
# @param purchase_order [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
80
|
+
# @param expense_report [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
78
81
|
# @param tracking_category [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
79
82
|
# @param journal_entry [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
80
83
|
# @param tax_rate [Array<Merge::Accounting::ExternalTargetFieldApi>]
|
@@ -93,7 +96,7 @@ module Merge
|
|
93
96
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
94
97
|
# @return [Merge::Accounting::ExternalTargetFieldApiResponse]
|
95
98
|
def initialize(account: OMIT, accounting_attachment: OMIT, balance_sheet: OMIT, cash_flow_statement: OMIT,
|
96
|
-
company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, project: OMIT, payment_term: OMIT, additional_properties: nil)
|
99
|
+
company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, expense_report: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, project: OMIT, payment_term: OMIT, additional_properties: nil)
|
97
100
|
@account = account if account != OMIT
|
98
101
|
@accounting_attachment = accounting_attachment if accounting_attachment != OMIT
|
99
102
|
@balance_sheet = balance_sheet if balance_sheet != OMIT
|
@@ -104,6 +107,7 @@ module Merge
|
|
104
107
|
@credit_note = credit_note if credit_note != OMIT
|
105
108
|
@item = item if item != OMIT
|
106
109
|
@purchase_order = purchase_order if purchase_order != OMIT
|
110
|
+
@expense_report = expense_report if expense_report != OMIT
|
107
111
|
@tracking_category = tracking_category if tracking_category != OMIT
|
108
112
|
@journal_entry = journal_entry if journal_entry != OMIT
|
109
113
|
@tax_rate = tax_rate if tax_rate != OMIT
|
@@ -131,6 +135,7 @@ module Merge
|
|
131
135
|
"CreditNote": credit_note,
|
132
136
|
"Item": item,
|
133
137
|
"PurchaseOrder": purchase_order,
|
138
|
+
"ExpenseReport": expense_report,
|
134
139
|
"TrackingCategory": tracking_category,
|
135
140
|
"JournalEntry": journal_entry,
|
136
141
|
"TaxRate": tax_rate,
|
@@ -198,6 +203,10 @@ module Merge
|
|
198
203
|
item = item.to_json
|
199
204
|
Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
|
200
205
|
end
|
206
|
+
expense_report = parsed_json["ExpenseReport"]&.map do |item|
|
207
|
+
item = item.to_json
|
208
|
+
Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
|
209
|
+
end
|
201
210
|
tracking_category = parsed_json["TrackingCategory"]&.map do |item|
|
202
211
|
item = item.to_json
|
203
212
|
Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
|
@@ -269,6 +278,7 @@ module Merge
|
|
269
278
|
credit_note: credit_note,
|
270
279
|
item: item,
|
271
280
|
purchase_order: purchase_order,
|
281
|
+
expense_report: expense_report,
|
272
282
|
tracking_category: tracking_category,
|
273
283
|
journal_entry: journal_entry,
|
274
284
|
tax_rate: tax_rate,
|
@@ -312,6 +322,7 @@ module Merge
|
|
312
322
|
obj.credit_note&.is_a?(Array) != false || raise("Passed value for field obj.credit_note is not the expected type, validation failed.")
|
313
323
|
obj.item&.is_a?(Array) != false || raise("Passed value for field obj.item is not the expected type, validation failed.")
|
314
324
|
obj.purchase_order&.is_a?(Array) != false || raise("Passed value for field obj.purchase_order is not the expected type, validation failed.")
|
325
|
+
obj.expense_report&.is_a?(Array) != false || raise("Passed value for field obj.expense_report is not the expected type, validation failed.")
|
315
326
|
obj.tracking_category&.is_a?(Array) != false || raise("Passed value for field obj.tracking_category is not the expected type, validation failed.")
|
316
327
|
obj.journal_entry&.is_a?(Array) != false || raise("Passed value for field obj.journal_entry is not the expected type, validation failed.")
|
317
328
|
obj.tax_rate&.is_a?(Array) != false || raise("Passed value for field obj.tax_rate is not the expected type, validation failed.")
|
@@ -28,6 +28,8 @@ module Merge
|
|
28
28
|
# @return [Array<Merge::Accounting::FieldMappingApiInstance>]
|
29
29
|
attr_reader :purchase_order
|
30
30
|
# @return [Array<Merge::Accounting::FieldMappingApiInstance>]
|
31
|
+
attr_reader :expense_report
|
32
|
+
# @return [Array<Merge::Accounting::FieldMappingApiInstance>]
|
31
33
|
attr_reader :tracking_category
|
32
34
|
# @return [Array<Merge::Accounting::FieldMappingApiInstance>]
|
33
35
|
attr_reader :journal_entry
|
@@ -75,6 +77,7 @@ module Merge
|
|
75
77
|
# @param credit_note [Array<Merge::Accounting::FieldMappingApiInstance>]
|
76
78
|
# @param item [Array<Merge::Accounting::FieldMappingApiInstance>]
|
77
79
|
# @param purchase_order [Array<Merge::Accounting::FieldMappingApiInstance>]
|
80
|
+
# @param expense_report [Array<Merge::Accounting::FieldMappingApiInstance>]
|
78
81
|
# @param tracking_category [Array<Merge::Accounting::FieldMappingApiInstance>]
|
79
82
|
# @param journal_entry [Array<Merge::Accounting::FieldMappingApiInstance>]
|
80
83
|
# @param tax_rate [Array<Merge::Accounting::FieldMappingApiInstance>]
|
@@ -93,7 +96,7 @@ module Merge
|
|
93
96
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
94
97
|
# @return [Merge::Accounting::FieldMappingApiInstanceResponse]
|
95
98
|
def initialize(account: OMIT, accounting_attachment: OMIT, balance_sheet: OMIT, cash_flow_statement: OMIT,
|
96
|
-
company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, project: OMIT, payment_term: OMIT, additional_properties: nil)
|
99
|
+
company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, expense_report: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, project: OMIT, payment_term: OMIT, additional_properties: nil)
|
97
100
|
@account = account if account != OMIT
|
98
101
|
@accounting_attachment = accounting_attachment if accounting_attachment != OMIT
|
99
102
|
@balance_sheet = balance_sheet if balance_sheet != OMIT
|
@@ -104,6 +107,7 @@ module Merge
|
|
104
107
|
@credit_note = credit_note if credit_note != OMIT
|
105
108
|
@item = item if item != OMIT
|
106
109
|
@purchase_order = purchase_order if purchase_order != OMIT
|
110
|
+
@expense_report = expense_report if expense_report != OMIT
|
107
111
|
@tracking_category = tracking_category if tracking_category != OMIT
|
108
112
|
@journal_entry = journal_entry if journal_entry != OMIT
|
109
113
|
@tax_rate = tax_rate if tax_rate != OMIT
|
@@ -131,6 +135,7 @@ module Merge
|
|
131
135
|
"CreditNote": credit_note,
|
132
136
|
"Item": item,
|
133
137
|
"PurchaseOrder": purchase_order,
|
138
|
+
"ExpenseReport": expense_report,
|
134
139
|
"TrackingCategory": tracking_category,
|
135
140
|
"JournalEntry": journal_entry,
|
136
141
|
"TaxRate": tax_rate,
|
@@ -198,6 +203,10 @@ module Merge
|
|
198
203
|
item = item.to_json
|
199
204
|
Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
|
200
205
|
end
|
206
|
+
expense_report = parsed_json["ExpenseReport"]&.map do |item|
|
207
|
+
item = item.to_json
|
208
|
+
Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
|
209
|
+
end
|
201
210
|
tracking_category = parsed_json["TrackingCategory"]&.map do |item|
|
202
211
|
item = item.to_json
|
203
212
|
Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
|
@@ -269,6 +278,7 @@ module Merge
|
|
269
278
|
credit_note: credit_note,
|
270
279
|
item: item,
|
271
280
|
purchase_order: purchase_order,
|
281
|
+
expense_report: expense_report,
|
272
282
|
tracking_category: tracking_category,
|
273
283
|
journal_entry: journal_entry,
|
274
284
|
tax_rate: tax_rate,
|
@@ -312,6 +322,7 @@ module Merge
|
|
312
322
|
obj.credit_note&.is_a?(Array) != false || raise("Passed value for field obj.credit_note is not the expected type, validation failed.")
|
313
323
|
obj.item&.is_a?(Array) != false || raise("Passed value for field obj.item is not the expected type, validation failed.")
|
314
324
|
obj.purchase_order&.is_a?(Array) != false || raise("Passed value for field obj.purchase_order is not the expected type, validation failed.")
|
325
|
+
obj.expense_report&.is_a?(Array) != false || raise("Passed value for field obj.expense_report is not the expected type, validation failed.")
|
315
326
|
obj.tracking_category&.is_a?(Array) != false || raise("Passed value for field obj.tracking_category is not the expected type, validation failed.")
|
316
327
|
obj.journal_entry&.is_a?(Array) != false || raise("Passed value for field obj.journal_entry is not the expected type, validation failed.")
|
317
328
|
obj.tax_rate&.is_a?(Array) != false || raise("Passed value for field obj.tax_rate is not the expected type, validation failed.")
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "date"
|
4
4
|
require_relative "status_7_d_1_enum"
|
5
|
+
require_relative "type_2_bb_enum"
|
5
6
|
require_relative "item_purchase_account"
|
6
7
|
require_relative "item_sales_account"
|
7
8
|
require_relative "item_company"
|
@@ -33,6 +34,12 @@ module Merge
|
|
33
34
|
# * `ACTIVE` - ACTIVE
|
34
35
|
# * `ARCHIVED` - ARCHIVED
|
35
36
|
attr_reader :status
|
37
|
+
# @return [Merge::Accounting::Type2BbEnum] The item's type.
|
38
|
+
# * `INVENTORY` - INVENTORY
|
39
|
+
# * `NON_INVENTORY` - NON_INVENTORY
|
40
|
+
# * `SERVICE` - SERVICE
|
41
|
+
# * `UNKNOWN` - UNKNOWN
|
42
|
+
attr_reader :type
|
36
43
|
# @return [Float] The item's unit price.
|
37
44
|
attr_reader :unit_price
|
38
45
|
# @return [Float] The price at which the item is purchased from a vendor.
|
@@ -74,6 +81,11 @@ module Merge
|
|
74
81
|
# @param status [Merge::Accounting::Status7D1Enum] The item's status.
|
75
82
|
# * `ACTIVE` - ACTIVE
|
76
83
|
# * `ARCHIVED` - ARCHIVED
|
84
|
+
# @param type [Merge::Accounting::Type2BbEnum] The item's type.
|
85
|
+
# * `INVENTORY` - INVENTORY
|
86
|
+
# * `NON_INVENTORY` - NON_INVENTORY
|
87
|
+
# * `SERVICE` - SERVICE
|
88
|
+
# * `UNKNOWN` - UNKNOWN
|
77
89
|
# @param unit_price [Float] The item's unit price.
|
78
90
|
# @param purchase_price [Float] The price at which the item is purchased from a vendor.
|
79
91
|
# @param purchase_account [Merge::Accounting::ItemPurchaseAccount] References the default account used to record a purchase of the item.
|
@@ -91,13 +103,14 @@ module Merge
|
|
91
103
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
92
104
|
# @return [Merge::Accounting::Item]
|
93
105
|
def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, status: OMIT,
|
94
|
-
unit_price: OMIT, purchase_price: OMIT, purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, remote_updated_at: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil)
|
106
|
+
type: OMIT, unit_price: OMIT, purchase_price: OMIT, purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, remote_updated_at: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil)
|
95
107
|
@id = id if id != OMIT
|
96
108
|
@remote_id = remote_id if remote_id != OMIT
|
97
109
|
@created_at = created_at if created_at != OMIT
|
98
110
|
@modified_at = modified_at if modified_at != OMIT
|
99
111
|
@name = name if name != OMIT
|
100
112
|
@status = status if status != OMIT
|
113
|
+
@type = type if type != OMIT
|
101
114
|
@unit_price = unit_price if unit_price != OMIT
|
102
115
|
@purchase_price = purchase_price if purchase_price != OMIT
|
103
116
|
@purchase_account = purchase_account if purchase_account != OMIT
|
@@ -117,6 +130,7 @@ module Merge
|
|
117
130
|
"modified_at": modified_at,
|
118
131
|
"name": name,
|
119
132
|
"status": status,
|
133
|
+
"type": type,
|
120
134
|
"unit_price": unit_price,
|
121
135
|
"purchase_price": purchase_price,
|
122
136
|
"purchase_account": purchase_account,
|
@@ -146,6 +160,7 @@ module Merge
|
|
146
160
|
modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?)
|
147
161
|
name = parsed_json["name"]
|
148
162
|
status = parsed_json["status"]
|
163
|
+
type = parsed_json["type"]
|
149
164
|
unit_price = parsed_json["unit_price"]
|
150
165
|
purchase_price = parsed_json["purchase_price"]
|
151
166
|
if parsed_json["purchase_account"].nil?
|
@@ -194,6 +209,7 @@ module Merge
|
|
194
209
|
modified_at: modified_at,
|
195
210
|
name: name,
|
196
211
|
status: status,
|
212
|
+
type: type,
|
197
213
|
unit_price: unit_price,
|
198
214
|
purchase_price: purchase_price,
|
199
215
|
purchase_account: purchase_account,
|
@@ -229,6 +245,7 @@ module Merge
|
|
229
245
|
obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.")
|
230
246
|
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
231
247
|
obj.status&.is_a?(Merge::Accounting::Status7D1Enum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
248
|
+
obj.type&.is_a?(Merge::Accounting::Type2BbEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
232
249
|
obj.unit_price&.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.")
|
233
250
|
obj.purchase_price&.is_a?(Float) != false || raise("Passed value for field obj.purchase_price is not the expected type, validation failed.")
|
234
251
|
obj.purchase_account.nil? || Merge::Accounting::ItemPurchaseAccount.validate_raw(obj: obj.purchase_account)
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "expense_report_line"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Merge
|
8
|
+
module Accounting
|
9
|
+
class PaginatedExpenseReportLineList
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :next_
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :previous
|
14
|
+
# @return [Array<Merge::Accounting::ExpenseReportLine>]
|
15
|
+
attr_reader :results
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param next_ [String]
|
25
|
+
# @param previous [String]
|
26
|
+
# @param results [Array<Merge::Accounting::ExpenseReportLine>]
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [Merge::Accounting::PaginatedExpenseReportLineList]
|
29
|
+
def initialize(next_: OMIT, previous: OMIT, results: OMIT, additional_properties: nil)
|
30
|
+
@next_ = next_ if next_ != OMIT
|
31
|
+
@previous = previous if previous != OMIT
|
32
|
+
@results = results if results != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "next": next_, "previous": previous, "results": results }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of PaginatedExpenseReportLineList
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [Merge::Accounting::PaginatedExpenseReportLineList]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
next_ = parsed_json["next"]
|
47
|
+
previous = parsed_json["previous"]
|
48
|
+
results = parsed_json["results"]&.map do |item|
|
49
|
+
item = item.to_json
|
50
|
+
Merge::Accounting::ExpenseReportLine.from_json(json_object: item)
|
51
|
+
end
|
52
|
+
new(
|
53
|
+
next_: next_,
|
54
|
+
previous: previous,
|
55
|
+
results: results,
|
56
|
+
additional_properties: struct
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Serialize an instance of PaginatedExpenseReportLineList to a JSON object
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
def to_json(*_args)
|
64
|
+
@_field_set&.to_json
|
65
|
+
end
|
66
|
+
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
68
|
+
# hash and check each fields type against the current object's property
|
69
|
+
# definitions.
|
70
|
+
#
|
71
|
+
# @param obj [Object]
|
72
|
+
# @return [Void]
|
73
|
+
def self.validate_raw(obj:)
|
74
|
+
obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
|
75
|
+
obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.")
|
76
|
+
obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "expense_report"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Merge
|
8
|
+
module Accounting
|
9
|
+
class PaginatedExpenseReportList
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :next_
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :previous
|
14
|
+
# @return [Array<Merge::Accounting::ExpenseReport>]
|
15
|
+
attr_reader :results
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param next_ [String]
|
25
|
+
# @param previous [String]
|
26
|
+
# @param results [Array<Merge::Accounting::ExpenseReport>]
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [Merge::Accounting::PaginatedExpenseReportList]
|
29
|
+
def initialize(next_: OMIT, previous: OMIT, results: OMIT, additional_properties: nil)
|
30
|
+
@next_ = next_ if next_ != OMIT
|
31
|
+
@previous = previous if previous != OMIT
|
32
|
+
@results = results if results != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "next": next_, "previous": previous, "results": results }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of PaginatedExpenseReportList
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [Merge::Accounting::PaginatedExpenseReportList]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
next_ = parsed_json["next"]
|
47
|
+
previous = parsed_json["previous"]
|
48
|
+
results = parsed_json["results"]&.map do |item|
|
49
|
+
item = item.to_json
|
50
|
+
Merge::Accounting::ExpenseReport.from_json(json_object: item)
|
51
|
+
end
|
52
|
+
new(
|
53
|
+
next_: next_,
|
54
|
+
previous: previous,
|
55
|
+
results: results,
|
56
|
+
additional_properties: struct
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Serialize an instance of PaginatedExpenseReportList to a JSON object
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
def to_json(*_args)
|
64
|
+
@_field_set&.to_json
|
65
|
+
end
|
66
|
+
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
68
|
+
# hash and check each fields type against the current object's property
|
69
|
+
# definitions.
|
70
|
+
#
|
71
|
+
# @param obj [Object]
|
72
|
+
# @return [Void]
|
73
|
+
def self.validate_raw(obj:)
|
74
|
+
obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
|
75
|
+
obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.")
|
76
|
+
obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|