Class: GoogleCheckout::Geography::Postal

Inherits:
Area
  • Object
show all
Defined in:
lib/google-checkout/geography/postal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(country, postal_pattern = nil) ⇒ Postal

Returns a new instance of Postal.



7
8
9
10
# File 'lib/google-checkout/geography/postal.rb', line 7

def initialize(country, postal_pattern=nil)
  @country = country
  @postal_pattern = postal_pattern
end

Instance Attribute Details

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/google-checkout/geography/postal.rb', line 5

def country
  @country
end

#postal_patternObject

Returns the value of attribute postal_pattern.



5
6
7
# File 'lib/google-checkout/geography/postal.rb', line 5

def postal_pattern
  @postal_pattern
end

Instance Method Details

#to_xmlObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/google-checkout/geography/postal.rb', line 12

def to_xml
  xml = Builder::XmlMarkup.new
  xml.tag!('postal-area') do
    xml.tag!('country-code') do
      xml.text! @country
    end
    xml.tag!('postal-code-pattern') do
      xml.text! @postal_pattern
    end if @postal_pattern
  end
end