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
|
@@ -125,10 +125,7 @@ module FreightKit
|
|
|
125
125
|
include FreightKit::Trackable
|
|
126
126
|
include FreightKit::Pickupable
|
|
127
127
|
|
|
128
|
-
API = {
|
|
129
|
-
actions: { rates: :getquote, track: :tracktrace, pickup: :requestpickup },
|
|
130
|
-
use_ssl: { rates: false, track: false }
|
|
131
|
-
}.freeze
|
|
128
|
+
API = { actions: { rates: :getquote, track: :tracktrace, pickup: :requestpickup }, use_ssl: { rates: false, track: false } }.freeze
|
|
132
129
|
EVENTS = {
|
|
133
130
|
types: {
|
|
134
131
|
arrived_at_terminal: 'arrived',
|
|
@@ -316,7 +313,7 @@ module FreightKit
|
|
|
316
313
|
|
|
317
314
|
url = [base_url, query_parameter].join
|
|
318
315
|
|
|
319
|
-
response = HTTPClient.get(url)
|
|
316
|
+
response = HTTPClient.get(url, proxy_url:)
|
|
320
317
|
|
|
321
318
|
image = response.deep_symbolize_keys.dig(:ImageRequest, :Image)
|
|
322
319
|
image = image.last if image.is_a?(Array)
|
|
@@ -472,10 +469,7 @@ module FreightKit
|
|
|
472
469
|
return tracking_response
|
|
473
470
|
end
|
|
474
471
|
|
|
475
|
-
receiver_location = build_location(
|
|
476
|
-
mapped_response.dig(:consignee, :city),
|
|
477
|
-
mapped_response.dig(:consignee, :state)
|
|
478
|
-
)
|
|
472
|
+
receiver_location = build_location(mapped_response.dig(:consignee, :city), mapped_response.dig(:consignee, :state))
|
|
479
473
|
shipper_location = build_location(mapped_response.dig(:shipper, :city), mapped_response.dig(:shipper, :state))
|
|
480
474
|
|
|
481
475
|
actual_delivery_date = mapped_response[:deliverydate]
|
|
@@ -566,9 +560,7 @@ module FreightKit
|
|
|
566
560
|
status = shipment_events.last&.type_code
|
|
567
561
|
|
|
568
562
|
# Workarounds for false status on certain events when timestamps are in wrong order
|
|
569
|
-
status = :out_for_delivery if shipment_events.find
|
|
570
|
-
shipment_event.type_code == :out_for_delivery
|
|
571
|
-
end
|
|
563
|
+
status = :out_for_delivery if shipment_events.find { |shipment_event| shipment_event.type_code == :out_for_delivery }
|
|
572
564
|
status = :delivered if shipment_events.find { |shipment_event| shipment_event.type_code == :delivered }
|
|
573
565
|
|
|
574
566
|
tracking_response.assign_attributes(
|
data/lib/freight_kit.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'active_support/all'
|
|
|
3
3
|
require 'active_utils'
|
|
4
4
|
require 'business_time'
|
|
5
5
|
require 'countries'
|
|
6
|
+
require 'graphql/client'
|
|
6
7
|
require 'httpx'
|
|
7
8
|
require 'measured'
|
|
8
9
|
require 'mimemagic'
|
|
@@ -19,6 +20,21 @@ require 'zeitwerk'
|
|
|
19
20
|
module FreightKit
|
|
20
21
|
VERSION = File.read(File.expand_path('../VERSION', __dir__)).strip.freeze
|
|
21
22
|
|
|
23
|
+
class << self
|
|
24
|
+
# The cache FreightKit stores data in, such as HTTP responses and SOAP WSDLs. It is in memory unless the host app passes its own:
|
|
25
|
+
#
|
|
26
|
+
# FreightKit.cache = Rails.cache
|
|
27
|
+
# FreightKit.cache = Hanami.app['cache']
|
|
28
|
+
#
|
|
29
|
+
# @return [ActiveSupport::Cache::Store] Or any store that responds to `#read`, `#write`, `#fetch` and `#delete_matched`.
|
|
30
|
+
def cache = @cache ||= ActiveSupport::Cache::MemoryStore.new
|
|
31
|
+
|
|
32
|
+
def cache=(store)
|
|
33
|
+
@cache = store
|
|
34
|
+
HTTPClient.reset
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
22
38
|
class Inflector < Zeitwerk::Inflector
|
|
23
39
|
CARRIER_ACRONYMS = [
|
|
24
40
|
'AAA',
|
|
@@ -36,6 +52,7 @@ module FreightKit
|
|
|
36
52
|
'DBR',
|
|
37
53
|
'DHL',
|
|
38
54
|
'DRT',
|
|
55
|
+
'DSDC',
|
|
39
56
|
'ERA',
|
|
40
57
|
'EW',
|
|
41
58
|
'GLS',
|
|
@@ -63,6 +80,7 @@ module FreightKit
|
|
|
63
80
|
'MC',
|
|
64
81
|
'MS',
|
|
65
82
|
'MVG',
|
|
83
|
+
'NMFTA',
|
|
66
84
|
'NT',
|
|
67
85
|
'NVK',
|
|
68
86
|
'NY',
|
|
@@ -119,5 +137,6 @@ loader.collapse("#{__dir__}/freight_kit/helpers")
|
|
|
119
137
|
loader.collapse("#{__dir__}/freight_kit/models")
|
|
120
138
|
|
|
121
139
|
loader.inflector = FreightKit::Inflector.new
|
|
140
|
+
loader.inflector.inflect('graphql_client' => 'GraphQLClient', 'httpi_adapter' => 'HTTPIAdapter', 'orm' => 'ORM')
|
|
122
141
|
|
|
123
142
|
loader.setup
|