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.
1079 1080 1081 |
# File 'lib/google4r/checkout/shared.rb', line 1079 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.
1056 1057 1058 |
# File 'lib/google4r/checkout/shared.rb', line 1056 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)
1065 1066 1067 |
# File 'lib/google4r/checkout/shared.rb', line 1065 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)
1069 1070 1071 |
# File 'lib/google4r/checkout/shared.rb', line 1069 def height @height end |
#length ⇒ Object
This contains information about the length of the package being shipped to the customer. (Google::Checktou::Dimension, optional)
1073 1074 1075 |
# File 'lib/google4r/checkout/shared.rb', line 1073 def length @length end |
#ship_from ⇒ Object
This contains information about the location from which an order will be shipped. (AnonymousAddress)
1060 1061 1062 |
# File 'lib/google4r/checkout/shared.rb', line 1060 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)
1077 1078 1079 |
# File 'lib/google4r/checkout/shared.rb', line 1077 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.
1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'lib/google4r/checkout/shared.rb', line 1085 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 |