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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9f17616cccc9924a2b32b77928484e5059d59aafe59799b83c163ea0ca8c8fca
4
+ data.tar.gz: 4aefe8f560d4933b14a2aae9e1b134909972b38be2ffe403ee68d1f5473d19fd
5
+ SHA512:
6
+ metadata.gz: 965c001bdf3d38c93c37d4c54a014d5efa4b2732d1db90ec51946b90998b63bdf95dbdc6c0ed10792d4de2cbc555645ef9bbc28c8600a72550a6936d2167ecf5
7
+ data.tar.gz: 9471e1d80168cdd85ef293aaa05d59860b04012e3207e314be29074b3a6ede4e3f0ec13d1edfc90708aa1cf4cbe31025753ab6a9eb3874fe629c802a7fb3a7a7
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,210 @@
1
+
2
+ # Getting Started with TQL <> OTR — Factoring Data Exchange
3
+
4
+ ## Introduction
5
+
6
+ ### Overview
7
+
8
+ The **TQL &lt;&gt; OTR Factoring Data Exchange** API enables factoring clients to submit carrier invoices against loads managed by TQL, upload supporting documentation, search for invoices, and check processing status including any outstanding exceptions.
9
+
10
+ #### Key Capabilities
11
+
12
+ - **Invoice Submission** — `POST /api/invoices` — Submit a factoring company invoice referencing a TQL load, including carrier details, stops, charges, and reference numbers.
13
+ - **Invoice Search** — `POST /api/invoices/search` — Search and retrieve a paginated list of invoices with status and last-updated timestamps.
14
+ - **Invoice Status** — `GET /api/invoices/{invoiceNumber}` — Retrieve the current processing status of an invoice, including any outstanding exceptions.
15
+ - **Document Upload** — `POST /api/documents` — Upload a supporting document (BOL, rate confirmation, proof of delivery, etc.) via `multipart/form-data` and link it to an invoice. Supports arbitrary key-value tags for metadata.
16
+ - **Carrier Assignment** — `PUT /api/assignments` — Notify TQL that a factoring company has been assigned to (or unassigned from) a carrier, including the effective date.
17
+ - **Load Lookup** — `GET /api/loads/{loadNumber}` — Verify a load exists in TQL's system and retrieve basic details (carrier, status, dates).
18
+ - **Load Search** — `POST /api/loads/search` — Search for TQL loads by carrier, date range, or status.
19
+
20
+ #### Authentication
21
+
22
+ This API uses **[OAuth 2.0 Client Credentials](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)** for authentication. TQL will provision each factoring partner with a unique **Client ID** and **Client Secret** during onboarding.
23
+
24
+ **How it works:**
25
+
26
+ 1. **Obtain an access token** — Make a `POST` request to the TQL
27
+ token endpoint with your Client ID and Client Secret using the
28
+ `client_credentials` grant type.
29
+
30
+ 2. **Include the token** — Pass the access token as a Bearer token
31
+ in the `Authorization` header on every API request:
32
+ `Authorization: Bearer <access_token>`
33
+
34
+ 3. **Token expiry** — Access tokens have a limited lifetime
35
+ (typically 1 hour). When the token expires, request a new one from
36
+ the token endpoint. Do **not** request a new token on every API
37
+ call — cache and reuse the token until it expires.
38
+
39
+ **Required scopes:**
40
+
41
+ - **`Factoring.Write`** — Submit invoices, upload documents, manage assignments
42
+ - **`Factoring.Read`** — Query invoice status, search invoices
43
+ The scopes your client is allowed to request are configured during onboarding. Include the required scope(s) in the `scope` parameter when requesting a token.
44
+
45
+ **Example token request:**
46
+
47
+ POST /oauth2/token HTTP/1.1
48
+ Content-Type: application/x-www-form-urlencoded
49
+
50
+ grant_type=client_credentials
51
+ &client_id=<your_client_id>
52
+ &client_secret=<your_client_secret>
53
+ &scope=Factoring.Write Factoring.Read
54
+
55
+ TQL will provide the exact token endpoint URL, Client ID, and Client Secret during partner onboarding.
56
+
57
+ #### Philosophy
58
+
59
+ - **Authentication** — All endpoints require a valid OAuth 2.0 Bearer token in the `Authorization` header. See the **Authentication** section above for details.
60
+ - **Asynchronous processing** — Write endpoints return `202 Accepted` immediately; poll `GET /api/invoices/{invoiceNumber}` for completion and exceptions.
61
+ - **Error handling** — Non-2xx responses follow [RFC 7807 Problem Details](https://datatracker.ietf.org/doc/html/rfc7807) with `title`, `status`, and `detail` fields.
62
+
63
+ ## Install the Package
64
+
65
+ Install the gem from the command line:
66
+
67
+ ```bash
68
+ gem install apimatic-tql-sdk -v 0.0.1
69
+ ```
70
+
71
+ Or add the gem to your Gemfile and run `bundle`:
72
+
73
+ ```ruby
74
+ gem 'apimatic-tql-sdk', '0.0.1'
75
+ ```
76
+
77
+ For additional gem details, see the [RubyGems page for the apimatic-tql-sdk gem](https://rubygems.org/gems/apimatic-tql-sdk/versions/0.0.1).
78
+
79
+ ## IRB Console Usage
80
+
81
+ You can explore the SDK interactively using IRB in two ways
82
+
83
+ ### 1. Use IRB with Installed Gem
84
+
85
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
86
+
87
+ ```bash
88
+ irb
89
+ ```
90
+
91
+ Now you can load the SDK in the IRB
92
+
93
+ ```ruby
94
+ require 'tql_otr_factoring_data_exchange'
95
+ include TqlOtrFactoringDataExchange
96
+ ```
97
+
98
+ ### 2. Use IRB within SDK
99
+
100
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
101
+
102
+ ```
103
+ cd path/to/tql_otr_factoring_data_exchange
104
+ ```
105
+
106
+ Now you can start the preconfigured irb console by running the following command
107
+
108
+ ```bash
109
+ ruby bin/console
110
+ ```
111
+
112
+ **_Note:_** This automatically loads the SDK from lib/
113
+
114
+ ## Initialize the API Client
115
+
116
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/client.md)
117
+
118
+ The following parameters are configurable for the API Client:
119
+
120
+ | Parameter | Type | Description |
121
+ | --- | --- | --- |
122
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
123
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
124
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
125
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
126
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
127
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
128
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
129
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
130
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
131
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
132
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
133
+ | client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
134
+
135
+ The API client can be initialized as follows:
136
+
137
+ ### Code-Based Client Initialization
138
+
139
+ ```ruby
140
+ require 'tql_otr_factoring_data_exchange'
141
+ include TqlOtrFactoringDataExchange
142
+
143
+ client = Client.new(
144
+ client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
145
+ oauth_client_id: 'OAuthClientId',
146
+ oauth_client_secret: 'OAuthClientSecret',
147
+ oauth_scopes: [
148
+ OauthScope::FACTORING_WRITE,
149
+ OauthScope::FACTORING_READ
150
+ ]
151
+ ),
152
+ logging_configuration: LoggingConfiguration.new(
153
+ log_level: Logger::INFO,
154
+ request_logging_config: RequestLoggingConfiguration.new(
155
+ log_body: true
156
+ ),
157
+ response_logging_config: ResponseLoggingConfiguration.new(
158
+ log_headers: true
159
+ )
160
+ )
161
+ )
162
+ ```
163
+
164
+ ### Environment-Based Client Initialization
165
+
166
+ ```ruby
167
+ require 'tql_otr_factoring_data_exchange'
168
+ include TqlOtrFactoringDataExchange
169
+
170
+ # Create client from environment
171
+ client = Client.from_env
172
+ ```
173
+
174
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
175
+
176
+ ## Authorization
177
+
178
+ This API uses the following authentication schemes.
179
+
180
+ * [`bearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md)
181
+
182
+ ## List of APIs
183
+
184
+ * [Invoices](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/controllers/invoices.md)
185
+ * [Documents](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/controllers/documents.md)
186
+ * [Assignments](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/controllers/assignments.md)
187
+ * [Loads](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/controllers/loads.md)
188
+
189
+ ## SDK Infrastructure
190
+
191
+ ### Configuration
192
+
193
+ * [ProxySettings](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
194
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
195
+ * [AbstractLogger](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
196
+ * [LoggingConfiguration](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
197
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
198
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
199
+
200
+ ### HTTP
201
+
202
+ * [HttpResponse](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/http-response.md)
203
+ * [HttpRequest](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/http-request.md)
204
+
205
+ ### Utilities
206
+
207
+ * [ApiResponse](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/api-response.md)
208
+ * [ApiHelper](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/api-helper.md)
209
+ * [DateTimeHelper](https://www.github.com/sdks-io/apimatic-tql-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
210
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'tql_otr_factoring_data_exchange'
8
+
9
+ puts 'TqlOtrFactoringDataExchange SDK loaded!'
10
+ puts 'You can now create a client with: client = TqlOtrFactoringDataExchange::Client.new'
11
+ puts 'Or use from_env: client = TqlOtrFactoringDataExchange::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,45 @@
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
+ # AssignmentsApi
8
+ class AssignmentsApi < BaseApi
9
+ # Notify TQL that a factoring company has been assigned to — or unassigned
10
+ # from — a carrier. The request is idempotent; sending the same carrier +
11
+ # status combination again is a no-op.
12
+ # The `effectiveDate` field indicates the date the assignment or
13
+ # un-assignment took effect (i.e., the "as of" date).
14
+ # **Load event webhooks:** Assigning a carrier also serves as a subscription
15
+ # to load event webhooks for that carrier. Once a carrier is assigned, TQL
16
+ # will begin pushing webhook notifications (e.g., Load Created, Load
17
+ # Dispatched, Load Delivered) for loads where that carrier is the assigned
18
+ # carrier. Unassigning the carrier stops these notifications. The webhook
19
+ # endpoint URL is configured during partner onboarding.
20
+ # @param [AssignmentRequest] body Required parameter: The carrier assignment
21
+ # payload including carrier identity, assignment status, and effective
22
+ # date.
23
+ # @return [ApiResponse] Complete http response with raw body and status code.
24
+ def upsert_assignment(body)
25
+ @api_call
26
+ .request(new_request_builder(HttpMethodEnum::PUT,
27
+ '/api/assignments',
28
+ Server::DEFAULT)
29
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
30
+ .body_param(new_parameter(body)
31
+ .is_required(true))
32
+ .header_param(new_parameter('application/json', key: 'accept'))
33
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
34
+ .auth(Single.new('bearerAuth')))
35
+ .response(new_response_handler
36
+ .deserializer(APIHelper.method(:custom_type_deserializer))
37
+ .deserialize_into(AssignmentResponse.method(:from_hash))
38
+ .is_api_response(true)
39
+ .local_error('400',
40
+ "Validation error — missing required fields or invalid data.\n",
41
+ ProblemDetailsErrorException))
42
+ .execute
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/0.0.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
19
+ '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
20
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
21
+ }
22
+ end
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,82 @@
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
+ # DocumentsApi
8
+ class DocumentsApi < BaseApi
9
+ # Upload a document via `multipart/form-data` and associate it with an
10
+ # invoice. The request contains two parts:
11
+ # - **file** — the raw binary document content
12
+ # - **metadata** — a JSON string containing the invoice ID,
13
+ # document type, optional file name, and key-value tags
14
+ # (e.g., `"shortage": "2"`, `"palletCount": "14"`)
15
+ # **Supported document types** are listed in the `DocumentType` enum.
16
+ # Accepted asynchronously — returns `202` with a document receipt. To upload
17
+ # multiple documents, make one request per document.
18
+ # @param [File | UploadIO] file Required parameter: The document file
19
+ # content.
20
+ # @param [DocumentUploadMetadata] metadata Required parameter: Metadata for
21
+ # the document upload, provided as the `metadata` part of the
22
+ # `multipart/form-data` request. Specifies the invoice linkage, document
23
+ # classification, and optional tags.
24
+ # @return [ApiResponse] Complete http response with raw body and status code.
25
+ def upload_document(file,
26
+ metadata)
27
+ @api_call
28
+ .request(new_request_builder(HttpMethodEnum::POST,
29
+ '/api/documents',
30
+ Server::DEFAULT)
31
+ .multipart_param(new_parameter(file, key: 'file')
32
+ .is_required(true)
33
+ .default_content_type('application/octet-stream'))
34
+ .multipart_param(new_parameter(StringIO.new(metadata.to_json), key: 'metadata')
35
+ .is_required(true)
36
+ .default_content_type('application/json'))
37
+ .header_param(new_parameter('application/json', key: 'accept'))
38
+ .auth(Single.new('bearerAuth')))
39
+ .response(new_response_handler
40
+ .deserializer(APIHelper.method(:custom_type_deserializer))
41
+ .deserialize_into(DocumentUploadResponse.method(:from_hash))
42
+ .is_api_response(true)
43
+ .local_error('400',
44
+ "Validation error — missing required fields or invalid document'\
45
+ ' type.\n",
46
+ ProblemDetailsErrorException))
47
+ .execute
48
+ end
49
+
50
+ # Upload a document as a base64-encoded string in a JSON request body and
51
+ # associate it with an invoice. Use this endpoint when `multipart/form-data`
52
+ # is inconvenient (e.g., from environments that prefer pure JSON payloads).
53
+ # **Supported document types** are listed in the `DocumentType` enum.
54
+ # Accepted asynchronously — returns `202` with a document receipt. To upload
55
+ # multiple documents, make one request per document.
56
+ # @param [Base64DocumentUploadRequest] body Required parameter: A JSON
57
+ # payload containing the base64-encoded document content along with invoice
58
+ # linkage, document type, and optional tags.
59
+ # @return [ApiResponse] Complete http response with raw body and status code.
60
+ def upload_document_base64(body)
61
+ @api_call
62
+ .request(new_request_builder(HttpMethodEnum::POST,
63
+ '/api/documents/base64',
64
+ Server::DEFAULT)
65
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
66
+ .body_param(new_parameter(body)
67
+ .is_required(true))
68
+ .header_param(new_parameter('application/json', key: 'accept'))
69
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
70
+ .auth(Single.new('bearerAuth')))
71
+ .response(new_response_handler
72
+ .deserializer(APIHelper.method(:custom_type_deserializer))
73
+ .deserialize_into(DocumentUploadResponse.method(:from_hash))
74
+ .is_api_response(true)
75
+ .local_error('400',
76
+ "Validation error — missing required fields or invalid document'\
77
+ ' type.\n",
78
+ ProblemDetailsErrorException))
79
+ .execute
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,114 @@
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
+ # InvoicesApi
8
+ class InvoicesApi < BaseApi
9
+ # Submit a factoring company invoice against a TQL load. The request must
10
+ # include the TQL load number, the factoring company's invoice number,
11
+ # carrier details, at least two stops (origin and destination), one or more
12
+ # charges, and at least one reference number.
13
+ # The invoice is accepted asynchronously — a `202 Accepted` response is
14
+ # returned immediately with the generated invoice ID. Use `GET
15
+ # /api/invoices/{invoiceNumber}` to poll for processing completion and to
16
+ # retrieve any exceptions.
17
+ # @param [SubmitInvoiceRequest] body Required parameter: The factoring
18
+ # company invoice payload including TQL load number, factoring company
19
+ # invoice number, carrier information, stops, charges, reference numbers,
20
+ # and operational dates.
21
+ # @return [ApiResponse] Complete http response with raw body and status code.
22
+ def submit_invoice(body)
23
+ @api_call
24
+ .request(new_request_builder(HttpMethodEnum::POST,
25
+ '/api/invoices',
26
+ Server::DEFAULT)
27
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
28
+ .body_param(new_parameter(body)
29
+ .is_required(true))
30
+ .header_param(new_parameter('application/json', key: 'accept'))
31
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
32
+ .auth(Single.new('bearerAuth')))
33
+ .response(new_response_handler
34
+ .deserializer(APIHelper.method(:custom_type_deserializer))
35
+ .deserialize_into(SubmitInvoiceResponse.method(:from_hash))
36
+ .is_api_response(true)
37
+ .local_error('400',
38
+ "Validation error — the request body is missing required fields'\
39
+ ' or contains invalid data. Review the `detail` field for'\
40
+ ' specifics.\n",
41
+ ProblemDetailsErrorException))
42
+ .execute
43
+ end
44
+
45
+ # Retrieve the current processing status of a previously submitted invoice.
46
+ # If processing is complete, the response indicates success. If there are
47
+ # outstanding exceptions (missing documents, charge discrepancies, data
48
+ # mismatches, etc.), they are listed in the `exceptions` array.
49
+ # This endpoint also confirms whether data you submitted has been ingested —
50
+ # if `status` is `Received` or beyond, the data is in the system.
51
+ # @param [String] invoice_number Required parameter: The factoring company's
52
+ # invoice number (provided when submitting via `POST /api/invoices`).
53
+ # @return [ApiResponse] Complete http response with raw body and status code.
54
+ def get_invoice_status(invoice_number)
55
+ @api_call
56
+ .request(new_request_builder(HttpMethodEnum::GET,
57
+ '/api/invoices/{invoiceNumber}',
58
+ Server::DEFAULT)
59
+ .template_param(new_parameter(invoice_number, key: 'invoiceNumber')
60
+ .is_required(true)
61
+ .should_encode(true))
62
+ .header_param(new_parameter('application/json', key: 'accept'))
63
+ .auth(Single.new('bearerAuth')))
64
+ .response(new_response_handler
65
+ .deserializer(APIHelper.method(:custom_type_deserializer))
66
+ .deserialize_into(InvoiceStatusResponse.method(:from_hash))
67
+ .is_api_response(true)
68
+ .local_error('404',
69
+ "Invoice not found — no invoice exists with the specified'\
70
+ ' invoice number.\n",
71
+ ProblemDetailsErrorException))
72
+ .execute
73
+ end
74
+
75
+ # Search for invoices using optional filter criteria. Returns a paginated
76
+ # list of invoice summaries including the invoice ID, a direct URI to
77
+ # retrieve full details, the factoring company invoice number, TQL load
78
+ # number, current status, and the last-updated timestamp.
79
+ # **Scoping:** Results are automatically scoped to invoices submitted by the
80
+ # authenticated factoring company. You will only see invoices where *you*
81
+ # are the factor — you cannot query invoices submitted by other parties.
82
+ # **Filter logic:** Filters use **AND** across different fields and **OR**
83
+ # within array-valued fields. For example, searching with `lastUpdatedAfter
84
+ # = 2026-04-03` **and** `statuses = [Approved, PendingExceptions]` returns
85
+ # invoices updated today that are in *either* `Approved` or
86
+ # `PendingExceptions` status.
87
+ # This is a synchronous call — results are returned immediately.
88
+ # @param [InvoiceSearchRequest] body Required parameter: Search filters and
89
+ # pagination parameters. All filter fields are optional — omit a field to
90
+ # skip that filter. Provide at least `page` and `pageSize` for pagination.
91
+ # @return [ApiResponse] Complete http response with raw body and status code.
92
+ def search_invoices(body)
93
+ @api_call
94
+ .request(new_request_builder(HttpMethodEnum::POST,
95
+ '/api/invoices/search',
96
+ Server::DEFAULT)
97
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
98
+ .body_param(new_parameter(body)
99
+ .is_required(true))
100
+ .header_param(new_parameter('application/json', key: 'accept'))
101
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
102
+ .auth(Single.new('bearerAuth')))
103
+ .response(new_response_handler
104
+ .deserializer(APIHelper.method(:custom_type_deserializer))
105
+ .deserialize_into(InvoiceSearchResponse.method(:from_hash))
106
+ .is_api_response(true)
107
+ .local_error('400',
108
+ "Validation error — invalid filter criteria or pagination'\
109
+ ' parameters.\n",
110
+ ProblemDetailsErrorException))
111
+ .execute
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,68 @@
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
+ # LoadsApi
8
+ class LoadsApi < BaseApi
9
+ # Retrieve basic details for a TQL load by its load number. Use this to
10
+ # verify a load exists in TQL's system and to confirm carrier assignment,
11
+ # load status, and shipment dates before submitting an invoice.
12
+ # @param [String] load_number Required parameter: The TQL load number.
13
+ # @return [ApiResponse] Complete http response with raw body and status code.
14
+ def get_load(load_number)
15
+ @api_call
16
+ .request(new_request_builder(HttpMethodEnum::GET,
17
+ '/api/loads/{loadNumber}',
18
+ Server::DEFAULT)
19
+ .template_param(new_parameter(load_number, key: 'loadNumber')
20
+ .is_required(true)
21
+ .should_encode(true))
22
+ .header_param(new_parameter('application/json', key: 'accept'))
23
+ .auth(Single.new('bearerAuth')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(LoadDetail.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('404',
29
+ "Load not found — no load exists with the specified load number'\
30
+ '.\n",
31
+ ProblemDetailsErrorException))
32
+ .execute
33
+ end
34
+
35
+ # Search for TQL loads using optional filter criteria. Returns a paginated
36
+ # list of load summaries. Use this to find loads by carrier, date range, or
37
+ # status.
38
+ # **Scoping:** Results are scoped to loads where the authenticated factoring
39
+ # company's assigned carriers are the carrier on the load.
40
+ # **Filter logic:** Filters use **AND** across different fields and **OR**
41
+ # within array-valued fields.
42
+ # @param [LoadSearchRequest] body Required parameter: Search filters and
43
+ # pagination parameters. All filter fields are optional — omit a field to
44
+ # skip that filter.
45
+ # @return [ApiResponse] Complete http response with raw body and status code.
46
+ def search_loads(body)
47
+ @api_call
48
+ .request(new_request_builder(HttpMethodEnum::POST,
49
+ '/api/loads/search',
50
+ Server::DEFAULT)
51
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
52
+ .body_param(new_parameter(body)
53
+ .is_required(true))
54
+ .header_param(new_parameter('application/json', key: 'accept'))
55
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
56
+ .auth(Single.new('bearerAuth')))
57
+ .response(new_response_handler
58
+ .deserializer(APIHelper.method(:custom_type_deserializer))
59
+ .deserialize_into(LoadSearchResponse.method(:from_hash))
60
+ .is_api_response(true)
61
+ .local_error('400',
62
+ "Validation error — invalid filter criteria or pagination'\
63
+ ' parameters.\n",
64
+ ProblemDetailsErrorException))
65
+ .execute
66
+ end
67
+ end
68
+ end