-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df18842
commit abf164c
Showing
6 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module FreightKit | ||
module Response | ||
# Basic Response class for requests against a carrier's API. | ||
# | ||
# @!attribute error | ||
# The error object. | ||
# @return [FreightKit::Error, NilClass] | ||
# | ||
# @!attribute request | ||
# The raw request. | ||
# @return [String] | ||
# | ||
# @!attribute response | ||
# The raw response. | ||
# @return [String] | ||
# | ||
class Base < Model | ||
attr_accessor :error, :request, :response | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module FreightKit | ||
module Response | ||
# Represents the response to calls: | ||
# - {FreightKit::Carrier#bol} | ||
# - {FreightKit::Carrier#pod} | ||
# - {FreightKit::Carrier#scanned_bol} | ||
# | ||
# @attribute content_type | ||
# @return [String] The HTTP `Content-Type` | ||
# | ||
# @attribute data | ||
# @return [String] Raw document data. | ||
class Document < Base | ||
attr_accessor :content_type, :data | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module FreightKit | ||
module Response | ||
# The `PickupResponse` object is returned by the {FreightKit::Carrier#create_pickup} | ||
# call. The most important method is {#pickup_number}, which will return the pickup reference | ||
# number. | ||
# | ||
# @!attribute labels | ||
# Shipping labels. | ||
# @return [Array<FreightKit::Label>] | ||
# | ||
# @!attribute pickup_number | ||
# Pickup reference number. | ||
# @return [String] | ||
# | ||
class Pickup < Base | ||
attr_accessor :labels, :pickup_number | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module FreightKit | ||
module Response | ||
# The `RateResponse` object is returned by the {FreightKit::Carrier#find_rates} | ||
# call. The most important method is {#rates}, which will return a list of possible | ||
# shipping options with an estimated price. | ||
# | ||
# @!attribute rates | ||
# The available rate options for the shipment, with an estimated price. | ||
# @return [Array<FreightKit::Rate>] | ||
# | ||
class Rate < Base | ||
attr_accessor :rates | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# frozen_string_literal: true | ||
|
||
module FreightKit | ||
module Response | ||
# Represents the response to a {FreightKit::Carrier#find_tracking_info} call. | ||
# | ||
# @note Some carriers provide more information than others, so not all attributes | ||
# will be set, depending on what carrier you are using. | ||
# | ||
# @!attribute actual_delivery_date | ||
# @return [DateTime] | ||
# | ||
# @!attribute attempted_delivery_date | ||
# @return [DateTime] | ||
# | ||
# @!attribute carrier | ||
# @return [Symbol] | ||
# | ||
# @!attribute carrier_name | ||
# @return [String] | ||
# | ||
# @!attribute delivery_signature | ||
# @return [String] | ||
# | ||
# @!attribute destination | ||
# @return [FreightKit::Location] | ||
# | ||
# @!attribute estimated_delivery_date | ||
# @return [FreightKit::DateTime] | ||
# | ||
# @!attribute origin | ||
# @return [FreightKit::Location] | ||
# | ||
# @!attribute scheduled_delivery_date | ||
# @return [DateTime] | ||
# | ||
# @!attribute ship_time | ||
# @return [Date, Time] | ||
# | ||
# @!attribute shipment_events | ||
# @return [Array<FreightKit::ShipmentEvent>] | ||
# | ||
# @!attribute shipper_address | ||
# @return [FreightKit::Location] | ||
# | ||
# @!attribute status | ||
# @return [Symbol] | ||
# | ||
# @!attribute status_code | ||
# @return [string] | ||
# | ||
# @!attribute status_description | ||
# @return [String] | ||
# | ||
# @!attribute tracking_number | ||
# @return [String] | ||
# | ||
class Tracking < Base | ||
attr_accessor :actual_delivery_date, | ||
:attempted_delivery_date, | ||
:carrier, | ||
:carrier_name, | ||
:delivery_signature, | ||
:destination, | ||
:estimated_delivery_date, | ||
:origin, | ||
:scheduled_delivery_date, | ||
:ship_time, | ||
:shipment_events, | ||
:shipper_address, | ||
:status, | ||
:status_code, | ||
:status_description, | ||
:tracking_number | ||
end | ||
end | ||
end |