Module: GoogleCheckout::Shipping::Restrictions
- Included in:
- FlatRate, MerchantCalculated
- Defined in:
- lib/google-checkout/shipping/restrictions.rb
Instance Attribute Summary collapse
-
#shipping_restrictions ⇒ Object
Returns the value of attribute shipping_restrictions.
Instance Method Summary collapse
Instance Attribute Details
#shipping_restrictions ⇒ Object
Returns the value of attribute shipping_restrictions.
5 6 7 |
# File 'lib/google-checkout/shipping/restrictions.rb', line 5 def shipping_restrictions @shipping_restrictions end |
Instance Method Details
#shipping_restrictions? ⇒ Boolean
7 8 9 |
# File 'lib/google-checkout/shipping/restrictions.rb', line 7 def shipping_restrictions? @shipping_restrictions != {:allowed => [], :excluded => [], :allow_us_po_box => true} end |
#shipping_restrictions_xml ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/google-checkout/shipping/restrictions.rb', line 11 def shipping_restrictions_xml xml = Builder::XmlMarkup.new xml.tag!('shipping-restrictions') do xml.tag!('allowed-areas') do @shipping_restrictions[:allowed].each do |area| xml << area.to_xml end end unless @shipping_restrictions[:allowed].empty? xml.tag!('excluded-areas') do @shipping_restrictions[:excluded].each do |area| xml << area.to_xml end end unless @shipping_restrictions[:excluded].empty? xml.tag!('allow-us-po-box') do xml.text! 'false' end unless @shipping_restrictions[:allow_us_po_box] end end |