Class: Google4R::Checkout::CarrierCalculatedShipping::CarrierCalculatedShippingOption
- Inherits:
-
DeliveryMethod
- Object
- DeliveryMethod
- Google4R::Checkout::CarrierCalculatedShipping::CarrierCalculatedShippingOption
- Defined in:
- lib/google4r/checkout/shared.rb
Constant Summary collapse
- FEDEX =
Constants for shipping company
'FedEx'- UPS =
'UPS'- USPS =
'USPS'- DROP_OFF =
Constants for carrier pickup
'DROP_OFF'- REGULAR_PICKUP =
'REGULAR_PICKUP'- SPECIAL_PICKUP =
'SPECIAL_PICKUP'
Instance Attribute Summary collapse
-
#additional_fixed_charge ⇒ Object
The fixed charge that will be added to the total cost of an order if the buyer selects the associated shipping option (Money, optional).
-
#additional_variable_charge_percent ⇒ Object
The percentage amount by which a carrier-calculated shipping rate will be adjusted.
-
#carrier_calculated_shipping ⇒ Object
readonly
The CarrierCalculatedShipping instance that this option belongs to.
-
#carrier_pickup ⇒ Object
This specifies how the package will be transferred from the merchant to the shipper.
-
#shipping_type ⇒ Object
The shipping option that is being offered to the buyer.
Attributes inherited from DeliveryMethod
Class Method Summary collapse
-
.create_from_element(this_shipping, element) ⇒ Object
Creates a new CarrierCalculatedShippingOption from the given REXML::Element instance.
Instance Method Summary collapse
-
#initialize(carrier_calculated_shipping) ⇒ CarrierCalculatedShippingOption
constructor
A new instance of CarrierCalculatedShippingOption.
Constructor Details
#initialize(carrier_calculated_shipping) ⇒ CarrierCalculatedShippingOption
Returns a new instance of CarrierCalculatedShippingOption.
1007 1008 1009 1010 |
# File 'lib/google4r/checkout/shared.rb', line 1007 def initialize(carrier_calculated_shipping) @carrier_calculated_shipping = carrier_calculated_shipping #@carrier_pickup = DROP_OFF end |
Instance Attribute Details
#additional_fixed_charge ⇒ Object
The fixed charge that will be added to the total cost of an order if the buyer selects the associated shipping option (Money, optional)
1000 1001 1002 |
# File 'lib/google4r/checkout/shared.rb', line 1000 def additional_fixed_charge @additional_fixed_charge end |
#additional_variable_charge_percent ⇒ Object
The percentage amount by which a carrier-calculated shipping rate will be adjusted. The tag's value may be positive or negative. (Float, optional)
1005 1006 1007 |
# File 'lib/google4r/checkout/shared.rb', line 1005 def additional_variable_charge_percent @additional_variable_charge_percent end |
#carrier_calculated_shipping ⇒ Object (readonly)
The CarrierCalculatedShipping instance that this option belongs to.
980 981 982 |
# File 'lib/google4r/checkout/shared.rb', line 980 def carrier_calculated_shipping @carrier_calculated_shipping end |
#carrier_pickup ⇒ Object
This specifies how the package will be transferred from the merchant to the shipper. Valid values for this tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default value for this tag is DROP_OFF. (optional)
995 996 997 |
# File 'lib/google4r/checkout/shared.rb', line 995 def carrier_pickup @carrier_pickup end |
#shipping_type ⇒ Object
The shipping option that is being offered to the buyer
989 990 991 |
# File 'lib/google4r/checkout/shared.rb', line 989 def shipping_type @shipping_type end |
Class Method Details
.create_from_element(this_shipping, element) ⇒ Object
Creates a new CarrierCalculatedShippingOption from the given REXML::Element instance. For testing only.
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 |
# File 'lib/google4r/checkout/shared.rb', line 1015 def self.create_from_element(this_shipping, element) result = CarrierCalculatedShippingOption.new(this_shipping) result.shipping_company = element.elements['shipping-company'].text price = (element.elements['price'].text.to_f * 100).to_i price_currency = element.elements['price'].attributes['currency'] result.price = Money.new(price, price_currency) result.shipping_type = element.elements['shipping-type'] result.carrier_pickup = element.elements['carrier-pickup'] rescue nil result.additional_fixed_charge = element.elements['additional-fixed-charge'] rescue nil result.additional_variable_charge_percent = element.elements['additional-variable-charge-percent'] rescue nil end |