freight_kit 0.1.21 → 0.1.22
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.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/Rakefile +1 -3
- data/VERSION +1 -1
- data/freight_kit-0.1.21.gem +0 -0
- data/freight_kit.gemspec +8 -19
- data/lib/freight_kit/address_normalizer.rb +1 -3
- data/lib/freight_kit/api_clients/soap_client.rb +30 -5
- data/lib/freight_kit/carrier.rb +6 -7
- data/lib/freight_kit/carriers/abf_freight_system.rb +9 -26
- data/lib/freight_kit/carriers/aloha_freight_forwarders.rb +1 -5
- data/lib/freight_kit/carriers/amado_trucking.rb +1 -5
- data/lib/freight_kit/carriers/clear_lane_freight_systems.rb +6 -15
- data/lib/freight_kit/carriers/cpl_express.rb +1 -5
- data/lib/freight_kit/carriers/cross_country_freight_solutions.rb +6 -17
- data/lib/freight_kit/carriers/dependable_highway_express.rb +6 -18
- data/lib/freight_kit/carriers/forward_air.rb +4 -12
- data/lib/freight_kit/carriers/on_trac.rb +7 -25
- data/lib/freight_kit/carriers/peninsula_truck_lines.rb +4 -20
- data/lib/freight_kit/carriers/roadrunner_transportation_services.rb +2 -8
- data/lib/freight_kit/carriers/saia.rb +4 -19
- data/lib/freight_kit/carriers/southeastern_freight_lines.rb +4 -13
- data/lib/freight_kit/carriers/t_force_worldwide.rb +7 -19
- data/lib/freight_kit/carriers/total_quality_logistics.rb +2 -1
- data/lib/freight_kit/carriers/western_regional_delivery_service.rb +5 -11
- data/lib/freight_kit/carriers/xpo_logistics.rb +5 -17
- data/lib/freight_kit/errors/rate_limit_error.rb +12 -0
- data/lib/freight_kit/errors/unserviceable_accessorials_error.rb +1 -3
- data/lib/freight_kit/helpers/pickupable.rb +1 -10
- data/lib/freight_kit/http_client/httpi_adapter.rb +37 -0
- data/lib/freight_kit/http_client/safe_retries.rb +17 -1
- data/lib/freight_kit/http_client.rb +13 -9
- data/lib/freight_kit/models/credential.rb +2 -15
- data/lib/freight_kit/models/shipment.rb +1 -8
- data/lib/freight_kit/package.rb +3 -13
- data/lib/freight_kit/packaging.rb +1 -16
- data/lib/freight_kit/platforms/carrier_logistics.rb +5 -10
- data/lib/freight_kit/platforms/dsdc.rb +82 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/mutation/quote_create.rb +32 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/mutation/shipment_create.rb +29 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_carrier.rb +37 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_carriers.rb +45 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_customer.rb +54 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/broker_customers.rb +62 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/carrier.rb +22 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/carriers.rb +30 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/customer.rb +20 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/customers.rb +28 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/invoice.rb +31 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/invoices.rb +39 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipment.rb +102 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipment_documents.rb +29 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client/query/shipments.rb +110 -0
- data/lib/freight_kit/platforms/next_tms/graphql_client.rb +22 -0
- data/lib/freight_kit/platforms/next_tms/orm/address.rb +22 -0
- data/lib/freight_kit/platforms/next_tms/orm/base.rb +120 -0
- data/lib/freight_kit/platforms/next_tms/orm/broker_carrier.rb +18 -0
- data/lib/freight_kit/platforms/next_tms/orm/broker_customer.rb +22 -0
- data/lib/freight_kit/platforms/next_tms/orm/carrier.rb +14 -0
- data/lib/freight_kit/platforms/next_tms/orm/collection.rb +335 -0
- data/lib/freight_kit/platforms/next_tms/orm/customer.rb +12 -0
- data/lib/freight_kit/platforms/next_tms/orm/invoice.rb +21 -0
- data/lib/freight_kit/platforms/next_tms/orm/record_not_found_error.rb +9 -0
- data/lib/freight_kit/platforms/next_tms/orm/shipment.rb +50 -0
- data/lib/freight_kit/platforms/next_tms/orm.rb +38 -0
- data/lib/freight_kit/platforms/next_tms.rb +414 -55
- data/lib/freight_kit/platforms/the_great_information_factory.rb +4 -12
- data/lib/freight_kit.rb +19 -0
- data/schemas/next_tms.json +110710 -0
- metadata +83 -5
|
@@ -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
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module FreightKit
|
|
2
|
+
module Platforms
|
|
3
|
+
class NextTMS
|
|
4
|
+
class GraphQLClient
|
|
5
|
+
module Query
|
|
6
|
+
class Invoices
|
|
7
|
+
DETAILS = Client.parse(<<~GRAPHQL)
|
|
8
|
+
query($filter: InvoiceFilter, $page: Int, $pageSize: Int, $sort: [String!]) {
|
|
9
|
+
invoices(filter: $filter, page: $page, pageSize: $pageSize, sort: $sort) {
|
|
10
|
+
items {
|
|
11
|
+
balanceCents
|
|
12
|
+
balanceCurrency
|
|
13
|
+
dueOn
|
|
14
|
+
id
|
|
15
|
+
issuedOn
|
|
16
|
+
number
|
|
17
|
+
paidAt
|
|
18
|
+
shipment {
|
|
19
|
+
id
|
|
20
|
+
loadId
|
|
21
|
+
}
|
|
22
|
+
totalCents
|
|
23
|
+
totalCurrency
|
|
24
|
+
}
|
|
25
|
+
page
|
|
26
|
+
pageSize
|
|
27
|
+
pages
|
|
28
|
+
totalItems
|
|
29
|
+
updatedAt
|
|
30
|
+
version
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
GRAPHQL
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
module FreightKit
|
|
2
|
+
module Platforms
|
|
3
|
+
class NextTMS
|
|
4
|
+
class GraphQLClient
|
|
5
|
+
module Query
|
|
6
|
+
class Shipment
|
|
7
|
+
DETAILS = Client.parse(<<~GRAPHQL)
|
|
8
|
+
query($id: ID!) {
|
|
9
|
+
shipment(id: $id) {
|
|
10
|
+
bol
|
|
11
|
+
bookedAt
|
|
12
|
+
brokerCarrier {
|
|
13
|
+
account
|
|
14
|
+
carrier {
|
|
15
|
+
id
|
|
16
|
+
mcNumber
|
|
17
|
+
name
|
|
18
|
+
scac
|
|
19
|
+
}
|
|
20
|
+
id
|
|
21
|
+
}
|
|
22
|
+
brokerCustomer {
|
|
23
|
+
customer {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
}
|
|
27
|
+
id
|
|
28
|
+
}
|
|
29
|
+
canceledAt
|
|
30
|
+
createdAt
|
|
31
|
+
customerReference
|
|
32
|
+
deliveredAt
|
|
33
|
+
deliveryAppointmentAt
|
|
34
|
+
deliveryAppointmentOn
|
|
35
|
+
deliveryEtaOn
|
|
36
|
+
departedOriginTerminalAt
|
|
37
|
+
dispatchedAt
|
|
38
|
+
events {
|
|
39
|
+
city
|
|
40
|
+
countryAlpha2
|
|
41
|
+
id
|
|
42
|
+
name
|
|
43
|
+
occurredAt
|
|
44
|
+
regionIso31662
|
|
45
|
+
typeCode
|
|
46
|
+
zipCode
|
|
47
|
+
}
|
|
48
|
+
id
|
|
49
|
+
loadId
|
|
50
|
+
lostOn
|
|
51
|
+
outForDeliveryAt
|
|
52
|
+
pendingAppointmentSince
|
|
53
|
+
pickedUpAt
|
|
54
|
+
pickupDriverAssignedAt
|
|
55
|
+
pickupOn
|
|
56
|
+
pro
|
|
57
|
+
receiverAddress {
|
|
58
|
+
city
|
|
59
|
+
country {
|
|
60
|
+
alpha2Code
|
|
61
|
+
}
|
|
62
|
+
id
|
|
63
|
+
region {
|
|
64
|
+
abbreviation
|
|
65
|
+
}
|
|
66
|
+
street
|
|
67
|
+
street2
|
|
68
|
+
timeZoneName
|
|
69
|
+
zipCode
|
|
70
|
+
}
|
|
71
|
+
receiverName
|
|
72
|
+
shipperAddress {
|
|
73
|
+
city
|
|
74
|
+
country {
|
|
75
|
+
alpha2Code
|
|
76
|
+
}
|
|
77
|
+
id
|
|
78
|
+
region {
|
|
79
|
+
abbreviation
|
|
80
|
+
}
|
|
81
|
+
street
|
|
82
|
+
street2
|
|
83
|
+
timeZoneName
|
|
84
|
+
zipCode
|
|
85
|
+
}
|
|
86
|
+
shipperBol
|
|
87
|
+
shipperName
|
|
88
|
+
shipperReference
|
|
89
|
+
status
|
|
90
|
+
totalChargesCents
|
|
91
|
+
totalChargesCurrency
|
|
92
|
+
truckload
|
|
93
|
+
updatedAt
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
GRAPHQL
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module FreightKit
|
|
2
|
+
module Platforms
|
|
3
|
+
class NextTMS
|
|
4
|
+
class GraphQLClient
|
|
5
|
+
module Query
|
|
6
|
+
# Never cached, since document URLs expire after 5 minutes
|
|
7
|
+
class ShipmentDocuments
|
|
8
|
+
DETAILS = Client.parse(<<~GRAPHQL)
|
|
9
|
+
query($filter: ShipmentFilter, $page: Int, $pageSize: Int) {
|
|
10
|
+
shipments(filter: $filter, page: $page, pageSize: $pageSize) {
|
|
11
|
+
items {
|
|
12
|
+
documents {
|
|
13
|
+
contentType
|
|
14
|
+
filename
|
|
15
|
+
kind
|
|
16
|
+
url
|
|
17
|
+
}
|
|
18
|
+
id
|
|
19
|
+
loadId
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
GRAPHQL
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|