Class: FriendlyShipping::Services::UpsJson::RatesOptions
- Inherits:
-
FriendlyShipping::ShipmentOptions
- Object
- FriendlyShipping::ShipmentOptions
- FriendlyShipping::Services::UpsJson::RatesOptions
- Defined in:
- lib/friendly_shipping/services/ups_json/rates_options.rb
Constant Summary collapse
- PICKUP_TYPE_CODES =
{ daily_pickup: "01", customer_counter: "03", one_time_pickup: "06", on_call_air: "07", suggested_retail_rates: "11", letter_center: "19", air_service_center: "20" }.freeze
- CUSTOMER_CLASSIFICATION_CODES =
{ shipper_number: "00", daily_rates: "01", retail_rates: "04", regional_rates: "05", general_rates: "06", standard_rates: "53" }.freeze
- SUB_VERSIONS =
%w[1 1601 1607 1701 1707 2108 2205].freeze
Instance Attribute Summary collapse
-
#carbon_neutral ⇒ Object
readonly
Returns the value of attribute carbon_neutral.
-
#customer_context ⇒ Object
readonly
Returns the value of attribute customer_context.
-
#destination_account ⇒ Object
readonly
Returns the value of attribute destination_account.
-
#negotiated_rates ⇒ Object
readonly
Returns the value of attribute negotiated_rates.
-
#pickup_date ⇒ Object
readonly
Returns the value of attribute pickup_date.
-
#saturday_delivery ⇒ Object
readonly
Returns the value of attribute saturday_delivery.
-
#saturday_pickup ⇒ Object
readonly
Returns the value of attribute saturday_pickup.
-
#shipper ⇒ Object
readonly
Returns the value of attribute shipper.
-
#shipper_number ⇒ Object
readonly
Returns the value of attribute shipper_number.
-
#shipping_method ⇒ Object
readonly
Returns the value of attribute shipping_method.
-
#sub_version ⇒ Object
readonly
Returns the value of attribute sub_version.
-
#with_time_in_transit ⇒ Object
readonly
Returns the value of attribute with_time_in_transit.
Instance Method Summary collapse
- #customer_classification_code ⇒ Object
-
#initialize(shipper_number:, carbon_neutral: true, customer_context: nil, customer_classification: :daily_rates, destination_account: nil, negotiated_rates: false, pickup_type: :daily_pickup, pickup_date: nil, saturday_delivery: false, saturday_pickup: false, shipper: nil, shipping_method: nil, sub_version: "2205", with_time_in_transit: false, package_options_class: RatesPackageOptions, **kwargs) ⇒ RatesOptions
constructor
A new instance of RatesOptions.
- #pickup_type_code ⇒ Object
Methods inherited from FriendlyShipping::ShipmentOptions
Constructor Details
#initialize(shipper_number:, carbon_neutral: true, customer_context: nil, customer_classification: :daily_rates, destination_account: nil, negotiated_rates: false, pickup_type: :daily_pickup, pickup_date: nil, saturday_delivery: false, saturday_pickup: false, shipper: nil, shipping_method: nil, sub_version: "2205", with_time_in_transit: false, package_options_class: RatesPackageOptions, **kwargs) ⇒ RatesOptions
Returns a new instance of RatesOptions.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 64 def initialize( shipper_number:, carbon_neutral: true, customer_context: nil, customer_classification: :daily_rates, destination_account: nil, negotiated_rates: false, pickup_type: :daily_pickup, pickup_date: nil, saturday_delivery: false, saturday_pickup: false, shipper: nil, shipping_method: nil, sub_version: "2205", with_time_in_transit: false, package_options_class: RatesPackageOptions, **kwargs ) raise ArgumentError, "Invalid sub-version: #{sub_version}" unless sub_version.in?(SUB_VERSIONS) @carbon_neutral = carbon_neutral @customer_context = customer_context @customer_classification = customer_classification @destination_account = destination_account @negotiated_rates = negotiated_rates @shipper_number = shipper_number @pickup_type = pickup_type @pickup_date = pickup_date @saturday_delivery = saturday_delivery @saturday_pickup = saturday_pickup @shipper = shipper @shipping_method = shipping_method @sub_version = sub_version @with_time_in_transit = with_time_in_transit super(**kwargs.reverse_merge(package_options_class: )) end |
Instance Attribute Details
#carbon_neutral ⇒ Object (readonly)
Returns the value of attribute carbon_neutral.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def carbon_neutral @carbon_neutral end |
#customer_context ⇒ Object (readonly)
Returns the value of attribute customer_context.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def customer_context @customer_context end |
#destination_account ⇒ Object (readonly)
Returns the value of attribute destination_account.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def destination_account @destination_account end |
#negotiated_rates ⇒ Object (readonly)
Returns the value of attribute negotiated_rates.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def negotiated_rates @negotiated_rates end |
#pickup_date ⇒ Object (readonly)
Returns the value of attribute pickup_date.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def pickup_date @pickup_date end |
#saturday_delivery ⇒ Object (readonly)
Returns the value of attribute saturday_delivery.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def saturday_delivery @saturday_delivery end |
#saturday_pickup ⇒ Object (readonly)
Returns the value of attribute saturday_pickup.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def saturday_pickup @saturday_pickup end |
#shipper ⇒ Object (readonly)
Returns the value of attribute shipper.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def shipper @shipper end |
#shipper_number ⇒ Object (readonly)
Returns the value of attribute shipper_number.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def shipper_number @shipper_number end |
#shipping_method ⇒ Object (readonly)
Returns the value of attribute shipping_method.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def shipping_method @shipping_method end |
#sub_version ⇒ Object (readonly)
Returns the value of attribute sub_version.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def sub_version @sub_version end |
#with_time_in_transit ⇒ Object (readonly)
Returns the value of attribute with_time_in_transit.
51 52 53 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 51 def with_time_in_transit @with_time_in_transit end |
Instance Method Details
#customer_classification_code ⇒ Object
105 106 107 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 105 def customer_classification_code CUSTOMER_CLASSIFICATION_CODES[@customer_classification] end |
#pickup_type_code ⇒ Object
101 102 103 |
# File 'lib/friendly_shipping/services/ups_json/rates_options.rb', line 101 def pickup_type_code PICKUP_TYPE_CODES[@pickup_type] end |