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,242 @@
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
+ # Search filters and pagination for querying invoices. All filter fields are
9
+ # optional — omit a filter to match all values for that field. **AND across
10
+ # fields, OR within arrays.** When multiple fields are supplied, all must
11
+ # match (AND). When an array-valued field (like `status`) contains multiple
12
+ # values, a match on *any* value satisfies that field (OR).
13
+ class InvoiceSearchRequest < BaseModel
14
+ SKIP = Object.new
15
+ private_constant :SKIP
16
+
17
+ # 1-based page number.
18
+ # @return [Integer]
19
+ attr_accessor :page
20
+
21
+ # Number of results per page (max 100).
22
+ # @return [Integer]
23
+ attr_accessor :page_size
24
+
25
+ # Filter by one or more TQL load numbers (exact match, OR within the array).
26
+ # @return [Array[String]]
27
+ attr_accessor :load_numbers
28
+
29
+ # Filter by one or more factoring company invoice numbers (exact match, OR
30
+ # within the array).
31
+ # @return [Array[String]]
32
+ attr_accessor :invoice_numbers
33
+
34
+ # Filter by one or more invoice statuses (OR within the array).
35
+ # @return [Array[InvoiceStatus]]
36
+ attr_accessor :statuses
37
+
38
+ # Filter by one or more carrier names (partial match, OR within the array).
39
+ # @return [Array[String]]
40
+ attr_accessor :carrier_names
41
+
42
+ # Filter by one or more USDOT numbers (exact match, OR within the array).
43
+ # @return [Array[String]]
44
+ attr_accessor :carrier_dot_numbers
45
+
46
+ # Filter by one or more Motor Carrier (MC) numbers (exact match, OR within
47
+ # the array).
48
+ # @return [Array[String]]
49
+ attr_accessor :carrier_mc_numbers
50
+
51
+ # Only return invoices whose `lastUpdatedAt` is on or after this UTC
52
+ # timestamp.
53
+ # @return [DateTime]
54
+ attr_accessor :last_updated_after
55
+
56
+ # Only return invoices whose `lastUpdatedAt` is before this UTC timestamp.
57
+ # @return [DateTime]
58
+ attr_accessor :last_updated_before
59
+
60
+ # Only return invoices received on or after this UTC timestamp.
61
+ # @return [DateTime]
62
+ attr_accessor :received_after
63
+
64
+ # Only return invoices received before this UTC timestamp.
65
+ # @return [DateTime]
66
+ attr_accessor :received_before
67
+
68
+ # A mapping from model property names to API property names.
69
+ def self.names
70
+ @_hash = {} if @_hash.nil?
71
+ @_hash['page'] = 'page'
72
+ @_hash['page_size'] = 'pageSize'
73
+ @_hash['load_numbers'] = 'loadNumbers'
74
+ @_hash['invoice_numbers'] = 'invoiceNumbers'
75
+ @_hash['statuses'] = 'statuses'
76
+ @_hash['carrier_names'] = 'carrierNames'
77
+ @_hash['carrier_dot_numbers'] = 'carrierDotNumbers'
78
+ @_hash['carrier_mc_numbers'] = 'carrierMcNumbers'
79
+ @_hash['last_updated_after'] = 'lastUpdatedAfter'
80
+ @_hash['last_updated_before'] = 'lastUpdatedBefore'
81
+ @_hash['received_after'] = 'receivedAfter'
82
+ @_hash['received_before'] = 'receivedBefore'
83
+ @_hash
84
+ end
85
+
86
+ # An array for optional fields
87
+ def self.optionals
88
+ %w[
89
+ load_numbers
90
+ invoice_numbers
91
+ statuses
92
+ carrier_names
93
+ carrier_dot_numbers
94
+ carrier_mc_numbers
95
+ last_updated_after
96
+ last_updated_before
97
+ received_after
98
+ received_before
99
+ ]
100
+ end
101
+
102
+ # An array for nullable fields
103
+ def self.nullables
104
+ %w[
105
+ load_numbers
106
+ invoice_numbers
107
+ statuses
108
+ carrier_names
109
+ carrier_dot_numbers
110
+ carrier_mc_numbers
111
+ last_updated_after
112
+ last_updated_before
113
+ received_after
114
+ received_before
115
+ ]
116
+ end
117
+
118
+ def initialize(page:, page_size:, load_numbers: SKIP, invoice_numbers: SKIP,
119
+ statuses: SKIP, carrier_names: SKIP,
120
+ carrier_dot_numbers: SKIP, carrier_mc_numbers: SKIP,
121
+ last_updated_after: SKIP, last_updated_before: SKIP,
122
+ received_after: SKIP, received_before: SKIP,
123
+ additional_properties: nil)
124
+ # Add additional model properties to the instance
125
+ additional_properties = {} if additional_properties.nil?
126
+
127
+ @page = page
128
+ @page_size = page_size
129
+ @load_numbers = load_numbers unless load_numbers == SKIP
130
+ @invoice_numbers = invoice_numbers unless invoice_numbers == SKIP
131
+ @statuses = statuses unless statuses == SKIP
132
+ @carrier_names = carrier_names unless carrier_names == SKIP
133
+ @carrier_dot_numbers = carrier_dot_numbers unless carrier_dot_numbers == SKIP
134
+ @carrier_mc_numbers = carrier_mc_numbers unless carrier_mc_numbers == SKIP
135
+ @last_updated_after = last_updated_after unless last_updated_after == SKIP
136
+ @last_updated_before = last_updated_before unless last_updated_before == SKIP
137
+ @received_after = received_after unless received_after == SKIP
138
+ @received_before = received_before unless received_before == SKIP
139
+ @additional_properties = additional_properties
140
+ end
141
+
142
+ # Creates an instance of the object from a hash.
143
+ def self.from_hash(hash)
144
+ return nil unless hash
145
+
146
+ # Extract variables from the hash.
147
+ page = hash.key?('page') ? hash['page'] : nil
148
+ page_size = hash.key?('pageSize') ? hash['pageSize'] : nil
149
+ load_numbers = hash.key?('loadNumbers') ? hash['loadNumbers'] : SKIP
150
+ invoice_numbers =
151
+ hash.key?('invoiceNumbers') ? hash['invoiceNumbers'] : SKIP
152
+ statuses = hash.key?('statuses') ? hash['statuses'] : SKIP
153
+ carrier_names = hash.key?('carrierNames') ? hash['carrierNames'] : SKIP
154
+ carrier_dot_numbers =
155
+ hash.key?('carrierDotNumbers') ? hash['carrierDotNumbers'] : SKIP
156
+ carrier_mc_numbers =
157
+ hash.key?('carrierMcNumbers') ? hash['carrierMcNumbers'] : SKIP
158
+ last_updated_after = if hash.key?('lastUpdatedAfter')
159
+ (DateTimeHelper.from_rfc3339(hash['lastUpdatedAfter']) if hash['lastUpdatedAfter'])
160
+ else
161
+ SKIP
162
+ end
163
+ last_updated_before = if hash.key?('lastUpdatedBefore')
164
+ (DateTimeHelper.from_rfc3339(hash['lastUpdatedBefore']) if hash['lastUpdatedBefore'])
165
+ else
166
+ SKIP
167
+ end
168
+ received_after = if hash.key?('receivedAfter')
169
+ (DateTimeHelper.from_rfc3339(hash['receivedAfter']) if hash['receivedAfter'])
170
+ else
171
+ SKIP
172
+ end
173
+ received_before = if hash.key?('receivedBefore')
174
+ (DateTimeHelper.from_rfc3339(hash['receivedBefore']) if hash['receivedBefore'])
175
+ else
176
+ SKIP
177
+ end
178
+
179
+ # Create a new hash for additional properties, removing known properties.
180
+ new_hash = hash.reject { |k, _| names.value?(k) }
181
+
182
+ additional_properties = APIHelper.get_additional_properties(
183
+ new_hash, proc { |value| value }
184
+ )
185
+
186
+ # Create object from extracted values.
187
+ InvoiceSearchRequest.new(page: page,
188
+ page_size: page_size,
189
+ load_numbers: load_numbers,
190
+ invoice_numbers: invoice_numbers,
191
+ statuses: statuses,
192
+ carrier_names: carrier_names,
193
+ carrier_dot_numbers: carrier_dot_numbers,
194
+ carrier_mc_numbers: carrier_mc_numbers,
195
+ last_updated_after: last_updated_after,
196
+ last_updated_before: last_updated_before,
197
+ received_after: received_after,
198
+ received_before: received_before,
199
+ additional_properties: additional_properties)
200
+ end
201
+
202
+ def to_custom_last_updated_after
203
+ DateTimeHelper.to_rfc3339(last_updated_after)
204
+ end
205
+
206
+ def to_custom_last_updated_before
207
+ DateTimeHelper.to_rfc3339(last_updated_before)
208
+ end
209
+
210
+ def to_custom_received_after
211
+ DateTimeHelper.to_rfc3339(received_after)
212
+ end
213
+
214
+ def to_custom_received_before
215
+ DateTimeHelper.to_rfc3339(received_before)
216
+ end
217
+
218
+ # Provides a human-readable string representation of the object.
219
+ def to_s
220
+ class_name = self.class.name.split('::').last
221
+ "<#{class_name} page: #{@page}, page_size: #{@page_size}, load_numbers: #{@load_numbers},"\
222
+ " invoice_numbers: #{@invoice_numbers}, statuses: #{@statuses}, carrier_names:"\
223
+ " #{@carrier_names}, carrier_dot_numbers: #{@carrier_dot_numbers}, carrier_mc_numbers:"\
224
+ " #{@carrier_mc_numbers}, last_updated_after: #{@last_updated_after}, last_updated_before:"\
225
+ " #{@last_updated_before}, received_after: #{@received_after}, received_before:"\
226
+ " #{@received_before}, additional_properties: #{@additional_properties}>"
227
+ end
228
+
229
+ # Provides a debugging-friendly string with detailed object information.
230
+ def inspect
231
+ class_name = self.class.name.split('::').last
232
+ "<#{class_name} page: #{@page.inspect}, page_size: #{@page_size.inspect}, load_numbers:"\
233
+ " #{@load_numbers.inspect}, invoice_numbers: #{@invoice_numbers.inspect}, statuses:"\
234
+ " #{@statuses.inspect}, carrier_names: #{@carrier_names.inspect}, carrier_dot_numbers:"\
235
+ " #{@carrier_dot_numbers.inspect}, carrier_mc_numbers: #{@carrier_mc_numbers.inspect},"\
236
+ " last_updated_after: #{@last_updated_after.inspect}, last_updated_before:"\
237
+ " #{@last_updated_before.inspect}, received_after: #{@received_after.inspect},"\
238
+ " received_before: #{@received_before.inspect}, additional_properties:"\
239
+ " #{@additional_properties}>"
240
+ end
241
+ end
242
+ end
@@ -0,0 +1,124 @@
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
+ # Paginated list of invoice search results.
8
+ class InvoiceSearchResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Current page number.
13
+ # @return [Integer]
14
+ attr_accessor :page
15
+
16
+ # Number of results per page.
17
+ # @return [Integer]
18
+ attr_accessor :page_size
19
+
20
+ # Total number of invoices matching the search criteria.
21
+ # @return [Integer]
22
+ attr_accessor :total_count
23
+
24
+ # Total number of pages.
25
+ # @return [Integer]
26
+ attr_accessor :total_pages
27
+
28
+ # Invoices matching the search criteria for this page.
29
+ # @return [Array[Invoice]]
30
+ attr_accessor :results
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['page'] = 'page'
36
+ @_hash['page_size'] = 'pageSize'
37
+ @_hash['total_count'] = 'totalCount'
38
+ @_hash['total_pages'] = 'totalPages'
39
+ @_hash['results'] = 'results'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ page
47
+ page_size
48
+ total_count
49
+ total_pages
50
+ results
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(page: SKIP, page_size: SKIP, total_count: SKIP,
60
+ total_pages: SKIP, results: SKIP, additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @page = page unless page == SKIP
65
+ @page_size = page_size unless page_size == SKIP
66
+ @total_count = total_count unless total_count == SKIP
67
+ @total_pages = total_pages unless total_pages == SKIP
68
+ @results = results unless results == SKIP
69
+ @additional_properties = additional_properties
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ page = hash.key?('page') ? hash['page'] : SKIP
78
+ page_size = hash.key?('pageSize') ? hash['pageSize'] : SKIP
79
+ total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP
80
+ total_pages = hash.key?('totalPages') ? hash['totalPages'] : SKIP
81
+ # Parameter is an array, so we need to iterate through it
82
+ results = nil
83
+ unless hash['results'].nil?
84
+ results = []
85
+ hash['results'].each do |structure|
86
+ results << (Invoice.from_hash(structure) if structure)
87
+ end
88
+ end
89
+
90
+ results = SKIP unless hash.key?('results')
91
+
92
+ # Create a new hash for additional properties, removing known properties.
93
+ new_hash = hash.reject { |k, _| names.value?(k) }
94
+
95
+ additional_properties = APIHelper.get_additional_properties(
96
+ new_hash, proc { |value| value }
97
+ )
98
+
99
+ # Create object from extracted values.
100
+ InvoiceSearchResponse.new(page: page,
101
+ page_size: page_size,
102
+ total_count: total_count,
103
+ total_pages: total_pages,
104
+ results: results,
105
+ additional_properties: additional_properties)
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} page: #{@page}, page_size: #{@page_size}, total_count: #{@total_count},"\
112
+ " total_pages: #{@total_pages}, results: #{@results}, additional_properties:"\
113
+ " #{@additional_properties}>"
114
+ end
115
+
116
+ # Provides a debugging-friendly string with detailed object information.
117
+ def inspect
118
+ class_name = self.class.name.split('::').last
119
+ "<#{class_name} page: #{@page.inspect}, page_size: #{@page_size.inspect}, total_count:"\
120
+ " #{@total_count.inspect}, total_pages: #{@total_pages.inspect}, results:"\
121
+ " #{@results.inspect}, additional_properties: #{@additional_properties}>"
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,74 @@
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
+ # Processing and payment status of an invoice. The lifecycle typically flows:
8
+ # `Received` → `Validating` → `Processing` → `Approved` → `NotPaid` → `Paid`.
9
+ # Branches include `AwaitingDocuments`, `PendingExceptions`, and `Rejected`.
10
+ class InvoiceStatus
11
+ INVOICE_STATUS = [
12
+ # TODO: Write general description for RECEIVED
13
+ RECEIVED = 'Received'.freeze,
14
+
15
+ # TODO: Write general description for VALIDATING
16
+ VALIDATING = 'Validating'.freeze,
17
+
18
+ # TODO: Write general description for PROCESSING
19
+ PROCESSING = 'Processing'.freeze,
20
+
21
+ # TODO: Write general description for AWAITINGDOCUMENTS
22
+ AWAITINGDOCUMENTS = 'AwaitingDocuments'.freeze,
23
+
24
+ # TODO: Write general description for PENDINGEXCEPTIONS
25
+ PENDINGEXCEPTIONS = 'PendingExceptions'.freeze,
26
+
27
+ # TODO: Write general description for APPROVED
28
+ APPROVED = 'Approved'.freeze,
29
+
30
+ # TODO: Write general description for NOTPAID
31
+ NOTPAID = 'NotPaid'.freeze,
32
+
33
+ # TODO: Write general description for PAID
34
+ PAID = 'Paid'.freeze,
35
+
36
+ # TODO: Write general description for PARTIALLYPAID
37
+ PARTIALLYPAID = 'PartiallyPaid'.freeze,
38
+
39
+ # TODO: Write general description for COMPLETE
40
+ COMPLETE = 'Complete'.freeze,
41
+
42
+ # TODO: Write general description for REJECTED
43
+ REJECTED = 'Rejected'.freeze
44
+ ].freeze
45
+
46
+ def self.validate(value)
47
+ return false if value.nil?
48
+
49
+ INVOICE_STATUS.include?(value)
50
+ end
51
+
52
+ def self.from_value(value, default_value = RECEIVED)
53
+ return default_value if value.nil?
54
+
55
+ str = value.to_s.strip
56
+
57
+ case str.downcase
58
+ when 'received' then RECEIVED
59
+ when 'validating' then VALIDATING
60
+ when 'processing' then PROCESSING
61
+ when 'awaitingdocuments' then AWAITINGDOCUMENTS
62
+ when 'pendingexceptions' then PENDINGEXCEPTIONS
63
+ when 'approved' then APPROVED
64
+ when 'notpaid' then NOTPAID
65
+ when 'paid' then PAID
66
+ when 'partiallypaid' then PARTIALLYPAID
67
+ when 'complete' then COMPLETE
68
+ when 'rejected' then REJECTED
69
+ else
70
+ default_value
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,193 @@
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
+ # Current processing state of an invoice, including any outstanding exceptions
9
+ # that require resolution.
10
+ class InvoiceStatusResponse < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # The TQL load number this invoice was submitted against.
15
+ # @return [String]
16
+ attr_accessor :load_number
17
+
18
+ # The factoring company's invoice number.
19
+ # @return [String]
20
+ attr_accessor :invoice_number
21
+
22
+ # Processing and payment status of an invoice. The lifecycle typically
23
+ # flows: `Received` → `Validating` → `Processing` → `Approved` → `NotPaid` →
24
+ # `Paid`. Branches include `AwaitingDocuments`, `PendingExceptions`, and
25
+ # `Rejected`.
26
+ # @return [InvoiceStatus]
27
+ attr_accessor :status
28
+
29
+ # UTC timestamp when the invoice was received.
30
+ # @return [DateTime]
31
+ attr_accessor :received_at
32
+
33
+ # UTC timestamp when processing completed (null if still in progress).
34
+ # @return [DateTime]
35
+ attr_accessor :completed_at
36
+
37
+ # Sum of all charge amounts on the invoice.
38
+ # @return [Float]
39
+ attr_accessor :total_charge_amount
40
+
41
+ # [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency
42
+ # code.
43
+ # @return [String]
44
+ attr_accessor :currency
45
+
46
+ # Documents uploaded and linked to this invoice. Each entry indicates the
47
+ # document type. Empty array means no documents have been received yet.
48
+ # @return [Array[DocumentType]]
49
+ attr_accessor :documents
50
+
51
+ # Outstanding exceptions that need resolution. Empty array means no issues.
52
+ # @return [Array[InvoiceException]]
53
+ attr_accessor :exceptions
54
+
55
+ # A mapping from model property names to API property names.
56
+ def self.names
57
+ @_hash = {} if @_hash.nil?
58
+ @_hash['load_number'] = 'loadNumber'
59
+ @_hash['invoice_number'] = 'invoiceNumber'
60
+ @_hash['status'] = 'status'
61
+ @_hash['received_at'] = 'receivedAt'
62
+ @_hash['completed_at'] = 'completedAt'
63
+ @_hash['total_charge_amount'] = 'totalChargeAmount'
64
+ @_hash['currency'] = 'currency'
65
+ @_hash['documents'] = 'documents'
66
+ @_hash['exceptions'] = 'exceptions'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ load_number
74
+ invoice_number
75
+ status
76
+ received_at
77
+ completed_at
78
+ total_charge_amount
79
+ currency
80
+ documents
81
+ exceptions
82
+ ]
83
+ end
84
+
85
+ # An array for nullable fields
86
+ def self.nullables
87
+ %w[
88
+ completed_at
89
+ ]
90
+ end
91
+
92
+ def initialize(load_number: SKIP, invoice_number: SKIP, status: SKIP,
93
+ received_at: SKIP, completed_at: SKIP,
94
+ total_charge_amount: SKIP, currency: SKIP, documents: SKIP,
95
+ exceptions: SKIP, additional_properties: nil)
96
+ # Add additional model properties to the instance
97
+ additional_properties = {} if additional_properties.nil?
98
+
99
+ @load_number = load_number unless load_number == SKIP
100
+ @invoice_number = invoice_number unless invoice_number == SKIP
101
+ @status = status unless status == SKIP
102
+ @received_at = received_at unless received_at == SKIP
103
+ @completed_at = completed_at unless completed_at == SKIP
104
+ @total_charge_amount = total_charge_amount unless total_charge_amount == SKIP
105
+ @currency = currency unless currency == SKIP
106
+ @documents = documents unless documents == SKIP
107
+ @exceptions = exceptions unless exceptions == SKIP
108
+ @additional_properties = additional_properties
109
+ end
110
+
111
+ # Creates an instance of the object from a hash.
112
+ def self.from_hash(hash)
113
+ return nil unless hash
114
+
115
+ # Extract variables from the hash.
116
+ load_number = hash.key?('loadNumber') ? hash['loadNumber'] : SKIP
117
+ invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP
118
+ status = hash.key?('status') ? hash['status'] : SKIP
119
+ received_at = if hash.key?('receivedAt')
120
+ (DateTimeHelper.from_rfc3339(hash['receivedAt']) if hash['receivedAt'])
121
+ else
122
+ SKIP
123
+ end
124
+ completed_at = if hash.key?('completedAt')
125
+ (DateTimeHelper.from_rfc3339(hash['completedAt']) if hash['completedAt'])
126
+ else
127
+ SKIP
128
+ end
129
+ total_charge_amount =
130
+ hash.key?('totalChargeAmount') ? hash['totalChargeAmount'] : SKIP
131
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
132
+ documents = hash.key?('documents') ? hash['documents'] : SKIP
133
+ # Parameter is an array, so we need to iterate through it
134
+ exceptions = nil
135
+ unless hash['exceptions'].nil?
136
+ exceptions = []
137
+ hash['exceptions'].each do |structure|
138
+ exceptions << (InvoiceException.from_hash(structure) if structure)
139
+ end
140
+ end
141
+
142
+ exceptions = SKIP unless hash.key?('exceptions')
143
+
144
+ # Create a new hash for additional properties, removing known properties.
145
+ new_hash = hash.reject { |k, _| names.value?(k) }
146
+
147
+ additional_properties = APIHelper.get_additional_properties(
148
+ new_hash, proc { |value| value }
149
+ )
150
+
151
+ # Create object from extracted values.
152
+ InvoiceStatusResponse.new(load_number: load_number,
153
+ invoice_number: invoice_number,
154
+ status: status,
155
+ received_at: received_at,
156
+ completed_at: completed_at,
157
+ total_charge_amount: total_charge_amount,
158
+ currency: currency,
159
+ documents: documents,
160
+ exceptions: exceptions,
161
+ additional_properties: additional_properties)
162
+ end
163
+
164
+ def to_custom_received_at
165
+ DateTimeHelper.to_rfc3339(received_at)
166
+ end
167
+
168
+ def to_custom_completed_at
169
+ DateTimeHelper.to_rfc3339(completed_at)
170
+ end
171
+
172
+ # Provides a human-readable string representation of the object.
173
+ def to_s
174
+ class_name = self.class.name.split('::').last
175
+ "<#{class_name} load_number: #{@load_number}, invoice_number: #{@invoice_number}, status:"\
176
+ " #{@status}, received_at: #{@received_at}, completed_at: #{@completed_at},"\
177
+ " total_charge_amount: #{@total_charge_amount}, currency: #{@currency}, documents:"\
178
+ " #{@documents}, exceptions: #{@exceptions}, additional_properties:"\
179
+ " #{@additional_properties}>"
180
+ end
181
+
182
+ # Provides a debugging-friendly string with detailed object information.
183
+ def inspect
184
+ class_name = self.class.name.split('::').last
185
+ "<#{class_name} load_number: #{@load_number.inspect}, invoice_number:"\
186
+ " #{@invoice_number.inspect}, status: #{@status.inspect}, received_at:"\
187
+ " #{@received_at.inspect}, completed_at: #{@completed_at.inspect}, total_charge_amount:"\
188
+ " #{@total_charge_amount.inspect}, currency: #{@currency.inspect}, documents:"\
189
+ " #{@documents.inspect}, exceptions: #{@exceptions.inspect}, additional_properties:"\
190
+ " #{@additional_properties}>"
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,50 @@
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 purpose of the invoice being submitted. - **Invoice** — A
8
+ # standard carrier invoice for freight services rendered on a load. This is
9
+ # the initial, primary billing submitted by the factoring company on behalf
10
+ # of the carrier. - **BalanceDue** — A follow-up invoice for the remaining
11
+ # balance after a partial payment or short-pay on a previously submitted
12
+ # invoice. Use this type when the original invoice was paid at less than the
13
+ # full amount and the carrier is billing for the difference. -
14
+ # **Supplemental** — An additional invoice for charges that were not
15
+ # included on the original invoice. Common examples include detention
16
+ # charges, lumper fees, or other accessorials discovered or finalized after
17
+ # the initial invoice was submitted.
18
+ class InvoiceType
19
+ INVOICE_TYPE = [
20
+ # TODO: Write general description for INVOICE
21
+ INVOICE = 'Invoice'.freeze,
22
+
23
+ # TODO: Write general description for BALANCEDUE
24
+ BALANCEDUE = 'BalanceDue'.freeze,
25
+
26
+ # TODO: Write general description for SUPPLEMENTAL
27
+ SUPPLEMENTAL = 'Supplemental'.freeze
28
+ ].freeze
29
+
30
+ def self.validate(value)
31
+ return false if value.nil?
32
+
33
+ INVOICE_TYPE.include?(value)
34
+ end
35
+
36
+ def self.from_value(value, default_value = INVOICE)
37
+ return default_value if value.nil?
38
+
39
+ str = value.to_s.strip
40
+
41
+ case str.downcase
42
+ when 'invoice' then INVOICE
43
+ when 'balancedue' then BALANCEDUE
44
+ when 'supplemental' then SUPPLEMENTAL
45
+ else
46
+ default_value
47
+ end
48
+ end
49
+ end
50
+ end