apimatic-tql-sdk 0.0.1 → 0.0.2

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 (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +148 -197
  3. data/bin/console +4 -4
  4. data/lib/freight_financials_webhook_ingestion_api/api_helper.rb +10 -0
  5. data/lib/freight_financials_webhook_ingestion_api/apis/assignments_api.rb +41 -0
  6. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/apis/base_api.rb +60 -60
  7. data/lib/freight_financials_webhook_ingestion_api/apis/documents_api.rb +73 -0
  8. data/lib/freight_financials_webhook_ingestion_api/apis/freight_audit_api.rb +54 -0
  9. data/lib/freight_financials_webhook_ingestion_api/apis/invoices_api.rb +107 -0
  10. data/lib/freight_financials_webhook_ingestion_api/apis/loads_api.rb +72 -0
  11. data/lib/freight_financials_webhook_ingestion_api/apis/rating_api.rb +45 -0
  12. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/client.rb +83 -97
  13. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/configuration.rb +114 -126
  14. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/exceptions/api_exception.rb +21 -21
  15. data/lib/{tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb → freight_financials_webhook_ingestion_api/exceptions/problem_details_exception.rb} +51 -41
  16. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/http/api_response.rb +7 -7
  17. data/lib/freight_financials_webhook_ingestion_api/http/http_call_back.rb +10 -0
  18. data/lib/freight_financials_webhook_ingestion_api/http/http_method_enum.rb +10 -0
  19. data/lib/freight_financials_webhook_ingestion_api/http/http_request.rb +10 -0
  20. data/lib/freight_financials_webhook_ingestion_api/http/http_response.rb +10 -0
  21. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/http/proxy_settings.rb +6 -6
  22. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/logging/configuration/api_logging_configuration.rb +6 -6
  23. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/logging/sdk_logger.rb +6 -6
  24. data/lib/freight_financials_webhook_ingestion_api/models/address.rb +123 -0
  25. data/lib/freight_financials_webhook_ingestion_api/models/assignment_request.rb +94 -0
  26. data/lib/freight_financials_webhook_ingestion_api/models/assignment_response.rb +83 -0
  27. data/lib/{tql_otr_factoring_data_exchange/models/assignment_response.rb → freight_financials_webhook_ingestion_api/models/assignment_response_data.rb} +124 -126
  28. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/models/base_model.rb +110 -110
  29. data/lib/{tql_otr_factoring_data_exchange/models/carrier1.rb → freight_financials_webhook_ingestion_api/models/carrier.rb} +96 -98
  30. data/lib/freight_financials_webhook_ingestion_api/models/charge.rb +104 -0
  31. data/lib/freight_financials_webhook_ingestion_api/models/charge_code.rb +81 -0
  32. data/lib/freight_financials_webhook_ingestion_api/models/factoring_company.rb +81 -0
  33. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/models/invoice.rb +204 -223
  34. data/lib/{tql_otr_factoring_data_exchange/models/document.rb → freight_financials_webhook_ingestion_api/models/invoice_document.rb} +72 -86
  35. data/lib/{tql_otr_factoring_data_exchange/models/invoice_exception.rb → freight_financials_webhook_ingestion_api/models/invoice_issue.rb} +122 -136
  36. data/lib/freight_financials_webhook_ingestion_api/models/invoice_status_response.rb +83 -0
  37. data/lib/{tql_otr_factoring_data_exchange/models/invoice_status_response.rb → freight_financials_webhook_ingestion_api/models/invoice_status_response_data.rb} +185 -193
  38. data/lib/freight_financials_webhook_ingestion_api/models/line_item.rb +131 -0
  39. data/lib/freight_financials_webhook_ingestion_api/models/load_response.rb +83 -0
  40. data/lib/{tql_otr_factoring_data_exchange/models/load_detail.rb → freight_financials_webhook_ingestion_api/models/load_response_data.rb} +141 -140
  41. data/lib/{tql_otr_factoring_data_exchange/models/load.rb → freight_financials_webhook_ingestion_api/models/load_slim.rb} +97 -110
  42. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_charge.rb +116 -0
  43. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_customer.rb +64 -0
  44. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_line_item.rb +177 -0
  45. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb +208 -0
  46. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_requested_charge.rb +64 -0
  47. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb +112 -0
  48. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_stop.rb +107 -0
  49. data/lib/freight_financials_webhook_ingestion_api/models/navix_rate_vendor.rb +88 -0
  50. data/lib/freight_financials_webhook_ingestion_api/models/navix_webhook_event_type.rb +56 -0
  51. data/lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb +99 -0
  52. data/lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb +111 -0
  53. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/models/payment.rb +94 -108
  54. data/lib/freight_financials_webhook_ingestion_api/models/rating_charge_qualifier.rb +68 -0
  55. data/lib/freight_financials_webhook_ingestion_api/models/rating_response_format.rb +40 -0
  56. data/lib/freight_financials_webhook_ingestion_api/models/reference_number.rb +71 -0
  57. data/lib/{tql_otr_factoring_data_exchange/models/invoice_search_request.rb → freight_financials_webhook_ingestion_api/models/search_request.rb} +223 -242
  58. data/lib/freight_financials_webhook_ingestion_api/models/search_response.rb +83 -0
  59. data/lib/freight_financials_webhook_ingestion_api/models/stop.rb +81 -0
  60. data/lib/freight_financials_webhook_ingestion_api/models/submit_invoice_request.rb +228 -0
  61. data/lib/freight_financials_webhook_ingestion_api/models/submit_invoice_response.rb +83 -0
  62. data/lib/{tql_otr_factoring_data_exchange/models/submit_invoice_response.rb → freight_financials_webhook_ingestion_api/models/submit_invoice_response_data.rb} +105 -107
  63. data/lib/freight_financials_webhook_ingestion_api/models/upload_request.rb +128 -0
  64. data/lib/freight_financials_webhook_ingestion_api/models/upload_response.rb +83 -0
  65. data/lib/{tql_otr_factoring_data_exchange/models/document_upload_response.rb → freight_financials_webhook_ingestion_api/models/upload_response_data.rb} +117 -137
  66. data/lib/freight_financials_webhook_ingestion_api/utilities/date_time_helper.rb +11 -0
  67. data/lib/{tql_otr_factoring_data_exchange → freight_financials_webhook_ingestion_api}/utilities/file_wrapper.rb +17 -17
  68. data/lib/freight_financials_webhook_ingestion_api.rb +127 -0
  69. metadata +67 -74
  70. data/lib/tql_otr_factoring_data_exchange/api_helper.rb +0 -10
  71. data/lib/tql_otr_factoring_data_exchange/apis/assignments_api.rb +0 -45
  72. data/lib/tql_otr_factoring_data_exchange/apis/documents_api.rb +0 -82
  73. data/lib/tql_otr_factoring_data_exchange/apis/invoices_api.rb +0 -114
  74. data/lib/tql_otr_factoring_data_exchange/apis/loads_api.rb +0 -68
  75. data/lib/tql_otr_factoring_data_exchange/apis/oauth_authorization_api.rb +0 -44
  76. data/lib/tql_otr_factoring_data_exchange/exceptions/oauth_provider_exception.rb +0 -64
  77. data/lib/tql_otr_factoring_data_exchange/http/auth/oauth_2.rb +0 -156
  78. data/lib/tql_otr_factoring_data_exchange/http/http_call_back.rb +0 -10
  79. data/lib/tql_otr_factoring_data_exchange/http/http_method_enum.rb +0 -10
  80. data/lib/tql_otr_factoring_data_exchange/http/http_request.rb +0 -10
  81. data/lib/tql_otr_factoring_data_exchange/http/http_response.rb +0 -10
  82. data/lib/tql_otr_factoring_data_exchange/models/assignment_request.rb +0 -140
  83. data/lib/tql_otr_factoring_data_exchange/models/assignment_status.rb +0 -36
  84. data/lib/tql_otr_factoring_data_exchange/models/base64_document.rb +0 -118
  85. data/lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb +0 -107
  86. data/lib/tql_otr_factoring_data_exchange/models/carrier.rb +0 -98
  87. data/lib/tql_otr_factoring_data_exchange/models/carrier2.rb +0 -98
  88. data/lib/tql_otr_factoring_data_exchange/models/carrier_input.rb +0 -123
  89. data/lib/tql_otr_factoring_data_exchange/models/carrier_input1.rb +0 -123
  90. data/lib/tql_otr_factoring_data_exchange/models/charge_code.rb +0 -126
  91. data/lib/tql_otr_factoring_data_exchange/models/charge_code_origin.rb +0 -49
  92. data/lib/tql_otr_factoring_data_exchange/models/charge_input.rb +0 -146
  93. data/lib/tql_otr_factoring_data_exchange/models/document_type.rb +0 -288
  94. data/lib/tql_otr_factoring_data_exchange/models/document_upload_metadata.rb +0 -111
  95. data/lib/tql_otr_factoring_data_exchange/models/exception_severity.rb +0 -40
  96. data/lib/tql_otr_factoring_data_exchange/models/factoring_company_input.rb +0 -117
  97. data/lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb +0 -165
  98. data/lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb +0 -124
  99. data/lib/tql_otr_factoring_data_exchange/models/invoice_status.rb +0 -74
  100. data/lib/tql_otr_factoring_data_exchange/models/invoice_type.rb +0 -50
  101. data/lib/tql_otr_factoring_data_exchange/models/load_search_request.rb +0 -205
  102. data/lib/tql_otr_factoring_data_exchange/models/load_search_response.rb +0 -124
  103. data/lib/tql_otr_factoring_data_exchange/models/load_status.rb +0 -56
  104. data/lib/tql_otr_factoring_data_exchange/models/location.rb +0 -149
  105. data/lib/tql_otr_factoring_data_exchange/models/oauth_provider_error.rb +0 -62
  106. data/lib/tql_otr_factoring_data_exchange/models/oauth_scope.rb +0 -36
  107. data/lib/tql_otr_factoring_data_exchange/models/oauth_token.rb +0 -96
  108. data/lib/tql_otr_factoring_data_exchange/models/problem_details.rb +0 -96
  109. data/lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb +0 -109
  110. data/lib/tql_otr_factoring_data_exchange/models/reference_type.rb +0 -90
  111. data/lib/tql_otr_factoring_data_exchange/models/status.rb +0 -44
  112. data/lib/tql_otr_factoring_data_exchange/models/stop_input.rb +0 -121
  113. data/lib/tql_otr_factoring_data_exchange/models/stop_type.rb +0 -62
  114. data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb +0 -326
  115. data/lib/tql_otr_factoring_data_exchange/models/weight_unit.rb +0 -36
  116. data/lib/tql_otr_factoring_data_exchange/utilities/date_time_helper.rb +0 -11
  117. data/lib/tql_otr_factoring_data_exchange/utilities/union_type_lookup.rb +0 -29
  118. data/lib/tql_otr_factoring_data_exchange.rb +0 -107
@@ -1,45 +0,0 @@
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
@@ -1,82 +0,0 @@
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
@@ -1,114 +0,0 @@
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
@@ -1,68 +0,0 @@
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
@@ -1,44 +0,0 @@
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
- # OauthAuthorizationApi
8
- class OauthAuthorizationApi < BaseApi
9
- # Create a new OAuth 2 token.
10
- # @param [String] authorization Required parameter: Authorization header in
11
- # Basic auth format
12
- # @param [String] scope Optional parameter: Requested scopes as a
13
- # space-delimited list.
14
- # @param [Hash] _field_parameters Additional optional form parameters are
15
- # supported by this endpoint.
16
- # @return [ApiResponse] Complete http response with raw body and status code.
17
- def request_token(authorization,
18
- scope: nil,
19
- _field_parameters: nil)
20
- @api_call
21
- .request(new_request_builder(HttpMethodEnum::POST,
22
- '/oauth2/token',
23
- Server::DEFAULT)
24
- .form_param(new_parameter('client_credentials', key: 'grant_type'))
25
- .header_param(new_parameter(authorization, key: 'Authorization')
26
- .is_required(true))
27
- .form_param(new_parameter(scope, key: 'scope'))
28
- .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
29
- .header_param(new_parameter('application/json', key: 'accept'))
30
- .additional_form_params(_field_parameters))
31
- .response(new_response_handler
32
- .deserializer(APIHelper.method(:custom_type_deserializer))
33
- .deserialize_into(OauthToken.method(:from_hash))
34
- .is_api_response(true)
35
- .local_error('400',
36
- 'OAuth 2 provider returned an error.',
37
- OauthProviderException)
38
- .local_error('401',
39
- 'OAuth 2 provider says client authentication failed.',
40
- OauthProviderException))
41
- .execute
42
- end
43
- end
44
- end
@@ -1,64 +0,0 @@
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
- # OAuth 2 Authorization endpoint exception.
8
- class OauthProviderException < APIException
9
- SKIP = Object.new
10
- private_constant :SKIP
11
-
12
- # Gets or sets error code.
13
- # @return [OauthProviderError]
14
- attr_accessor :error
15
-
16
- # Gets or sets human-readable text providing additional information on
17
- # error.
18
- # Used to assist the client developer in understanding the error that
19
- # occurred.
20
- # @return [String]
21
- attr_accessor :error_description
22
-
23
- # Gets or sets a URI identifying a human-readable web page with information
24
- # about the error, used to provide the client developer with additional
25
- # information about the error.
26
- # @return [String]
27
- attr_accessor :error_uri
28
-
29
- # The constructor.
30
- # @param [String] reason The reason for raising an exception.
31
- # @param [HttpResponse] response The HttpReponse of the API call.
32
- def initialize(reason, response)
33
- super(reason, response)
34
- hash = APIHelper.json_deserialize(@response.raw_body)
35
- unbox(hash)
36
- end
37
-
38
- # Populates this object by extracting properties from a hash.
39
- # @param [Hash] hash The deserialized response sent by the server in the
40
- # response body.
41
- def unbox(hash)
42
- return nil unless hash
43
-
44
- @error = hash.key?('error') ? hash['error'] : nil
45
- @error_description =
46
- hash.key?('error_description') ? hash['error_description'] : SKIP
47
- @error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
48
- end
49
-
50
- # Provides a human-readable string representation of the object.
51
- def to_s
52
- class_name = self.class.name.split('::').last
53
- "<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
54
- " #{@error_uri}>"
55
- end
56
-
57
- # Provides a debugging-friendly string with detailed object information.
58
- def inspect
59
- class_name = self.class.name.split('::').last
60
- "<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
61
- " error_uri: #{@error_uri.inspect}>"
62
- end
63
- end
64
- end
@@ -1,156 +0,0 @@
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
- # Utility class for OAuth 2 authorization and token management.
8
- class Oauth2 < CoreLibrary::HeaderAuth
9
- include CoreLibrary
10
- # Display error message on occurrence of authentication failure.
11
- # @returns [String] The oAuth error message.
12
- def error_message
13
- 'ClientCredentialsAuth: OAuthToken is undefined or expired.'
14
- end
15
-
16
- # Initialization constructor.
17
- def initialize(client_credentials_auth_credentials, config)
18
- @_oauth_client_id = client_credentials_auth_credentials.oauth_client_id unless
19
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_client_id.nil?
20
- @_oauth_client_secret = client_credentials_auth_credentials.oauth_client_secret unless
21
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_client_secret.nil?
22
- @_oauth_token = client_credentials_auth_credentials.oauth_token unless
23
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_token.nil?
24
- @_oauth_scopes = client_credentials_auth_credentials.oauth_scopes unless
25
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_scopes.nil?
26
- @_oauth_clock_skew = client_credentials_auth_credentials.oauth_clock_skew unless
27
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_clock_skew.nil?
28
- @_oauth_token_provider = client_credentials_auth_credentials.oauth_token_provider unless
29
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_token_provider.nil?
30
- @_oauth_on_token_update = client_credentials_auth_credentials.oauth_on_token_update unless
31
- client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_on_token_update.nil?
32
- @_o_auth_api = OauthAuthorizationApi.new(config)
33
- super({})
34
- end
35
-
36
- # Validates the oAuth token.
37
- # @return [Boolean] true if the token is present and not expired.
38
- def valid
39
- @_oauth_token = get_token_from_provider
40
- @_oauth_token.is_a?(OAuthToken) && !token_expired?(@_oauth_token)
41
- end
42
-
43
- # Builds the basic auth header for endpoints in the OAuth Authorization Controller.
44
- # @return [String] The value of the Authentication header.
45
- def build_basic_auth_header
46
- "Basic #{AuthHelper.get_base64_encoded_value(@_oauth_client_id, @_oauth_client_secret)}"
47
- end
48
-
49
- # Fetches the token.
50
- # @param [Hash] additional_params Any additional form parameters.
51
- # @return [OAuthToken] The oAuth token instance.
52
- def fetch_token(additional_params: nil)
53
- token = @_o_auth_api.request_token(
54
- build_basic_auth_header,
55
- scope: !@_oauth_scopes.nil? ? Array(@_oauth_scopes).compact.join(' ') : @_oauth_scopes,
56
- _field_parameters: additional_params
57
- ).data
58
- if token.respond_to?('expires_in') && !token.expires_in.nil?
59
- token.expiry = AuthHelper.get_token_expiry(token.expires_in, Time.now.utc.to_i)
60
- end
61
- token
62
- end
63
-
64
- # Checks if OAuth token has expired.
65
- # @param [OAuthToken] token The oAuth token instance.
66
- # @return [Boolean] true if the token's expiry exist and also the token is expired, false otherwise.
67
- def token_expired?(token)
68
- token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry, @_oauth_clock_skew)
69
- end
70
-
71
- def apply(http_request)
72
- auth_params = { 'Authorization' => "Bearer #{@_oauth_token.access_token}" }
73
- AuthHelper.apply(auth_params, http_request.method(:add_header))
74
- end
75
-
76
- private
77
-
78
- # This provides the OAuth Token from either the user configured callbacks or from default provider.
79
- # @return [OAuthToken] The fetched oauth token.
80
- def get_token_from_provider
81
- return @_oauth_token if @_oauth_token && !token_expired?(@_oauth_token)
82
-
83
- if @_o_auth_token_provider
84
- o_auth_token = @_o_auth_token_provider.call(@_oauth_token, self)
85
- @_o_auth_on_token_update&.call(o_auth_token)
86
- return o_auth_token
87
- end
88
- begin
89
- o_auth_token = fetch_token
90
- @_o_auth_on_token_update&.call(o_auth_token)
91
- o_auth_token
92
- rescue ApiException
93
- @_o_auth_token
94
- end
95
- end
96
- end
97
-
98
- # Data class for ClientCredentialsAuthCredentials.
99
- class ClientCredentialsAuthCredentials
100
- attr_reader :oauth_client_id, :oauth_client_secret, :oauth_token,
101
- :oauth_scopes, :oauth_token_provider, :oauth_on_token_update,
102
- :oauth_clock_skew
103
-
104
- def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil,
105
- oauth_scopes: nil, oauth_token_provider: nil,
106
- oauth_on_token_update: nil, oauth_clock_skew: 0)
107
- raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil?
108
- raise ArgumentError, 'oauth_client_secret cannot be nil' if oauth_client_secret.nil?
109
-
110
- @oauth_client_id = oauth_client_id
111
- @oauth_client_secret = oauth_client_secret
112
- @oauth_token = oauth_token
113
- @oauth_scopes = oauth_scopes
114
- @oauth_token_provider = oauth_token_provider
115
- @oauth_on_token_update = oauth_on_token_update
116
- @oauth_clock_skew = oauth_clock_skew
117
- end
118
-
119
- def self.from_env
120
- oauth_client_id = ENV['OAUTH_CLIENT_ID']
121
- oauth_client_secret = ENV['OAUTH_CLIENT_SECRET']
122
- oauth_scopes = ENV['OAUTH_SCOPES']
123
- oauth_clock_skew = ENV['OAUTH_CLOCK_SKEW']
124
- all_nil = [
125
- oauth_client_id,
126
- oauth_client_secret
127
- ].all?(&:nil?)
128
- return nil if all_nil
129
-
130
- new(oauth_client_id: oauth_client_id,
131
- oauth_client_secret: oauth_client_secret, oauth_scopes: oauth_scopes,
132
- oauth_clock_skew: oauth_clock_skew)
133
- end
134
-
135
- def clone_with(oauth_client_id: nil, oauth_client_secret: nil,
136
- oauth_token: nil, oauth_scopes: nil,
137
- oauth_token_provider: nil, oauth_on_token_update: nil,
138
- oauth_clock_skew: nil)
139
- oauth_client_id ||= self.oauth_client_id
140
- oauth_client_secret ||= self.oauth_client_secret
141
- oauth_token ||= self.oauth_token
142
- oauth_scopes ||= self.oauth_scopes
143
- oauth_token_provider ||= self.oauth_token_provider
144
- oauth_on_token_update ||= self.oauth_on_token_update
145
- oauth_clock_skew ||= self.oauth_clock_skew
146
-
147
- ClientCredentialsAuthCredentials.new(
148
- oauth_client_id: oauth_client_id,
149
- oauth_client_secret: oauth_client_secret, oauth_token: oauth_token,
150
- oauth_scopes: oauth_scopes, oauth_token_provider: oauth_token_provider,
151
- oauth_on_token_update: oauth_on_token_update,
152
- oauth_clock_skew: oauth_clock_skew
153
- )
154
- end
155
- end
156
- end
@@ -1,10 +0,0 @@
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
- # HttpCallBack allows defining callables for pre and post API calls.
8
- class HttpCallBack < CoreLibrary::HttpCallback
9
- end
10
- end
@@ -1,10 +0,0 @@
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
- # HTTP Methods Enumeration.
8
- class HttpMethodEnum < CoreLibrary::HttpMethod
9
- end
10
- end
@@ -1,10 +0,0 @@
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 a single Http Request.
8
- class HttpRequest < CoreLibrary::HttpRequest
9
- end
10
- end
@@ -1,10 +0,0 @@
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
- # Http response received.
8
- class HttpResponse < CoreLibrary::HttpResponse
9
- end
10
- end