Module: GoogleCheckout::Shipping::Filters

Included in:
MerchantCalculated
Defined in:
lib/google-checkout/shipping/filters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#address_filtersObject

Returns the value of attribute address_filters.



5
6
7
# File 'lib/google-checkout/shipping/filters.rb', line 5

def address_filters
  @address_filters
end

Instance Method Details

#address_filters?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/google-checkout/shipping/filters.rb', line 7

def address_filters?
  @address_filters != {:allowed => [], :excluded => [], :allow_us_po_box => true}
end

#address_filters_xmlObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/google-checkout/shipping/filters.rb', line 11

def address_filters_xml
  xml = Builder::XmlMarkup.new
  xml.tag!('address-filters') do
    xml.tag!('allowed-areas') do
      @address_filters[:allowed].each do |area|
        xml << area.to_xml
      end
    end unless @address_filters[:allowed].empty?
    xml.tag!('excluded-areas') do
      @address_filters[:excluded].each do |area|
        xml << area.to_xml
      end
    end unless @address_filters[:excluded].empty?
    xml.tag!('allow-us-po-box') do
      xml.text! 'false'
    end unless @address_filters[:allow_us_po_box]
  end
end