Class: FreightKit::Rate
Overview
Class representing a shipping option with estimated price.
Instance Attribute Summary collapse
-
#carrier ⇒ FreightKit::Carrier
The carrier.
-
#carrier_name ⇒ String
Name of the carrier.
-
#currency ⇒ String
ISO4217 currency code of the quoted rate estimates (e.g. ‘CAD`, `EUR`, or `USD`).
-
#estimate_reference ⇒ String
Quote number.
-
#expires_at ⇒ DateTime
When the rate estimate will expire.
-
#prices ⇒ Array<Prices>
Breakdown of a rate estimate’s prices with amounts in cents.
-
#scac ⇒ String
SCAC code of the carrier.
-
#service_name ⇒ String
The name of the shipping service (e.g. ‘First Class Ground’).
-
#shipment ⇒ FreightKit::Shipment
The shipment.
-
#transit_days ⇒ Integer
Estimated transit days after date of pickup.
-
#with_excessive_length_fees ⇒ Integer
When the rate estimate ‘Price`s include applicable excessive length fees.
Instance Method Summary collapse
-
#total_cents ⇒ Integer
The total price of the shipment in cents.
Methods inherited from Model
Constructor Details
This class inherits a constructor from FreightKit::Model
Instance Attribute Details
#carrier ⇒ FreightKit::Carrier
The carrier.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#carrier_name ⇒ String
Name of the carrier. It may differ from the ‘Carrier` providing the rate quote when the `Carrier` is acting as a broker.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#currency ⇒ String
ISO4217 currency code of the quoted rate estimates (e.g. ‘CAD`, `EUR`, or `USD`)
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#estimate_reference ⇒ String
Quote number.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#expires_at ⇒ DateTime
When the rate estimate will expire.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#prices ⇒ Array<Prices>
Breakdown of a rate estimate’s prices with amounts in cents.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#scac ⇒ String
SCAC code of the carrier. It may differ from the ‘Carrier` providing the rate estimate when the `Carrier` is acting as a broker.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#service_name ⇒ String
The name of the shipping service (e.g. ‘First Class Ground’)
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#shipment ⇒ FreightKit::Shipment
The shipment.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#transit_days ⇒ Integer
Estimated transit days after date of pickup.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
#with_excessive_length_fees ⇒ Integer
When the rate estimate ‘Price`s include applicable excessive length fees.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_kit/models/rate.rb', line 55 class Rate < Model attr_accessor :carrier, :carrier_name, :estimate_reference, :expires_at, :prices, :scac, :service_name, :shipment, :transit_days, :with_excessive_length_fees attr_writer :currency def currency ActiveUtils::CurrencyCode.standardize(@currency) end # The total price of the shipment in cents. # @return [Integer] def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end end |
Instance Method Details
#total_cents ⇒ Integer
The total price of the shipment in cents.
75 76 77 78 79 |
# File 'lib/freight_kit/models/rate.rb', line 75 def total_cents return 0 if @prices.blank? @prices.sum(&:cents) end |