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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +210 -0
  4. data/bin/console +15 -0
  5. data/lib/tql_otr_factoring_data_exchange/api_helper.rb +10 -0
  6. data/lib/tql_otr_factoring_data_exchange/apis/assignments_api.rb +45 -0
  7. data/lib/tql_otr_factoring_data_exchange/apis/base_api.rb +67 -0
  8. data/lib/tql_otr_factoring_data_exchange/apis/documents_api.rb +82 -0
  9. data/lib/tql_otr_factoring_data_exchange/apis/invoices_api.rb +114 -0
  10. data/lib/tql_otr_factoring_data_exchange/apis/loads_api.rb +68 -0
  11. data/lib/tql_otr_factoring_data_exchange/apis/oauth_authorization_api.rb +44 -0
  12. data/lib/tql_otr_factoring_data_exchange/client.rb +104 -0
  13. data/lib/tql_otr_factoring_data_exchange/configuration.rb +164 -0
  14. data/lib/tql_otr_factoring_data_exchange/exceptions/api_exception.rb +21 -0
  15. data/lib/tql_otr_factoring_data_exchange/exceptions/oauth_provider_exception.rb +64 -0
  16. data/lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb +58 -0
  17. data/lib/tql_otr_factoring_data_exchange/http/api_response.rb +19 -0
  18. data/lib/tql_otr_factoring_data_exchange/http/auth/oauth_2.rb +156 -0
  19. data/lib/tql_otr_factoring_data_exchange/http/http_call_back.rb +10 -0
  20. data/lib/tql_otr_factoring_data_exchange/http/http_method_enum.rb +10 -0
  21. data/lib/tql_otr_factoring_data_exchange/http/http_request.rb +10 -0
  22. data/lib/tql_otr_factoring_data_exchange/http/http_response.rb +10 -0
  23. data/lib/tql_otr_factoring_data_exchange/http/proxy_settings.rb +22 -0
  24. data/lib/tql_otr_factoring_data_exchange/logging/configuration/api_logging_configuration.rb +186 -0
  25. data/lib/tql_otr_factoring_data_exchange/logging/sdk_logger.rb +17 -0
  26. data/lib/tql_otr_factoring_data_exchange/models/assignment_request.rb +140 -0
  27. data/lib/tql_otr_factoring_data_exchange/models/assignment_response.rb +126 -0
  28. data/lib/tql_otr_factoring_data_exchange/models/assignment_status.rb +36 -0
  29. data/lib/tql_otr_factoring_data_exchange/models/base64_document.rb +118 -0
  30. data/lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb +107 -0
  31. data/lib/tql_otr_factoring_data_exchange/models/base_model.rb +110 -0
  32. data/lib/tql_otr_factoring_data_exchange/models/carrier.rb +98 -0
  33. data/lib/tql_otr_factoring_data_exchange/models/carrier1.rb +98 -0
  34. data/lib/tql_otr_factoring_data_exchange/models/carrier2.rb +98 -0
  35. data/lib/tql_otr_factoring_data_exchange/models/carrier_input.rb +123 -0
  36. data/lib/tql_otr_factoring_data_exchange/models/carrier_input1.rb +123 -0
  37. data/lib/tql_otr_factoring_data_exchange/models/charge_code.rb +126 -0
  38. data/lib/tql_otr_factoring_data_exchange/models/charge_code_origin.rb +49 -0
  39. data/lib/tql_otr_factoring_data_exchange/models/charge_input.rb +146 -0
  40. data/lib/tql_otr_factoring_data_exchange/models/document.rb +86 -0
  41. data/lib/tql_otr_factoring_data_exchange/models/document_type.rb +288 -0
  42. data/lib/tql_otr_factoring_data_exchange/models/document_upload_metadata.rb +111 -0
  43. data/lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb +137 -0
  44. data/lib/tql_otr_factoring_data_exchange/models/exception_severity.rb +40 -0
  45. data/lib/tql_otr_factoring_data_exchange/models/factoring_company_input.rb +117 -0
  46. data/lib/tql_otr_factoring_data_exchange/models/invoice.rb +223 -0
  47. data/lib/tql_otr_factoring_data_exchange/models/invoice_exception.rb +136 -0
  48. data/lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb +165 -0
  49. data/lib/tql_otr_factoring_data_exchange/models/invoice_search_request.rb +242 -0
  50. data/lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb +124 -0
  51. data/lib/tql_otr_factoring_data_exchange/models/invoice_status.rb +74 -0
  52. data/lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb +193 -0
  53. data/lib/tql_otr_factoring_data_exchange/models/invoice_type.rb +50 -0
  54. data/lib/tql_otr_factoring_data_exchange/models/load.rb +110 -0
  55. data/lib/tql_otr_factoring_data_exchange/models/load_detail.rb +140 -0
  56. data/lib/tql_otr_factoring_data_exchange/models/load_search_request.rb +205 -0
  57. data/lib/tql_otr_factoring_data_exchange/models/load_search_response.rb +124 -0
  58. data/lib/tql_otr_factoring_data_exchange/models/load_status.rb +56 -0
  59. data/lib/tql_otr_factoring_data_exchange/models/location.rb +149 -0
  60. data/lib/tql_otr_factoring_data_exchange/models/oauth_provider_error.rb +62 -0
  61. data/lib/tql_otr_factoring_data_exchange/models/oauth_scope.rb +36 -0
  62. data/lib/tql_otr_factoring_data_exchange/models/oauth_token.rb +96 -0
  63. data/lib/tql_otr_factoring_data_exchange/models/payment.rb +108 -0
  64. data/lib/tql_otr_factoring_data_exchange/models/problem_details.rb +96 -0
  65. data/lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb +109 -0
  66. data/lib/tql_otr_factoring_data_exchange/models/reference_type.rb +90 -0
  67. data/lib/tql_otr_factoring_data_exchange/models/status.rb +44 -0
  68. data/lib/tql_otr_factoring_data_exchange/models/stop_input.rb +121 -0
  69. data/lib/tql_otr_factoring_data_exchange/models/stop_type.rb +62 -0
  70. data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb +326 -0
  71. data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_response.rb +107 -0
  72. data/lib/tql_otr_factoring_data_exchange/models/weight_unit.rb +36 -0
  73. data/lib/tql_otr_factoring_data_exchange/utilities/date_time_helper.rb +11 -0
  74. data/lib/tql_otr_factoring_data_exchange/utilities/file_wrapper.rb +28 -0
  75. data/lib/tql_otr_factoring_data_exchange/utilities/union_type_lookup.rb +29 -0
  76. data/lib/tql_otr_factoring_data_exchange.rb +107 -0
  77. metadata +160 -0
@@ -0,0 +1,22 @@
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
+ ##
8
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
9
+ # including optional basic authentication.
10
+ #
11
+ class ProxySettings < CoreLibrary::ProxySettings
12
+ def self.from_env
13
+ address = ENV['PROXY_ADDRESS']
14
+ port = ENV['PROXY_PORT']
15
+ username = ENV['PROXY_USERNAME']
16
+ password = ENV['PROXY_PASSWORD']
17
+ return nil if address.nil? || address.strip.empty?
18
+
19
+ new(address: address, port: port, username: username, password: password)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,186 @@
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
+ # Initializes a new instance of RequestLoggingConfiguration.
8
+ class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
9
+ # @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
10
+ # @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
11
+ # @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
12
+ # @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
13
+ # @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
14
+ # Default is an empty array.
15
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
16
+ headers_to_exclude: nil, headers_to_unmask: nil,
17
+ include_query_in_path: false)
18
+ super(
19
+ log_body,
20
+ log_headers,
21
+ headers_to_exclude,
22
+ headers_to_include,
23
+ headers_to_unmask,
24
+ include_query_in_path
25
+ )
26
+ end
27
+
28
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
29
+ headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
30
+ log_body ||= self.log_body
31
+ log_headers ||= self.log_headers
32
+ headers_to_include ||= self.headers_to_include
33
+ headers_to_exclude ||= self.headers_to_exclude
34
+ headers_to_unmask ||= self.headers_to_unmask
35
+ include_query_in_path ||= self.include_query_in_path
36
+
37
+ RequestLoggingConfiguration.new(
38
+ log_body: log_body,
39
+ log_headers: log_headers,
40
+ headers_to_include: headers_to_include,
41
+ headers_to_exclude: headers_to_exclude,
42
+ headers_to_unmask: headers_to_unmask,
43
+ include_query_in_path: include_query_in_path
44
+ )
45
+ end
46
+
47
+ def self.from_env
48
+ log_body = ENV['REQUEST_LOG_BODY']
49
+ log_headers = ENV['REQUEST_LOG_HEADERS']
50
+ headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
51
+ headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
52
+ headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
53
+ include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
54
+
55
+ new(
56
+ log_body: log_body,
57
+ log_headers: log_headers,
58
+ headers_to_include: headers_to_include,
59
+ headers_to_exclude: headers_to_exclude,
60
+ headers_to_unmask: headers_to_unmask,
61
+ include_query_in_path: include_query_in_path
62
+ )
63
+ end
64
+
65
+ def self.any_logging_configured?
66
+ %w[
67
+ REQUEST_LOG_BODY
68
+ REQUEST_LOG_HEADERS
69
+ REQUEST_HEADERS_TO_INCLUDE
70
+ REQUEST_HEADERS_TO_EXCLUDE
71
+ REQUEST_HEADERS_TO_UNMASK
72
+ REQUEST_INCLUDE_QUERY_IN_PATH
73
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
74
+ end
75
+ end
76
+
77
+ # Initializes a new instance of ResponseLoggingConfiguration.
78
+ class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
79
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
80
+ headers_to_exclude: nil, headers_to_unmask: nil)
81
+ super(
82
+ log_body,
83
+ log_headers,
84
+ headers_to_exclude,
85
+ headers_to_include,
86
+ headers_to_unmask
87
+ )
88
+ end
89
+
90
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
91
+ headers_to_exclude: nil, headers_to_unmask: nil)
92
+ log_body ||= self.log_body
93
+ log_headers ||= self.log_headers
94
+ headers_to_include ||= self.headers_to_include
95
+ headers_to_exclude ||= self.headers_to_exclude
96
+ headers_to_unmask ||= self.headers_to_unmask
97
+
98
+ ResponseLoggingConfiguration.new(
99
+ log_body: log_body,
100
+ log_headers: log_headers,
101
+ headers_to_include: headers_to_include,
102
+ headers_to_exclude: headers_to_exclude,
103
+ headers_to_unmask: headers_to_unmask
104
+ )
105
+ end
106
+
107
+ def self.from_env
108
+ log_body = ENV['RESPONSE_LOG_BODY']
109
+ log_headers = ENV['RESPONSE_LOG_HEADERS']
110
+ headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
111
+ headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
112
+ headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
113
+
114
+ new(
115
+ log_body: log_body,
116
+ log_headers: log_headers,
117
+ headers_to_include: headers_to_include,
118
+ headers_to_exclude: headers_to_exclude,
119
+ headers_to_unmask: headers_to_unmask
120
+ )
121
+ end
122
+
123
+ def self.any_logging_configured?
124
+ %w[
125
+ RESPONSE_LOG_BODY
126
+ RESPONSE_LOG_HEADERS
127
+ RESPONSE_HEADERS_TO_INCLUDE
128
+ RESPONSE_HEADERS_TO_EXCLUDE
129
+ RESPONSE_HEADERS_TO_UNMASK
130
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
131
+ end
132
+ end
133
+
134
+ # Initializes a new instance of LoggingConfiguration.
135
+ class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
136
+ def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
137
+ request_logging_config: nil,
138
+ response_logging_config: nil)
139
+ request_logging_config ||= RequestLoggingConfiguration.new
140
+ response_logging_config ||= ResponseLoggingConfiguration.new
141
+ super(
142
+ logger,
143
+ log_level,
144
+ request_logging_config,
145
+ response_logging_config,
146
+ mask_sensitive_headers
147
+ )
148
+ end
149
+
150
+ def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
151
+ request_logging_config: nil, response_logging_config: nil)
152
+ logger ||= self.logger
153
+ log_level ||= self.log_level
154
+ mask_sensitive_headers ||= self.mask_sensitive_headers
155
+ request_logging_config ||= self.request_logging_config.clone
156
+ response_logging_config ||= self.response_logging_config.clone
157
+
158
+ LoggingConfiguration.new(
159
+ logger: logger,
160
+ log_level: log_level,
161
+ mask_sensitive_headers: mask_sensitive_headers,
162
+ request_logging_config: request_logging_config,
163
+ response_logging_config: response_logging_config
164
+ )
165
+ end
166
+
167
+ def self.from_env
168
+ log_level = ENV['LOG_LEVEL']
169
+ mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
170
+
171
+ new(
172
+ log_level: log_level,
173
+ mask_sensitive_headers: mask_sensitive_headers,
174
+ request_logging_config: RequestLoggingConfiguration.from_env,
175
+ response_logging_config: ResponseLoggingConfiguration.from_env
176
+ )
177
+ end
178
+
179
+ def self.any_logging_configured?
180
+ RequestLoggingConfiguration.any_logging_configured? ||
181
+ ResponseLoggingConfiguration.any_logging_configured? ||
182
+ ENV.key?('LOG_LEVEL') ||
183
+ ENV.key?('MASK_SENSITIVE_HEADERS')
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,17 @@
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
+ # Represents the generic logger facade
8
+ class AbstractLogger < Logger
9
+ # Logs a message with a specified log level and additional parameters.
10
+ # @param level [Symbol] The log level of the message.
11
+ # @param message [String] The message to log.
12
+ # @param params [Hash] Additional parameters to include in the log message.
13
+ def log(level, message, params)
14
+ raise NotImplementedError, 'This method needs to be implemented in a child class.'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,140 @@
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
+ # Request to assign or unassign a factoring company from a carrier. The
8
+ # carrier is identified by `carrier`. The `effectiveDate` indicates when the
9
+ # assignment or un-assignment took effect.
10
+ class AssignmentRequest < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Carrier information for the invoiced shipment. At least one of `mcNumber`
15
+ # or `dotNumber` must be provided.
16
+ # @return [Object]
17
+ attr_accessor :carrier
18
+
19
+ # Whether the factoring company is assigned to or unassigned from the
20
+ # carrier.
21
+ # @return [AssignmentStatus]
22
+ attr_accessor :status
23
+
24
+ # The date the assignment or un-assignment took effect ("as of" date). [ISO
25
+ # 8601](https://www.iso.org/iso-8601-date-and-time-format.html) date format
26
+ # (YYYY-MM-DD).
27
+ # @return [Date]
28
+ attr_accessor :effective_date
29
+
30
+ # An optional document to include with the request, encoded as a base64
31
+ # string.
32
+ # @return [Base64Document]
33
+ attr_accessor :document
34
+
35
+ # A mapping from model property names to API property names.
36
+ def self.names
37
+ @_hash = {} if @_hash.nil?
38
+ @_hash['carrier'] = 'carrier'
39
+ @_hash['status'] = 'status'
40
+ @_hash['effective_date'] = 'effectiveDate'
41
+ @_hash['document'] = 'document'
42
+ @_hash
43
+ end
44
+
45
+ # An array for optional fields
46
+ def self.optionals
47
+ %w[
48
+ document
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ %w[
55
+ document
56
+ ]
57
+ end
58
+
59
+ def initialize(carrier:, status:, effective_date:, document: SKIP,
60
+ additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @carrier = carrier
65
+ @status = status
66
+ @effective_date = effective_date
67
+ @document = document unless document == SKIP
68
+ @additional_properties = additional_properties
69
+ end
70
+
71
+ # Creates an instance of the object from a hash.
72
+ def self.from_hash(hash)
73
+ return nil unless hash
74
+
75
+ # Extract variables from the hash.
76
+ carrier = hash.key?('carrier') ? APIHelper.deserialize_union_type(
77
+ UnionTypeLookUp.get(:CarrierInput2), hash['carrier']
78
+ ) : nil
79
+ status = hash.key?('status') ? hash['status'] : nil
80
+ effective_date = hash.key?('effectiveDate') ? hash['effectiveDate'] : nil
81
+ document = Base64Document.from_hash(hash['document']) if hash['document']
82
+
83
+ # Create a new hash for additional properties, removing known properties.
84
+ new_hash = hash.reject { |k, _| names.value?(k) }
85
+
86
+ additional_properties = APIHelper.get_additional_properties(
87
+ new_hash, proc { |value| value }
88
+ )
89
+
90
+ # Create object from extracted values.
91
+ AssignmentRequest.new(carrier: carrier,
92
+ status: status,
93
+ effective_date: effective_date,
94
+ document: document,
95
+ additional_properties: additional_properties)
96
+ end
97
+
98
+ # Validates an instance of the object from a given value.
99
+ # @param [AssignmentRequest | Hash] The value against the validation is performed.
100
+ def self.validate(value)
101
+ if value.instance_of? self
102
+ return (
103
+ UnionTypeLookUp.get(:CarrierInput2)
104
+ .validate(value.carrier) and
105
+ APIHelper.valid_type?(value.status,
106
+ ->(val) { AssignmentStatus.validate(val) }) and
107
+ APIHelper.valid_type?(value.effective_date,
108
+ ->(val) { val.instance_of? String })
109
+ )
110
+ end
111
+
112
+ return false unless value.instance_of? Hash
113
+
114
+ (
115
+ UnionTypeLookUp.get(:CarrierInput2)
116
+ .validate(value['carrier']) and
117
+ APIHelper.valid_type?(value['status'],
118
+ ->(val) { AssignmentStatus.validate(val) }) and
119
+ APIHelper.valid_type?(value['effectiveDate'],
120
+ ->(val) { val.instance_of? String })
121
+ )
122
+ end
123
+
124
+ # Provides a human-readable string representation of the object.
125
+ def to_s
126
+ class_name = self.class.name.split('::').last
127
+ "<#{class_name} carrier: #{@carrier}, status: #{@status}, effective_date:"\
128
+ " #{@effective_date}, document: #{@document}, additional_properties:"\
129
+ " #{@additional_properties}>"
130
+ end
131
+
132
+ # Provides a debugging-friendly string with detailed object information.
133
+ def inspect
134
+ class_name = self.class.name.split('::').last
135
+ "<#{class_name} carrier: #{@carrier.inspect}, status: #{@status.inspect}, effective_date:"\
136
+ " #{@effective_date.inspect}, document: #{@document.inspect}, additional_properties:"\
137
+ " #{@additional_properties}>"
138
+ end
139
+ end
140
+ 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
+ require 'date'
7
+ module TqlOtrFactoringDataExchange
8
+ # Acknowledgement that the assignment was recorded.
9
+ class AssignmentResponse < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # System-generated unique identifier for this assignment record.
14
+ # @return [UUID | String]
15
+ attr_accessor :assignment_id
16
+
17
+ # Carrier that was assigned/unassigned.
18
+ # @return [Carrier1]
19
+ attr_accessor :carrier
20
+
21
+ # Whether the factoring company is assigned to or unassigned from the
22
+ # carrier.
23
+ # @return [AssignmentStatus]
24
+ attr_accessor :status
25
+
26
+ # The effective date that was recorded.
27
+ # @return [Date]
28
+ attr_accessor :effective_date
29
+
30
+ # UTC timestamp when TQL recorded this assignment.
31
+ # @return [DateTime]
32
+ attr_accessor :recorded_at
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['assignment_id'] = 'assignmentId'
38
+ @_hash['carrier'] = 'carrier'
39
+ @_hash['status'] = 'status'
40
+ @_hash['effective_date'] = 'effectiveDate'
41
+ @_hash['recorded_at'] = 'recordedAt'
42
+ @_hash
43
+ end
44
+
45
+ # An array for optional fields
46
+ def self.optionals
47
+ %w[
48
+ assignment_id
49
+ carrier
50
+ status
51
+ effective_date
52
+ recorded_at
53
+ ]
54
+ end
55
+
56
+ # An array for nullable fields
57
+ def self.nullables
58
+ []
59
+ end
60
+
61
+ def initialize(assignment_id: SKIP, carrier: SKIP, status: SKIP,
62
+ effective_date: SKIP, recorded_at: SKIP,
63
+ additional_properties: nil)
64
+ # Add additional model properties to the instance
65
+ additional_properties = {} if additional_properties.nil?
66
+
67
+ @assignment_id = assignment_id unless assignment_id == SKIP
68
+ @carrier = carrier unless carrier == SKIP
69
+ @status = status unless status == SKIP
70
+ @effective_date = effective_date unless effective_date == SKIP
71
+ @recorded_at = recorded_at unless recorded_at == SKIP
72
+ @additional_properties = additional_properties
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ assignment_id = hash.key?('assignmentId') ? hash['assignmentId'] : SKIP
81
+ carrier = Carrier1.from_hash(hash['carrier']) if hash['carrier']
82
+ status = hash.key?('status') ? hash['status'] : SKIP
83
+ effective_date = hash.key?('effectiveDate') ? hash['effectiveDate'] : SKIP
84
+ recorded_at = if hash.key?('recordedAt')
85
+ (DateTimeHelper.from_rfc3339(hash['recordedAt']) if hash['recordedAt'])
86
+ else
87
+ SKIP
88
+ end
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
+ AssignmentResponse.new(assignment_id: assignment_id,
99
+ carrier: carrier,
100
+ status: status,
101
+ effective_date: effective_date,
102
+ recorded_at: recorded_at,
103
+ additional_properties: additional_properties)
104
+ end
105
+
106
+ def to_custom_recorded_at
107
+ DateTimeHelper.to_rfc3339(recorded_at)
108
+ end
109
+
110
+ # Provides a human-readable string representation of the object.
111
+ def to_s
112
+ class_name = self.class.name.split('::').last
113
+ "<#{class_name} assignment_id: #{@assignment_id}, carrier: #{@carrier}, status: #{@status},"\
114
+ " effective_date: #{@effective_date}, recorded_at: #{@recorded_at}, additional_properties:"\
115
+ " #{@additional_properties}>"
116
+ end
117
+
118
+ # Provides a debugging-friendly string with detailed object information.
119
+ def inspect
120
+ class_name = self.class.name.split('::').last
121
+ "<#{class_name} assignment_id: #{@assignment_id.inspect}, carrier: #{@carrier.inspect},"\
122
+ " status: #{@status.inspect}, effective_date: #{@effective_date.inspect}, recorded_at:"\
123
+ " #{@recorded_at.inspect}, additional_properties: #{@additional_properties}>"
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,36 @@
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
+ # Whether the factoring company is assigned to or unassigned from the carrier.
8
+ class AssignmentStatus
9
+ ASSIGNMENT_STATUS = [
10
+ # TODO: Write general description for ASSIGNED
11
+ ASSIGNED = 'Assigned'.freeze,
12
+
13
+ # TODO: Write general description for UNASSIGNED
14
+ UNASSIGNED = 'Unassigned'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ ASSIGNMENT_STATUS.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = ASSIGNED)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'assigned' then ASSIGNED
30
+ when 'unassigned' then UNASSIGNED
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,118 @@
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
+ # An optional document to include with the request, encoded as a base64
8
+ # string.
9
+ class Base64Document < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Base64-encoded document content.
14
+ # @return [String]
15
+ attr_accessor :content
16
+
17
+ # Original file name including extension.
18
+ # @return [String]
19
+ attr_accessor :file_name
20
+
21
+ # MIME type of the document.
22
+ # @return [String]
23
+ attr_accessor :content_type
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['content'] = 'content'
29
+ @_hash['file_name'] = 'fileName'
30
+ @_hash['content_type'] = 'contentType'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(content:, file_name:, content_type:,
45
+ additional_properties: nil)
46
+ # Add additional model properties to the instance
47
+ additional_properties = {} if additional_properties.nil?
48
+
49
+ @content = content
50
+ @file_name = file_name
51
+ @content_type = content_type
52
+ @additional_properties = additional_properties
53
+ end
54
+
55
+ # Creates an instance of the object from a hash.
56
+ def self.from_hash(hash)
57
+ return nil unless hash
58
+
59
+ # Extract variables from the hash.
60
+ content = hash.key?('content') ? hash['content'] : nil
61
+ file_name = hash.key?('fileName') ? hash['fileName'] : nil
62
+ content_type = hash.key?('contentType') ? hash['contentType'] : nil
63
+
64
+ # Create a new hash for additional properties, removing known properties.
65
+ new_hash = hash.reject { |k, _| names.value?(k) }
66
+
67
+ additional_properties = APIHelper.get_additional_properties(
68
+ new_hash, proc { |value| value }
69
+ )
70
+
71
+ # Create object from extracted values.
72
+ Base64Document.new(content: content,
73
+ file_name: file_name,
74
+ content_type: content_type,
75
+ additional_properties: additional_properties)
76
+ end
77
+
78
+ # Validates an instance of the object from a given value.
79
+ # @param [Base64Document | Hash] The value against the validation is performed.
80
+ def self.validate(value)
81
+ if value.instance_of? self
82
+ return (
83
+ APIHelper.valid_type?(value.content,
84
+ ->(val) { val.instance_of? String }) and
85
+ APIHelper.valid_type?(value.file_name,
86
+ ->(val) { val.instance_of? String }) and
87
+ APIHelper.valid_type?(value.content_type,
88
+ ->(val) { val.instance_of? String })
89
+ )
90
+ end
91
+
92
+ return false unless value.instance_of? Hash
93
+
94
+ (
95
+ APIHelper.valid_type?(value['content'],
96
+ ->(val) { val.instance_of? String }) and
97
+ APIHelper.valid_type?(value['fileName'],
98
+ ->(val) { val.instance_of? String }) and
99
+ APIHelper.valid_type?(value['contentType'],
100
+ ->(val) { val.instance_of? String })
101
+ )
102
+ end
103
+
104
+ # Provides a human-readable string representation of the object.
105
+ def to_s
106
+ class_name = self.class.name.split('::').last
107
+ "<#{class_name} content: #{@content}, file_name: #{@file_name}, content_type:"\
108
+ " #{@content_type}, additional_properties: #{@additional_properties}>"
109
+ end
110
+
111
+ # Provides a debugging-friendly string with detailed object information.
112
+ def inspect
113
+ class_name = self.class.name.split('::').last
114
+ "<#{class_name} content: #{@content.inspect}, file_name: #{@file_name.inspect},"\
115
+ " content_type: #{@content_type.inspect}, additional_properties: #{@additional_properties}>"
116
+ end
117
+ end
118
+ end