freight_kit 0.1.21 → 0.1.23

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -3
  3. data/Rakefile +1 -3
  4. data/VERSION +1 -1
  5. data/freight_kit-0.1.21.gem +0 -0
  6. data/freight_kit-0.1.22.gem +0 -0
  7. data/freight_kit.gemspec +8 -19
  8. data/lib/freight_kit/address_normalizer.rb +1 -3
  9. data/lib/freight_kit/api_clients/soap_client.rb +30 -5
  10. data/lib/freight_kit/carrier.rb +36 -7
  11. data/lib/freight_kit/carriers/a1_express.rb +11 -0
  12. data/lib/freight_kit/carriers/abf_freight_system.rb +9 -26
  13. data/lib/freight_kit/carriers/aloha_freight_forwarders.rb +1 -5
  14. data/lib/freight_kit/carriers/amado_trucking.rb +1 -5
  15. data/lib/freight_kit/carriers/clear_lane_freight_systems.rb +6 -15
  16. data/lib/freight_kit/carriers/cpl_express.rb +1 -5
  17. data/lib/freight_kit/carriers/cross_country_freight_solutions.rb +6 -17
  18. data/lib/freight_kit/carriers/dependable_highway_express.rb +6 -18
  19. data/lib/freight_kit/carriers/forward_air.rb +4 -12
  20. data/lib/freight_kit/carriers/gsp_express.rb +13 -0
  21. data/lib/freight_kit/carriers/on_trac.rb +7 -25
  22. data/lib/freight_kit/carriers/peninsula_truck_lines.rb +4 -20
  23. data/lib/freight_kit/carriers/roadrunner_transportation_services.rb +2 -8
  24. data/lib/freight_kit/carriers/saia.rb +4 -19
  25. data/lib/freight_kit/carriers/southeastern_freight_lines.rb +4 -13
  26. data/lib/freight_kit/carriers/t_force_worldwide.rb +7 -19
  27. data/lib/freight_kit/carriers/top_ten_express.rb +13 -0
  28. data/lib/freight_kit/carriers/total_quality_logistics.rb +2 -1
  29. data/lib/freight_kit/carriers/western_regional_delivery_service.rb +26 -11
  30. data/lib/freight_kit/carriers/xpo_logistics.rb +5 -17
  31. data/lib/freight_kit/errors/rate_limit_error.rb +12 -0
  32. data/lib/freight_kit/errors/unserviceable_accessorials_error.rb +1 -3
  33. data/lib/freight_kit/helpers/pickupable.rb +1 -10
  34. data/lib/freight_kit/http_client/httpi_adapter.rb +37 -0
  35. data/lib/freight_kit/http_client/safe_retries.rb +17 -1
  36. data/lib/freight_kit/http_client.rb +13 -9
  37. data/lib/freight_kit/models/credential.rb +2 -15
  38. data/lib/freight_kit/models/lane.rb +20 -0
  39. data/lib/freight_kit/models/shipment.rb +1 -8
  40. data/lib/freight_kit/models/territory.rb +37 -0
  41. data/lib/freight_kit/package.rb +3 -13
  42. data/lib/freight_kit/packaging.rb +1 -16
  43. data/lib/freight_kit/platforms/carrier_logistics.rb +5 -10
  44. data/lib/freight_kit/platforms/dsdc.rb +82 -0
  45. data/lib/freight_kit/platforms/next_tms/graphql_client/mutation/quote_create.rb +32 -0
  46. data/lib/freight_kit/platforms/next_tms/graphql_client/mutation/shipment_create.rb +29 -0
  47. data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_carrier.rb +37 -0
  48. data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_carriers.rb +45 -0
  49. data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_customer.rb +54 -0
  50. data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_customers.rb +62 -0
  51. data/lib/freight_kit/platforms/next_tms/graphql_client/query/carrier.rb +22 -0
  52. data/lib/freight_kit/platforms/next_tms/graphql_client/query/carriers.rb +30 -0
  53. data/lib/freight_kit/platforms/next_tms/graphql_client/query/customer.rb +20 -0
  54. data/lib/freight_kit/platforms/next_tms/graphql_client/query/customers.rb +28 -0
  55. data/lib/freight_kit/platforms/next_tms/graphql_client/query/invoice.rb +31 -0
  56. data/lib/freight_kit/platforms/next_tms/graphql_client/query/invoices.rb +39 -0
  57. data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipment.rb +102 -0
  58. data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipment_documents.rb +29 -0
  59. data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipments.rb +110 -0
  60. data/lib/freight_kit/platforms/next_tms/graphql_client.rb +22 -0
  61. data/lib/freight_kit/platforms/next_tms/orm/address.rb +22 -0
  62. data/lib/freight_kit/platforms/next_tms/orm/base.rb +120 -0
  63. data/lib/freight_kit/platforms/next_tms/orm/broker_carrier.rb +18 -0
  64. data/lib/freight_kit/platforms/next_tms/orm/broker_customer.rb +22 -0
  65. data/lib/freight_kit/platforms/next_tms/orm/carrier.rb +14 -0
  66. data/lib/freight_kit/platforms/next_tms/orm/collection.rb +335 -0
  67. data/lib/freight_kit/platforms/next_tms/orm/customer.rb +12 -0
  68. data/lib/freight_kit/platforms/next_tms/orm/invoice.rb +21 -0
  69. data/lib/freight_kit/platforms/next_tms/orm/record_not_found_error.rb +9 -0
  70. data/lib/freight_kit/platforms/next_tms/orm/shipment.rb +50 -0
  71. data/lib/freight_kit/platforms/next_tms/orm.rb +38 -0
  72. data/lib/freight_kit/platforms/next_tms.rb +414 -55
  73. data/lib/freight_kit/platforms/the_great_information_factory.rb +4 -12
  74. data/lib/freight_kit.rb +19 -0
  75. data/schemas/next_tms.json +110710 -0
  76. metadata +86 -5
@@ -0,0 +1,20 @@
1
+ module FreightKit
2
+ # Class representing a carrier's service in one direction, from one territory to another.
3
+ #
4
+ # @!attribute destination [FreightKit::Territory] Where the carrier delivers.
5
+ # @!attribute id [String] Permanent UUID. Applications store it, so never change it.
6
+ # @!attribute origin [FreightKit::Territory] Where the carrier picks up.
7
+ class Lane < Model
8
+ attr_accessor :destination, :id, :origin
9
+
10
+ # Whether the lane goes from the origin to the destination.
11
+ # @param destination [FreightKit::Location]
12
+ # @param origin [FreightKit::Location]
13
+ # @return [Boolean]
14
+ def include?(origin, destination) = self.origin.include?(origin) && self.destination.include?(destination)
15
+
16
+ # How narrow the lane is: the sum of its territories' specificity.
17
+ # @return [Integer]
18
+ def specificity = origin.specificity + destination.specificity
19
+ end
20
+ end
@@ -11,14 +11,7 @@ module FreightKit
11
11
  # @!attribute po_number [String] Purchase order number (also known as PO #).
12
12
  # @!attribute pickup_at [FreightKit::DateTime] Pickup date/time.
13
13
  class Shipment < Model
14
- attr_accessor :accessorials,
15
- :declared_value_cents,
16
- :destination,
17
- :origin,
18
- :order_number,
19
- :packages,
20
- :po_number,
21
- :pro
14
+ attr_accessor :accessorials, :declared_value_cents, :destination, :origin, :order_number, :packages, :po_number, :pro
22
15
  attr_reader :pickup_at
23
16
 
24
17
  def hazmat?
@@ -0,0 +1,37 @@
1
+ module FreightKit
2
+ # Class representing an area a carrier serves. A blank attribute matches any location.
3
+ #
4
+ # @!attribute country [FreightKit::Country] Country.
5
+ # @!attribute postal_codes [Array<String>] Postal codes or their prefixes (e.g. "850").
6
+ # @!attribute region_abbreviation [String, nil] Region (state or province) abbreviation, e.g. "CA".
7
+ class Territory < Model
8
+ attr_accessor :region_abbreviation
9
+ attr_reader :country
10
+
11
+ def country=(country)
12
+ raise ArgumentError, 'country must be a FreightKit::Country' unless country.is_a?(Country)
13
+
14
+ @country = country
15
+ end
16
+
17
+ # Whether the location is inside the territory.
18
+ # @param location [FreightKit::Location]
19
+ # @return [Boolean]
20
+ def include?(location)
21
+ return false unless location.country&.code(:alpha2)&.to_s == country.iso31661_alpha2
22
+ return false if region_abbreviation.present? && location.province != region_abbreviation
23
+
24
+ postal_codes.blank? || postal_codes.any? { |postal_code| location.postal_code.to_s.start_with?(postal_code) }
25
+ end
26
+
27
+ def postal_codes = @postal_codes || []
28
+
29
+ def postal_codes=(postal_codes)
30
+ @postal_codes = Array.wrap(postal_codes)
31
+ end
32
+
33
+ # How narrow the territory is: 0 for a country, 1 for a region, 2 for postal codes.
34
+ # @return [Integer]
35
+ def specificity = [region_abbreviation, postal_codes].count(&:present?)
36
+ end
37
+ end
@@ -64,13 +64,7 @@ module FreightKit # :nodoc:
64
64
 
65
65
  @quantity = options[:quantity] || 1
66
66
 
67
- @total_weight = attribute_from_metric_or_imperial(
68
- total_grams_or_ounces,
69
- Measured::Weight,
70
- @weight_unit_system,
71
- :grams,
72
- :ounces
73
- )
67
+ @total_weight = attribute_from_metric_or_imperial(total_grams_or_ounces, Measured::Weight, @weight_unit_system, :grams, :ounces)
74
68
 
75
69
  @each_weight = attribute_from_metric_or_imperial(
76
70
  total_grams_or_ounces / @quantity.to_f,
@@ -91,9 +85,7 @@ module FreightKit # :nodoc:
91
85
  @dimensions = @dimensions.map do |l|
92
86
  attribute_from_metric_or_imperial(l, Measured::Length, @dimensions_unit_system, :centimetres, :inches)
93
87
  end
94
- 2.downto(@dimensions.length) do |_n|
95
- @dimensions.unshift(@dimensions[0])
96
- end
88
+ 2.downto(@dimensions.length) { |_n| @dimensions.unshift(@dimensions[0]) }
97
89
  end
98
90
 
99
91
  @value = Package.cents_from(options[:value])
@@ -274,9 +266,7 @@ module FreightKit # :nodoc:
274
266
  # [1,2] => [1,1,2]
275
267
  # [5] => [5,5,5]
276
268
  # etc..
277
- 2.downto(@dimensions.length) do |_n|
278
- @dimensions.unshift(@dimensions[0])
279
- end
269
+ 2.downto(@dimensions.length) { |_n| @dimensions.unshift(@dimensions[0]) }
280
270
  end
281
271
 
282
272
  def sanitized_freight_class(freight_class)
@@ -1,22 +1,7 @@
1
1
  module FreightKit
2
2
  class Packaging
3
3
  PALLET_TYPES = %i[crate drum pallet tote].freeze
4
- VALID_TYPES = %i[
5
- box
6
- bundle
7
- container
8
- crate
9
- cylinder
10
- drum
11
- luggage
12
- pail
13
- pallet
14
- piece
15
- roll
16
- tote
17
- truckload
18
- tote
19
- ].freeze
4
+ VALID_TYPES = %i[box bundle container crate cylinder drum luggage pail pallet piece roll tote truckload tote].freeze
20
5
 
21
6
  attr_accessor :type
22
7
 
@@ -114,14 +114,13 @@ module FreightKit
114
114
  url = build_url(action, query:)
115
115
  save_request(url)
116
116
 
117
- HTTPClient.get(url)
117
+ HTTPClient.get(url, proxy_url:)
118
118
  end
119
119
 
120
120
  def map_response_errors(response, not_found_error: DocumentNotFoundError)
121
121
  return ResponseError.new('Unknown response') if response.blank?
122
122
 
123
- webspeed_error = (response.is_a?(String) || response.is_a?(HTTPClient::Response)) &&
124
- response.include?('WebSpeed error')
123
+ webspeed_error = (response.is_a?(String) || response.is_a?(HTTPClient::Response)) && response.include?('WebSpeed error')
125
124
  return ResponseError.new('Temporary error (WebSpeed error)') if webspeed_error
126
125
 
127
126
  return if response.code == 200
@@ -132,9 +131,7 @@ module FreightKit
132
131
  def parse_amount(amount)
133
132
  negative = amount.include?('-')
134
133
 
135
- ['$', ',', '-'].each do |char|
136
- amount = amount.sub(char, '')
137
- end
134
+ ['$', ',', '-'].each { |char| amount = amount.sub(char, '') }
138
135
 
139
136
  return 0 if amount.blank?
140
137
 
@@ -220,7 +217,7 @@ module FreightKit
220
217
  end
221
218
 
222
219
  begin
223
- response = HTTPClient.get(url)
220
+ response = HTTPClient.get(url, proxy_url:)
224
221
  rescue StandardError => e
225
222
  document_response.error = e
226
223
  return document_response
@@ -283,9 +280,7 @@ module FreightKit
283
280
  if self.class.overlength_fees_require_tariff?
284
281
  cents = 0
285
282
 
286
- shipment.packages.each do |package|
287
- cents += overlength_fee(tariff, package)
288
- end
283
+ shipment.packages.each { |package| cents += overlength_fee(tariff, package) }
289
284
 
290
285
  prices << Price.new(blame: :tariff, cents:, description: 'Overlength fees') if cents.nonzero?
291
286
  end
@@ -0,0 +1,82 @@
1
+ module FreightKit
2
+ module Platforms
3
+ # Carriers whose APIs follow the NMFTA Digital Standards Development Council (DSDC) LTL API standards.
4
+ #
5
+ # The standards define paths and payloads but not hosts or authentication, so subclasses set `API[:domain]`
6
+ # (and `API[:prefix]` if the carrier mounts the APIs under one) and implement {#authorization_headers}.
7
+ #
8
+ # @see https://dsdc.nmfta.org/apis
9
+ # @see https://github.com/dsdcapis/less-than-truckload/tree/main/api-specs
10
+ class DSDC < Platform
11
+ class << self
12
+ def required_credential_types = %i[api]
13
+ end
14
+
15
+ API = {
16
+ endpoints: {
17
+ # eBOL 2.1.0
18
+ cancel_bol: '/bol/v1/app/%<pro>s',
19
+ create_bol: '/bol/v1/app/',
20
+ update_bol: '/bol/v1/app/%<pro>s',
21
+ # Pickup Request and Visibility 1.0.0
22
+ cancel_pickup: '/v1/pickups/%<pickup_id>s',
23
+ create_pickup: '/v1/pickups/',
24
+ show_pickup: '/v1/pickups/',
25
+ update_pickup: '/v1/pickups/%<pickup_id>s',
26
+ # In-Transit Visibility 1.0.0
27
+ track: '/shipment/pro/%<pro>s/verified'
28
+ },
29
+ methods: {
30
+ cancel_bol: :delete,
31
+ cancel_pickup: :delete,
32
+ create_bol: :post,
33
+ create_pickup: :post,
34
+ show_pickup: :get,
35
+ track: :get,
36
+ update_bol: :put,
37
+ update_pickup: :put
38
+ },
39
+ use_ssl: true
40
+ }.freeze
41
+ JSON_HEADERS = { Accept: 'application/json', 'Content-Type': 'application/json' }.freeze
42
+
43
+ protected
44
+
45
+ # @return [Hash] Headers that authenticate requests, e.g. a bearer token or API key.
46
+ def authorization_headers = raise NotImplementedError, "#{name}: #authorization_headers not implemented"
47
+
48
+ # @param action [Symbol] A key of `API[:endpoints]`.
49
+ # @param body [Hash, nil] Payload, sent as JSON.
50
+ # @param query [Hash, nil] Query parameters, e.g. `lookupType` and `lookupValue` for `:show_pickup`.
51
+ # @param path_params [Hash] Values for the endpoint's placeholders, e.g. `pro:`.
52
+ def build_request(action, body: nil, query: nil, **path_params)
53
+ request = {
54
+ body: body&.to_json,
55
+ headers: JSON_HEADERS.merge(authorization_headers),
56
+ method: self.class::API.dig(:methods, action),
57
+ query:,
58
+ url: build_url(action, **path_params)
59
+ }
60
+
61
+ save_request(request)
62
+ request
63
+ end
64
+
65
+ def build_url(action, **path_params)
66
+ api = self.class::API
67
+ endpoint = format(api.dig(:endpoints, action), **path_params.transform_values { |value| ERB::Util.url_encode(value.to_s) })
68
+
69
+ "#{api[:use_ssl] ? 'https' : 'http'}://#{api[:domain]}#{api[:prefix]}#{endpoint}"
70
+ end
71
+
72
+ def commit(request)
73
+ response = HTTPClient.request(request[:method], request[:url], **request.slice(:body, :headers, :query), proxy_url:)
74
+
75
+ raise InvalidCredentialsError, "HTTP #{response.code}: #{response}" if [401, 403].include?(response.code)
76
+ raise HTTPError.new(body: response.body, code: response.code) unless (200..299).cover?(response.code)
77
+
78
+ response.parsed_response
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,32 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Mutation
6
+ class QuoteCreate
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ mutation($input: QuoteCreateInput!) {
9
+ quoteCreate(input: $input) {
10
+ rates {
11
+ carrierName
12
+ chargeCents
13
+ chargeCurrency
14
+ expiresAt
15
+ id
16
+ reference
17
+ scac
18
+ transitDays
19
+ }
20
+ shipment {
21
+ id
22
+ loadId
23
+ }
24
+ }
25
+ }
26
+ GRAPHQL
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Mutation
6
+ class ShipmentCreate
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ mutation($input: ShipmentCreateInput!) {
9
+ shipmentCreate(input: $input) {
10
+ shipment {
11
+ documents {
12
+ contentType
13
+ kind
14
+ url
15
+ }
16
+ id
17
+ loadId
18
+ pro
19
+ status
20
+ }
21
+ }
22
+ }
23
+ GRAPHQL
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,37 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class BrokerCarrier
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($id: ID!) {
9
+ brokerCarrier(id: $id) {
10
+ account
11
+ accountDesc
12
+ brokerCustomer {
13
+ customer {
14
+ id
15
+ name
16
+ }
17
+ id
18
+ }
19
+ carrier {
20
+ id
21
+ mcNumber
22
+ name
23
+ scac
24
+ }
25
+ createInvoiceOnPickup
26
+ daysToPayAfterInvoiceDate
27
+ id
28
+ shipmentsCount
29
+ }
30
+ }
31
+ GRAPHQL
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,45 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class BrokerCarriers
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($filter: BrokerCarrierFilter, $page: Int, $pageSize: Int, $sort: [String!]) {
9
+ brokerCarriers(filter: $filter, page: $page, pageSize: $pageSize, sort: $sort) {
10
+ items {
11
+ account
12
+ accountDesc
13
+ brokerCustomer {
14
+ customer {
15
+ id
16
+ name
17
+ }
18
+ id
19
+ }
20
+ carrier {
21
+ id
22
+ mcNumber
23
+ name
24
+ scac
25
+ }
26
+ createInvoiceOnPickup
27
+ daysToPayAfterInvoiceDate
28
+ id
29
+ shipmentsCount
30
+ }
31
+ page
32
+ pageSize
33
+ pages
34
+ totalItems
35
+ updatedAt
36
+ version
37
+ }
38
+ }
39
+ GRAPHQL
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,54 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class BrokerCustomer
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($id: ID!) {
9
+ brokerCustomer(id: $id) {
10
+ accountingCustomerId
11
+ canQuote
12
+ customer {
13
+ id
14
+ name
15
+ }
16
+ id
17
+ officeAddress {
18
+ city
19
+ country {
20
+ alpha2Code
21
+ }
22
+ id
23
+ region {
24
+ abbreviation
25
+ }
26
+ street
27
+ street2
28
+ timeZoneName
29
+ zipCode
30
+ }
31
+ primaryPickupAddress {
32
+ city
33
+ country {
34
+ alpha2Code
35
+ }
36
+ id
37
+ region {
38
+ abbreviation
39
+ }
40
+ street
41
+ street2
42
+ timeZoneName
43
+ zipCode
44
+ }
45
+ validFreightClasses
46
+ }
47
+ }
48
+ GRAPHQL
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,62 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class BrokerCustomers
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($filter: BrokerCustomerFilter, $page: Int, $pageSize: Int, $sort: [String!]) {
9
+ brokerCustomers(filter: $filter, page: $page, pageSize: $pageSize, sort: $sort) {
10
+ items {
11
+ accountingCustomerId
12
+ canQuote
13
+ customer {
14
+ id
15
+ name
16
+ }
17
+ id
18
+ officeAddress {
19
+ city
20
+ country {
21
+ alpha2Code
22
+ }
23
+ id
24
+ region {
25
+ abbreviation
26
+ }
27
+ street
28
+ street2
29
+ timeZoneName
30
+ zipCode
31
+ }
32
+ primaryPickupAddress {
33
+ city
34
+ country {
35
+ alpha2Code
36
+ }
37
+ id
38
+ region {
39
+ abbreviation
40
+ }
41
+ street
42
+ street2
43
+ timeZoneName
44
+ zipCode
45
+ }
46
+ validFreightClasses
47
+ }
48
+ page
49
+ pageSize
50
+ pages
51
+ totalItems
52
+ updatedAt
53
+ version
54
+ }
55
+ }
56
+ GRAPHQL
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,22 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class Carrier
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($id: ID!) {
9
+ carrier(id: $id) {
10
+ id
11
+ mcNumber
12
+ name
13
+ scac
14
+ }
15
+ }
16
+ GRAPHQL
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class Carriers
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($filter: CarrierFilter, $page: Int, $pageSize: Int, $sort: [String!]) {
9
+ carriers(filter: $filter, page: $page, pageSize: $pageSize, sort: $sort) {
10
+ items {
11
+ id
12
+ mcNumber
13
+ name
14
+ scac
15
+ }
16
+ page
17
+ pageSize
18
+ pages
19
+ totalItems
20
+ updatedAt
21
+ version
22
+ }
23
+ }
24
+ GRAPHQL
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class Customer
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($id: ID!) {
9
+ customer(id: $id) {
10
+ id
11
+ name
12
+ }
13
+ }
14
+ GRAPHQL
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class Customers
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($filter: CustomerFilter, $page: Int, $pageSize: Int, $sort: [String!]) {
9
+ customers(filter: $filter, page: $page, pageSize: $pageSize, sort: $sort) {
10
+ items {
11
+ id
12
+ name
13
+ }
14
+ page
15
+ pageSize
16
+ pages
17
+ totalItems
18
+ updatedAt
19
+ version
20
+ }
21
+ }
22
+ GRAPHQL
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ module FreightKit
2
+ module Platforms
3
+ class NextTMS
4
+ class GraphQLClient
5
+ module Query
6
+ class Invoice
7
+ DETAILS = Client.parse(<<~GRAPHQL)
8
+ query($id: ID!) {
9
+ invoice(id: $id) {
10
+ balanceCents
11
+ balanceCurrency
12
+ dueOn
13
+ id
14
+ issuedOn
15
+ number
16
+ paidAt
17
+ shipment {
18
+ id
19
+ loadId
20
+ }
21
+ totalCents
22
+ totalCurrency
23
+ }
24
+ }
25
+ GRAPHQL
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end