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.
1027 1028 1029 1030 |
# File 'lib/google4r/checkout/shared.rb', line 1027 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)
1020 1021 1022 |
# File 'lib/google4r/checkout/shared.rb', line 1020 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)
1025 1026 1027 |
# File 'lib/google4r/checkout/shared.rb', line 1025 def additional_variable_charge_percent @additional_variable_charge_percent end |
#carrier_calculated_shipping ⇒ Object (readonly)
The CarrierCalculatedShipping instance that this option belongs to.
1000 1001 1002 |
# File 'lib/google4r/checkout/shared.rb', line 1000 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)
1015 1016 1017 |
# File 'lib/google4r/checkout/shared.rb', line 1015 def carrier_pickup @carrier_pickup end |
#shipping_type ⇒ Object
The shipping option that is being offered to the buyer
1009 1010 1011 |
# File 'lib/google4r/checkout/shared.rb', line 1009 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.
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 |
# File 'lib/google4r/checkout/shared.rb', line 1035 def self.create_from_element(this_shipping, element) result = CarrierCalculatedShippingOption.new(this_shipping) result.shipping_company = element.elements['shipping-company'].text price = (BigDecimal.new(element.elements['price'].text) * 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 |