Class: GoogleCheckout::Geography::UsCountry
- Defined in:
- lib/google-checkout/geography/us_country.rb
Constant Summary collapse
- VALID_REGIONS =
[:continental_48, :full_50_states, :all]
Instance Attribute Summary collapse
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize(region) ⇒ UsCountry
constructor
A new instance of UsCountry.
- #to_xml ⇒ Object
Constructor Details
#initialize(region) ⇒ UsCountry
Returns a new instance of UsCountry.
9 10 11 |
# File 'lib/google-checkout/geography/us_country.rb', line 9 def initialize(region) self.region = region end |
Instance Attribute Details
#region ⇒ Object
Returns the value of attribute region.
7 8 9 |
# File 'lib/google-checkout/geography/us_country.rb', line 7 def region @region end |
Instance Method Details
#to_xml ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/google-checkout/geography/us_country.rb', line 13 def to_xml unless VALID_REGIONS.include?(@region.to_sym) raise ArgumentError, ":#{@region.to_s} is not a valid region. You may use :continental_48, :full_50_states or :all" end xml = Builder::XmlMarkup.new xml.tag!('us-country-area', 'country-area' => @region.to_s.upcase) end |