Class: Google4R::Checkout::CarrierCalculatedShipping::ShippingPackage
- Inherits:
-
Object
- Object
- Google4R::Checkout::CarrierCalculatedShipping::ShippingPackage
- Defined in:
- lib/google4r/checkout/shared.rb
Constant Summary collapse
- RESIDENTIAL =
Constants for delivery address category
'RESIDENTIAL'- COMMERCIAL =
'COMMERCIAL'
Instance Attribute Summary collapse
-
#carrier_calculated_shipping ⇒ Object
readonly
The CarrierCalculatedShipping instance that this package belongs to.
-
#delivery_address_category ⇒ Object
This indicates whether the shipping method should be applied to a residential or a commercial address.
-
#height ⇒ Object
This contains information about the height of the package being shipped to the customer.
-
#length ⇒ Object
This contains information about the length of the package being shipped to the customer.
-
#ship_from ⇒ Object
This contains information about the location from which an order will be shipped.
-
#width ⇒ Object
This contains information about the width of the package being shipped to the customer.
Class Method Summary collapse
-
.create_from_element(this_shipping, element) ⇒ Object
Creates a new ShippingPackage from the given REXML::Element instance.
Instance Method Summary collapse
-
#initialize(carrier_calculated_shipping) ⇒ ShippingPackage
constructor
A new instance of ShippingPackage.
Constructor Details
#initialize(carrier_calculated_shipping) ⇒ ShippingPackage
Returns a new instance of ShippingPackage.
1059 1060 1061 |
# File 'lib/google4r/checkout/shared.rb', line 1059 def initialize(carrier_calculated_shipping) @carrier_calculated_shipping = carrier_calculated_shipping end |
Instance Attribute Details
#carrier_calculated_shipping ⇒ Object (readonly)
The CarrierCalculatedShipping instance that this package belongs to.
1036 1037 1038 |
# File 'lib/google4r/checkout/shared.rb', line 1036 def carrier_calculated_shipping @carrier_calculated_shipping end |
#delivery_address_category ⇒ Object
This indicates whether the shipping method should be applied to a residential or a commercial address. Valid values for this tag are RESIDENTIAL and COMMERCIAL. (String, optional)
1045 1046 1047 |
# File 'lib/google4r/checkout/shared.rb', line 1045 def delivery_address_category @delivery_address_category end |
#height ⇒ Object
This contains information about the height of the package being shipped to the customer. (Google::Checktou::Dimension, optional)
1049 1050 1051 |
# File 'lib/google4r/checkout/shared.rb', line 1049 def height @height end |
#length ⇒ Object
This contains information about the length of the package being shipped to the customer. (Google::Checktou::Dimension, optional)
1053 1054 1055 |
# File 'lib/google4r/checkout/shared.rb', line 1053 def length @length end |
#ship_from ⇒ Object
This contains information about the location from which an order will be shipped. (AnonymousAddress)
1040 1041 1042 |
# File 'lib/google4r/checkout/shared.rb', line 1040 def ship_from @ship_from end |
#width ⇒ Object
This contains information about the width of the package being shipped to the customer. (Google::Checktou::Dimension, optional)
1057 1058 1059 |
# File 'lib/google4r/checkout/shared.rb', line 1057 def width @width end |
Class Method Details
.create_from_element(this_shipping, element) ⇒ Object
Creates a new ShippingPackage from the given REXML::Element instance. For testing only.
1065 1066 1067 1068 1069 1070 1071 1072 1073 |
# File 'lib/google4r/checkout/shared.rb', line 1065 def self.create_from_element(this_shipping, element) result = ShippingPackage.new(this_shipping) result.ship_from = ShipFromAddress.create_from_element(element.elements['ship-from']) result.delivery_address_category = element.elements['delivery-address-category'].text rescue nil result.height = element.elements['height'].text rescue nil result.length = element.elements['length'].text rescue nil result.width = element.elements['width'].text rescue nil return result end |