Class: Google4R::Checkout::MerchantCalculatedShipping
- Inherits:
-
ShippingMethod
- Object
- DeliveryMethod
- ShippingMethod
- Google4R::Checkout::MerchantCalculatedShipping
- Defined in:
- lib/google4r/checkout/shared.rb
Overview
A class that represents the "merchant-calculated" shipping method
Instance Attribute Summary collapse
-
#address_filters_allowed_areas ⇒ Object
readonly
An Array of allowed areas for address-filters of this shipping instance.
-
#address_filters_excluded_areas ⇒ Object
readonly
An Array of excluded areas for address-filters of this shipping instance.
Attributes inherited from ShippingMethod
#shipping_restrictions_allowed_areas, #shipping_restrictions_excluded_areas
Attributes inherited from DeliveryMethod
Instance Method Summary collapse
-
#create_address_filters_allowed_area(clazz, &block) ⇒ Object
Creates a new Area, adds it to the internal list of excluded areas for address filters.
-
#initialize ⇒ MerchantCalculatedShipping
constructor
A new instance of MerchantCalculatedShipping.
Methods inherited from ShippingMethod
#create_allowed_area, #create_area, #create_excluded_area
Constructor Details
#initialize ⇒ MerchantCalculatedShipping
Returns a new instance of MerchantCalculatedShipping.
874 875 876 877 878 |
# File 'lib/google4r/checkout/shared.rb', line 874 def initialize super @address_filters_allowed_areas = Array.new @address_filters_excluded_areas = Array.new end |
Instance Attribute Details
#address_filters_allowed_areas ⇒ Object (readonly)
An Array of allowed areas for address-filters of this shipping instance. Use #create_allowed_area to add to this area but do not change it directly.
868 869 870 |
# File 'lib/google4r/checkout/shared.rb', line 868 def address_filters_allowed_areas @address_filters_allowed_areas end |
#address_filters_excluded_areas ⇒ Object (readonly)
An Array of excluded areas for address-filters of this shipping instance. Use #create_excluded_area to add to this area but do not change it directly.
872 873 874 |
# File 'lib/google4r/checkout/shared.rb', line 872 def address_filters_excluded_areas @address_filters_excluded_areas end |
Instance Method Details
#create_address_filters_allowed_area(clazz, &block) ⇒ Object
Creates a new Area, adds it to the internal list of excluded areas for address filters. If you passed a block (preferred) then the block is called with the Area as the only parameter.
The area to be created depends on the given parameter clazz. It can be one of { PostalArea, UsCountryArea, UsStateArea, UsZipArea, WorldArea }.
Raises a RuntimeError if the parameter clazz is invalid.
Example
method = FlatRateShipping.new
method.create_allowed_area(UsCountryArea) do |area|
area.area = UsCountryArea::ALL
end
895 896 897 |
# File 'lib/google4r/checkout/shared.rb', line 895 def create_address_filters_allowed_area(clazz, &block) return create_area(:address_filters, :allowed_areas, clazz, &block) end |