Class: FriendlyShipping::Services::ShipEngine::RatesOptions
- Inherits:
-
FriendlyShipping::ShipmentOptions
- Object
- FriendlyShipping::ShipmentOptions
- FriendlyShipping::Services::ShipEngine::RatesOptions
- Defined in:
- lib/friendly_shipping/services/ship_engine/rates_options.rb
Overview
Options for the rates API call.
Instance Attribute Summary collapse
-
#carriers ⇒ Array<Carrier>
readonly
The carriers from which to get rates.
- #comparison_rate_type ⇒ String readonly
-
#service_code ⇒ String
readonly
The service code for which to get rates.
- #ship_date ⇒ #strftime readonly
Instance Method Summary collapse
-
#carrier_ids ⇒ Array<String>
The carrier IDs for these rates.
-
#initialize(carriers:, service_code:, ship_date: Date.today, comparison_rate_type: nil, **kwargs) ⇒ RatesOptions
constructor
A new instance of RatesOptions.
Methods inherited from FriendlyShipping::ShipmentOptions
Constructor Details
#initialize(carriers:, service_code:, ship_date: Date.today, comparison_rate_type: nil, **kwargs) ⇒ RatesOptions
Returns a new instance of RatesOptions.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 27 def initialize( carriers:, service_code:, ship_date: Date.today, comparison_rate_type: nil, **kwargs ) @carriers = carriers @service_code = service_code @ship_date = ship_date @comparison_rate_type = comparison_rate_type validate_comparison_rate_type! super(**kwargs.reverse_merge(package_options_class: RatesPackageOptions)) end |
Instance Attribute Details
#carriers ⇒ Array<Carrier> (readonly)
Returns the carriers from which to get rates.
9 10 11 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 9 def carriers @carriers end |
#comparison_rate_type ⇒ String (readonly)
18 19 20 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 18 def comparison_rate_type @comparison_rate_type end |
#service_code ⇒ String (readonly)
Returns the service code for which to get rates.
12 13 14 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 12 def service_code @service_code end |
#ship_date ⇒ #strftime (readonly)
15 16 17 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 15 def ship_date @ship_date end |
Instance Method Details
#carrier_ids ⇒ Array<String>
Returns the carrier IDs for these rates.
43 44 45 |
# File 'lib/friendly_shipping/services/ship_engine/rates_options.rb', line 43 def carrier_ids carriers.map(&:id) end |