apimatic-tql-sdk 0.0.1
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 +7 -0
- data/LICENSE +28 -0
- data/README.md +210 -0
- data/bin/console +15 -0
- data/lib/tql_otr_factoring_data_exchange/api_helper.rb +10 -0
- data/lib/tql_otr_factoring_data_exchange/apis/assignments_api.rb +45 -0
- data/lib/tql_otr_factoring_data_exchange/apis/base_api.rb +67 -0
- data/lib/tql_otr_factoring_data_exchange/apis/documents_api.rb +82 -0
- data/lib/tql_otr_factoring_data_exchange/apis/invoices_api.rb +114 -0
- data/lib/tql_otr_factoring_data_exchange/apis/loads_api.rb +68 -0
- data/lib/tql_otr_factoring_data_exchange/apis/oauth_authorization_api.rb +44 -0
- data/lib/tql_otr_factoring_data_exchange/client.rb +104 -0
- data/lib/tql_otr_factoring_data_exchange/configuration.rb +164 -0
- data/lib/tql_otr_factoring_data_exchange/exceptions/api_exception.rb +21 -0
- data/lib/tql_otr_factoring_data_exchange/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb +58 -0
- data/lib/tql_otr_factoring_data_exchange/http/api_response.rb +19 -0
- data/lib/tql_otr_factoring_data_exchange/http/auth/oauth_2.rb +156 -0
- data/lib/tql_otr_factoring_data_exchange/http/http_call_back.rb +10 -0
- data/lib/tql_otr_factoring_data_exchange/http/http_method_enum.rb +10 -0
- data/lib/tql_otr_factoring_data_exchange/http/http_request.rb +10 -0
- data/lib/tql_otr_factoring_data_exchange/http/http_response.rb +10 -0
- data/lib/tql_otr_factoring_data_exchange/http/proxy_settings.rb +22 -0
- data/lib/tql_otr_factoring_data_exchange/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/tql_otr_factoring_data_exchange/logging/sdk_logger.rb +17 -0
- data/lib/tql_otr_factoring_data_exchange/models/assignment_request.rb +140 -0
- data/lib/tql_otr_factoring_data_exchange/models/assignment_response.rb +126 -0
- data/lib/tql_otr_factoring_data_exchange/models/assignment_status.rb +36 -0
- data/lib/tql_otr_factoring_data_exchange/models/base64_document.rb +118 -0
- data/lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb +107 -0
- data/lib/tql_otr_factoring_data_exchange/models/base_model.rb +110 -0
- data/lib/tql_otr_factoring_data_exchange/models/carrier.rb +98 -0
- data/lib/tql_otr_factoring_data_exchange/models/carrier1.rb +98 -0
- data/lib/tql_otr_factoring_data_exchange/models/carrier2.rb +98 -0
- data/lib/tql_otr_factoring_data_exchange/models/carrier_input.rb +123 -0
- data/lib/tql_otr_factoring_data_exchange/models/carrier_input1.rb +123 -0
- data/lib/tql_otr_factoring_data_exchange/models/charge_code.rb +126 -0
- data/lib/tql_otr_factoring_data_exchange/models/charge_code_origin.rb +49 -0
- data/lib/tql_otr_factoring_data_exchange/models/charge_input.rb +146 -0
- data/lib/tql_otr_factoring_data_exchange/models/document.rb +86 -0
- data/lib/tql_otr_factoring_data_exchange/models/document_type.rb +288 -0
- data/lib/tql_otr_factoring_data_exchange/models/document_upload_metadata.rb +111 -0
- data/lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb +137 -0
- data/lib/tql_otr_factoring_data_exchange/models/exception_severity.rb +40 -0
- data/lib/tql_otr_factoring_data_exchange/models/factoring_company_input.rb +117 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice.rb +223 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_exception.rb +136 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb +165 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_search_request.rb +242 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb +124 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_status.rb +74 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb +193 -0
- data/lib/tql_otr_factoring_data_exchange/models/invoice_type.rb +50 -0
- data/lib/tql_otr_factoring_data_exchange/models/load.rb +110 -0
- data/lib/tql_otr_factoring_data_exchange/models/load_detail.rb +140 -0
- data/lib/tql_otr_factoring_data_exchange/models/load_search_request.rb +205 -0
- data/lib/tql_otr_factoring_data_exchange/models/load_search_response.rb +124 -0
- data/lib/tql_otr_factoring_data_exchange/models/load_status.rb +56 -0
- data/lib/tql_otr_factoring_data_exchange/models/location.rb +149 -0
- data/lib/tql_otr_factoring_data_exchange/models/oauth_provider_error.rb +62 -0
- data/lib/tql_otr_factoring_data_exchange/models/oauth_scope.rb +36 -0
- data/lib/tql_otr_factoring_data_exchange/models/oauth_token.rb +96 -0
- data/lib/tql_otr_factoring_data_exchange/models/payment.rb +108 -0
- data/lib/tql_otr_factoring_data_exchange/models/problem_details.rb +96 -0
- data/lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb +109 -0
- data/lib/tql_otr_factoring_data_exchange/models/reference_type.rb +90 -0
- data/lib/tql_otr_factoring_data_exchange/models/status.rb +44 -0
- data/lib/tql_otr_factoring_data_exchange/models/stop_input.rb +121 -0
- data/lib/tql_otr_factoring_data_exchange/models/stop_type.rb +62 -0
- data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb +326 -0
- data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_response.rb +107 -0
- data/lib/tql_otr_factoring_data_exchange/models/weight_unit.rb +36 -0
- data/lib/tql_otr_factoring_data_exchange/utilities/date_time_helper.rb +11 -0
- data/lib/tql_otr_factoring_data_exchange/utilities/file_wrapper.rb +28 -0
- data/lib/tql_otr_factoring_data_exchange/utilities/union_type_lookup.rb +29 -0
- data/lib/tql_otr_factoring_data_exchange.rb +107 -0
- metadata +160 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# tql_otr_factoring_data_exchange
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TqlOtrFactoringDataExchange
|
|
7
|
+
# CarrierInput1 Model.
|
|
8
|
+
class CarrierInput1 < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Legal or DBA name of the carrier.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :carrier_name
|
|
15
|
+
|
|
16
|
+
# Motor Carrier (MC) number issued by [FMCSA](https://www.fmcsa.dot.gov/).
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :mc_number
|
|
19
|
+
|
|
20
|
+
# USDOT number issued by [FMCSA](https://www.fmcsa.dot.gov/).
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :dot_number
|
|
23
|
+
|
|
24
|
+
# Standard Carrier Alpha Code
|
|
25
|
+
# ([SCAC](https://nmfta.org/registration-listing/scac/)).
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :scac
|
|
28
|
+
|
|
29
|
+
# A mapping from model property names to API property names.
|
|
30
|
+
def self.names
|
|
31
|
+
@_hash = {} if @_hash.nil?
|
|
32
|
+
@_hash['carrier_name'] = 'carrierName'
|
|
33
|
+
@_hash['mc_number'] = 'mcNumber'
|
|
34
|
+
@_hash['dot_number'] = 'dotNumber'
|
|
35
|
+
@_hash['scac'] = 'scac'
|
|
36
|
+
@_hash
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# An array for optional fields
|
|
40
|
+
def self.optionals
|
|
41
|
+
%w[
|
|
42
|
+
carrier_name
|
|
43
|
+
mc_number
|
|
44
|
+
scac
|
|
45
|
+
]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An array for nullable fields
|
|
49
|
+
def self.nullables
|
|
50
|
+
%w[
|
|
51
|
+
mc_number
|
|
52
|
+
dot_number
|
|
53
|
+
scac
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(dot_number:, carrier_name: SKIP, mc_number: SKIP, scac: SKIP,
|
|
58
|
+
additional_properties: nil)
|
|
59
|
+
# Add additional model properties to the instance
|
|
60
|
+
additional_properties = {} if additional_properties.nil?
|
|
61
|
+
|
|
62
|
+
@carrier_name = carrier_name unless carrier_name == SKIP
|
|
63
|
+
@mc_number = mc_number unless mc_number == SKIP
|
|
64
|
+
@dot_number = dot_number
|
|
65
|
+
@scac = scac unless scac == SKIP
|
|
66
|
+
@additional_properties = additional_properties
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Creates an instance of the object from a hash.
|
|
70
|
+
def self.from_hash(hash)
|
|
71
|
+
return nil unless hash
|
|
72
|
+
|
|
73
|
+
# Extract variables from the hash.
|
|
74
|
+
dot_number = hash.key?('dotNumber') ? hash['dotNumber'] : nil
|
|
75
|
+
carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP
|
|
76
|
+
mc_number = hash.key?('mcNumber') ? hash['mcNumber'] : SKIP
|
|
77
|
+
scac = hash.key?('scac') ? hash['scac'] : SKIP
|
|
78
|
+
|
|
79
|
+
# Create a new hash for additional properties, removing known properties.
|
|
80
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
81
|
+
|
|
82
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
83
|
+
new_hash, proc { |value| value }
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Create object from extracted values.
|
|
87
|
+
CarrierInput1.new(dot_number: dot_number,
|
|
88
|
+
carrier_name: carrier_name,
|
|
89
|
+
mc_number: mc_number,
|
|
90
|
+
scac: scac,
|
|
91
|
+
additional_properties: additional_properties)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Validates an instance of the object from a given value.
|
|
95
|
+
# @param [CarrierInput1 | Hash] The value against the validation is performed.
|
|
96
|
+
def self.validate(value)
|
|
97
|
+
if value.instance_of? self
|
|
98
|
+
return APIHelper.valid_type?(value.dot_number,
|
|
99
|
+
->(val) { val.instance_of? String })
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return false unless value.instance_of? Hash
|
|
103
|
+
|
|
104
|
+
APIHelper.valid_type?(value['dotNumber'],
|
|
105
|
+
->(val) { val.instance_of? String })
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Provides a human-readable string representation of the object.
|
|
109
|
+
def to_s
|
|
110
|
+
class_name = self.class.name.split('::').last
|
|
111
|
+
"<#{class_name} carrier_name: #{@carrier_name}, mc_number: #{@mc_number}, dot_number:"\
|
|
112
|
+
" #{@dot_number}, scac: #{@scac}, additional_properties: #{@additional_properties}>"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
116
|
+
def inspect
|
|
117
|
+
class_name = self.class.name.split('::').last
|
|
118
|
+
"<#{class_name} carrier_name: #{@carrier_name.inspect}, mc_number: #{@mc_number.inspect},"\
|
|
119
|
+
" dot_number: #{@dot_number.inspect}, scac: #{@scac.inspect}, additional_properties:"\
|
|
120
|
+
" #{@additional_properties}>"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# tql_otr_factoring_data_exchange
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TqlOtrFactoringDataExchange
|
|
7
|
+
# Structured charge code identifying the type of charge and the standard or
|
|
8
|
+
# system it originates from. Allows carriers, factors, and industry standards
|
|
9
|
+
# to coexist on the same invoice.
|
|
10
|
+
class ChargeCode < BaseModel
|
|
11
|
+
SKIP = Object.new
|
|
12
|
+
private_constant :SKIP
|
|
13
|
+
|
|
14
|
+
# Indicates the system or standard from which a charge code originates.
|
|
15
|
+
# Helps TQL normalize and map charge codes across different partners.
|
|
16
|
+
# @return [ChargeCodeOrigin]
|
|
17
|
+
attr_accessor :origin
|
|
18
|
+
|
|
19
|
+
# The charge code value. Interpretation depends on `origin`. For SAC origin,
|
|
20
|
+
# common values include: 400 (Line-haul), 420 (Fuel Surcharge), 430
|
|
21
|
+
# (Detention — Loading), 431 (Detention — Unloading), 440 (Stop-off), 450
|
|
22
|
+
# (Accessorial — General), 455 (Hazmat), 460 (Lumper Fee), 465 (TONU), 470
|
|
23
|
+
# (Layover), 475/476 (Driver Assist), 480 (Re-delivery), 485
|
|
24
|
+
# (Reconsignment), 490 (Residential), 495 (Inside Delivery), 500 (Liftgate),
|
|
25
|
+
# 505 (Limited Access), 510 (Over-dimension), 520 (Overweight), 530
|
|
26
|
+
# (Reefer), 540 (Team Driver), 550 (Expedited), 560 (Border Crossing), 999
|
|
27
|
+
# (Other).
|
|
28
|
+
# @return [String]
|
|
29
|
+
attr_accessor :value
|
|
30
|
+
|
|
31
|
+
# Human-readable description of the charge code.
|
|
32
|
+
# @return [String]
|
|
33
|
+
attr_accessor :description
|
|
34
|
+
|
|
35
|
+
# A mapping from model property names to API property names.
|
|
36
|
+
def self.names
|
|
37
|
+
@_hash = {} if @_hash.nil?
|
|
38
|
+
@_hash['origin'] = 'origin'
|
|
39
|
+
@_hash['value'] = 'value'
|
|
40
|
+
@_hash['description'] = 'description'
|
|
41
|
+
@_hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# An array for optional fields
|
|
45
|
+
def self.optionals
|
|
46
|
+
%w[
|
|
47
|
+
origin
|
|
48
|
+
]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# An array for nullable fields
|
|
52
|
+
def self.nullables
|
|
53
|
+
[]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(value:, description:, origin: ChargeCodeOrigin::SAC,
|
|
57
|
+
additional_properties: nil)
|
|
58
|
+
# Add additional model properties to the instance
|
|
59
|
+
additional_properties = {} if additional_properties.nil?
|
|
60
|
+
|
|
61
|
+
@origin = origin unless origin == SKIP
|
|
62
|
+
@value = value
|
|
63
|
+
@description = description
|
|
64
|
+
@additional_properties = additional_properties
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Creates an instance of the object from a hash.
|
|
68
|
+
def self.from_hash(hash)
|
|
69
|
+
return nil unless hash
|
|
70
|
+
|
|
71
|
+
# Extract variables from the hash.
|
|
72
|
+
value = hash.key?('value') ? hash['value'] : nil
|
|
73
|
+
description = hash.key?('description') ? hash['description'] : nil
|
|
74
|
+
origin = hash['origin'] ||= ChargeCodeOrigin::SAC
|
|
75
|
+
|
|
76
|
+
# Create a new hash for additional properties, removing known properties.
|
|
77
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
78
|
+
|
|
79
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
80
|
+
new_hash, proc { |value| value }
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Create object from extracted values.
|
|
84
|
+
ChargeCode.new(value: value,
|
|
85
|
+
description: description,
|
|
86
|
+
origin: origin,
|
|
87
|
+
additional_properties: additional_properties)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Validates an instance of the object from a given value.
|
|
91
|
+
# @param [ChargeCode | Hash] The value against the validation is performed.
|
|
92
|
+
def self.validate(value)
|
|
93
|
+
if value.instance_of? self
|
|
94
|
+
return (
|
|
95
|
+
APIHelper.valid_type?(value.value,
|
|
96
|
+
->(val) { val.instance_of? String }) and
|
|
97
|
+
APIHelper.valid_type?(value.description,
|
|
98
|
+
->(val) { val.instance_of? String })
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return false unless value.instance_of? Hash
|
|
103
|
+
|
|
104
|
+
(
|
|
105
|
+
APIHelper.valid_type?(value['value'],
|
|
106
|
+
->(val) { val.instance_of? String }) and
|
|
107
|
+
APIHelper.valid_type?(value['description'],
|
|
108
|
+
->(val) { val.instance_of? String })
|
|
109
|
+
)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Provides a human-readable string representation of the object.
|
|
113
|
+
def to_s
|
|
114
|
+
class_name = self.class.name.split('::').last
|
|
115
|
+
"<#{class_name} origin: #{@origin}, value: #{@value}, description: #{@description},"\
|
|
116
|
+
" additional_properties: #{@additional_properties}>"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
120
|
+
def inspect
|
|
121
|
+
class_name = self.class.name.split('::').last
|
|
122
|
+
"<#{class_name} origin: #{@origin.inspect}, value: #{@value.inspect}, description:"\
|
|
123
|
+
" #{@description.inspect}, additional_properties: #{@additional_properties}>"
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# tql_otr_factoring_data_exchange
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TqlOtrFactoringDataExchange
|
|
7
|
+
# Indicates the system or standard from which a charge code originates. Helps
|
|
8
|
+
# TQL normalize and map charge codes across different partners.
|
|
9
|
+
class ChargeCodeOrigin
|
|
10
|
+
CHARGE_CODE_ORIGIN = [
|
|
11
|
+
# TODO: Write general description for CARRIER
|
|
12
|
+
CARRIER = 'Carrier'.freeze,
|
|
13
|
+
|
|
14
|
+
# TODO: Write general description for FACTOR
|
|
15
|
+
FACTOR = 'Factor'.freeze,
|
|
16
|
+
|
|
17
|
+
# TODO: Write general description for SAC
|
|
18
|
+
SAC = 'SAC'.freeze,
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for NMFC
|
|
21
|
+
NMFC = 'NMFC'.freeze,
|
|
22
|
+
|
|
23
|
+
# TODO: Write general description for SMC3
|
|
24
|
+
SMC3 = 'SMC3'.freeze
|
|
25
|
+
].freeze
|
|
26
|
+
|
|
27
|
+
def self.validate(value)
|
|
28
|
+
return false if value.nil?
|
|
29
|
+
|
|
30
|
+
CHARGE_CODE_ORIGIN.include?(value)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.from_value(value, default_value = CARRIER)
|
|
34
|
+
return default_value if value.nil?
|
|
35
|
+
|
|
36
|
+
str = value.to_s.strip
|
|
37
|
+
|
|
38
|
+
case str.downcase
|
|
39
|
+
when 'carrier' then CARRIER
|
|
40
|
+
when 'factor' then FACTOR
|
|
41
|
+
when 'sac' then SAC
|
|
42
|
+
when 'nmfc' then NMFC
|
|
43
|
+
when 'smc3' then SMC3
|
|
44
|
+
else
|
|
45
|
+
default_value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# tql_otr_factoring_data_exchange
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TqlOtrFactoringDataExchange
|
|
7
|
+
# A single carrier charge line item. The `chargeCode` object identifies the
|
|
8
|
+
# charge type and its originating standard or system.
|
|
9
|
+
class ChargeInput < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# Structured charge code identifying the type of charge and the standard or
|
|
14
|
+
# system it originates from. Allows carriers, factors, and industry
|
|
15
|
+
# standards to coexist on the same invoice.
|
|
16
|
+
# @return [ChargeCode]
|
|
17
|
+
attr_accessor :charge_code
|
|
18
|
+
|
|
19
|
+
# Monetary amount of the charge.
|
|
20
|
+
# @return [Float]
|
|
21
|
+
attr_accessor :amount
|
|
22
|
+
|
|
23
|
+
# Optional reference to an `InvoiceItemInput.itemId`, linking this charge to
|
|
24
|
+
# a specific freight item.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :item_id
|
|
27
|
+
|
|
28
|
+
# [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency
|
|
29
|
+
# code. Defaults to USD.
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :currency
|
|
32
|
+
|
|
33
|
+
# The factoring company's own identifier for this charge line item. Echoed
|
|
34
|
+
# back in responses for reconciliation.
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :external_id
|
|
37
|
+
|
|
38
|
+
# A mapping from model property names to API property names.
|
|
39
|
+
def self.names
|
|
40
|
+
@_hash = {} if @_hash.nil?
|
|
41
|
+
@_hash['charge_code'] = 'chargeCode'
|
|
42
|
+
@_hash['amount'] = 'amount'
|
|
43
|
+
@_hash['item_id'] = 'itemId'
|
|
44
|
+
@_hash['currency'] = 'currency'
|
|
45
|
+
@_hash['external_id'] = 'externalId'
|
|
46
|
+
@_hash
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# An array for optional fields
|
|
50
|
+
def self.optionals
|
|
51
|
+
%w[
|
|
52
|
+
item_id
|
|
53
|
+
currency
|
|
54
|
+
external_id
|
|
55
|
+
]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# An array for nullable fields
|
|
59
|
+
def self.nullables
|
|
60
|
+
%w[
|
|
61
|
+
item_id
|
|
62
|
+
external_id
|
|
63
|
+
]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def initialize(charge_code:, amount:, item_id: SKIP, currency: 'USD',
|
|
67
|
+
external_id: SKIP, additional_properties: nil)
|
|
68
|
+
# Add additional model properties to the instance
|
|
69
|
+
additional_properties = {} if additional_properties.nil?
|
|
70
|
+
|
|
71
|
+
@charge_code = charge_code
|
|
72
|
+
@amount = amount
|
|
73
|
+
@item_id = item_id unless item_id == SKIP
|
|
74
|
+
@currency = currency unless currency == SKIP
|
|
75
|
+
@external_id = external_id unless external_id == SKIP
|
|
76
|
+
@additional_properties = additional_properties
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Creates an instance of the object from a hash.
|
|
80
|
+
def self.from_hash(hash)
|
|
81
|
+
return nil unless hash
|
|
82
|
+
|
|
83
|
+
# Extract variables from the hash.
|
|
84
|
+
charge_code = ChargeCode.from_hash(hash['chargeCode']) if hash['chargeCode']
|
|
85
|
+
amount = hash.key?('amount') ? hash['amount'] : nil
|
|
86
|
+
item_id = hash.key?('itemId') ? hash['itemId'] : SKIP
|
|
87
|
+
currency = hash['currency'] ||= 'USD'
|
|
88
|
+
external_id = hash.key?('externalId') ? hash['externalId'] : SKIP
|
|
89
|
+
|
|
90
|
+
# Create a new hash for additional properties, removing known properties.
|
|
91
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
92
|
+
|
|
93
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
94
|
+
new_hash, proc { |value| value }
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Create object from extracted values.
|
|
98
|
+
ChargeInput.new(charge_code: charge_code,
|
|
99
|
+
amount: amount,
|
|
100
|
+
item_id: item_id,
|
|
101
|
+
currency: currency,
|
|
102
|
+
external_id: external_id,
|
|
103
|
+
additional_properties: additional_properties)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Validates an instance of the object from a given value.
|
|
107
|
+
# @param [ChargeInput | Hash] The value against the validation is performed.
|
|
108
|
+
def self.validate(value)
|
|
109
|
+
if value.instance_of? self
|
|
110
|
+
return (
|
|
111
|
+
APIHelper.valid_type?(value.charge_code,
|
|
112
|
+
->(val) { ChargeCode.validate(val) },
|
|
113
|
+
is_model_hash: true) and
|
|
114
|
+
APIHelper.valid_type?(value.amount,
|
|
115
|
+
->(val) { val.instance_of? Float })
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
return false unless value.instance_of? Hash
|
|
120
|
+
|
|
121
|
+
(
|
|
122
|
+
APIHelper.valid_type?(value['chargeCode'],
|
|
123
|
+
->(val) { ChargeCode.validate(val) },
|
|
124
|
+
is_model_hash: true) and
|
|
125
|
+
APIHelper.valid_type?(value['amount'],
|
|
126
|
+
->(val) { val.instance_of? Float })
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Provides a human-readable string representation of the object.
|
|
131
|
+
def to_s
|
|
132
|
+
class_name = self.class.name.split('::').last
|
|
133
|
+
"<#{class_name} charge_code: #{@charge_code}, amount: #{@amount}, item_id: #{@item_id},"\
|
|
134
|
+
" currency: #{@currency}, external_id: #{@external_id}, additional_properties:"\
|
|
135
|
+
" #{@additional_properties}>"
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
139
|
+
def inspect
|
|
140
|
+
class_name = self.class.name.split('::').last
|
|
141
|
+
"<#{class_name} charge_code: #{@charge_code.inspect}, amount: #{@amount.inspect}, item_id:"\
|
|
142
|
+
" #{@item_id.inspect}, currency: #{@currency.inspect}, external_id: #{@external_id.inspect},"\
|
|
143
|
+
" additional_properties: #{@additional_properties}>"
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# tql_otr_factoring_data_exchange
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TqlOtrFactoringDataExchange
|
|
7
|
+
# Document Model.
|
|
8
|
+
class Document < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# System-generated document identifier.
|
|
13
|
+
# @return [UUID | String]
|
|
14
|
+
attr_accessor :document_id
|
|
15
|
+
|
|
16
|
+
# Document type classification used for categorizing uploaded documents.
|
|
17
|
+
# @return [DocumentType]
|
|
18
|
+
attr_accessor :document_type
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['document_id'] = 'documentId'
|
|
24
|
+
@_hash['document_type'] = 'documentType'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
document_id
|
|
32
|
+
document_type
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(document_id: SKIP, document_type: SKIP,
|
|
42
|
+
additional_properties: nil)
|
|
43
|
+
# Add additional model properties to the instance
|
|
44
|
+
additional_properties = {} if additional_properties.nil?
|
|
45
|
+
|
|
46
|
+
@document_id = document_id unless document_id == SKIP
|
|
47
|
+
@document_type = document_type unless document_type == SKIP
|
|
48
|
+
@additional_properties = additional_properties
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Creates an instance of the object from a hash.
|
|
52
|
+
def self.from_hash(hash)
|
|
53
|
+
return nil unless hash
|
|
54
|
+
|
|
55
|
+
# Extract variables from the hash.
|
|
56
|
+
document_id = hash.key?('documentId') ? hash['documentId'] : SKIP
|
|
57
|
+
document_type = hash.key?('documentType') ? hash['documentType'] : SKIP
|
|
58
|
+
|
|
59
|
+
# Create a new hash for additional properties, removing known properties.
|
|
60
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
61
|
+
|
|
62
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
63
|
+
new_hash, proc { |value| value }
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Create object from extracted values.
|
|
67
|
+
Document.new(document_id: document_id,
|
|
68
|
+
document_type: document_type,
|
|
69
|
+
additional_properties: additional_properties)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Provides a human-readable string representation of the object.
|
|
73
|
+
def to_s
|
|
74
|
+
class_name = self.class.name.split('::').last
|
|
75
|
+
"<#{class_name} document_id: #{@document_id}, document_type: #{@document_type},"\
|
|
76
|
+
" additional_properties: #{@additional_properties}>"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
80
|
+
def inspect
|
|
81
|
+
class_name = self.class.name.split('::').last
|
|
82
|
+
"<#{class_name} document_id: #{@document_id.inspect}, document_type:"\
|
|
83
|
+
" #{@document_type.inspect}, additional_properties: #{@additional_properties}>"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|