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_allow_us_po_box ⇒ Object
(boolean, optional, default true).
-
#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.
-
#shipping_restrictions_allow_us_po_box ⇒ Object
(boolean, optional, default true).
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 allowed areas for address filters.
-
#create_address_filters_excluded_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.
894 895 896 897 898 |
# File 'lib/google4r/checkout/shared.rb', line 894 def initialize super @address_filters_allowed_areas = Array.new @address_filters_excluded_areas = Array.new end |
Instance Attribute Details
#address_filters_allow_us_po_box ⇒ Object
(boolean, optional, default true)
889 890 891 |
# File 'lib/google4r/checkout/shared.rb', line 889 def address_filters_allow_us_po_box @address_filters_allow_us_po_box end |
#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.
882 883 884 |
# File 'lib/google4r/checkout/shared.rb', line 882 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.
886 887 888 |
# File 'lib/google4r/checkout/shared.rb', line 886 def address_filters_excluded_areas @address_filters_excluded_areas end |
#shipping_restrictions_allow_us_po_box ⇒ Object
(boolean, optional, default true)
892 893 894 |
# File 'lib/google4r/checkout/shared.rb', line 892 def shipping_restrictions_allow_us_po_box @shipping_restrictions_allow_us_po_box end |
Instance Method Details
#create_address_filters_allowed_area(clazz, &block) ⇒ Object
Creates a new Area, adds it to the internal list of allowed 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_address_filters_allowed_area(UsCountryArea) do |area|
area.area = UsCountryArea::ALL
end
915 916 917 |
# File 'lib/google4r/checkout/shared.rb', line 915 def create_address_filters_allowed_area(clazz, &block) return create_area(:address_filters, :allowed_areas, clazz, &block) end |
#create_address_filters_excluded_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_address_filters_excluded_area(UsCountryArea) do |area|
area.area = UsCountryArea::ALL
end
934 935 936 |
# File 'lib/google4r/checkout/shared.rb', line 934 def create_address_filters_excluded_area(clazz, &block) return create_area(:address_filters, :excluded_areas, clazz, &block) end |