examples/multi_street_address.rb in happymapper-0.3.2 vs examples/multi_street_address.rb in happymapper-0.4.0
- old
+ new
@@ -4,12 +4,27 @@
file_contents = File.read(dir + '/../spec/fixtures/multi_street_address.xml')
class MultiStreetAddress
include HappyMapper
+ tag 'address'
+
# allow primitive type to be collection
has_many :street_address, String, :tag => "streetaddress"
element :city, String
- element :state_or_providence, String, :tag => "stateOfProvidence"
+ element :state_or_province, String, :tag => "stateOrProvince"
element :zip, String
element :country, String
-end
\ No newline at end of file
+end
+
+multi = MultiStreetAddress.parse(file_contents)
+
+puts "Street Address:"
+
+multi.street_address.each do |street|
+ puts street
+end
+
+puts "City: #{multi.city}"
+puts "State/Province: #{multi.state_or_province}"
+puts "Zip: #{multi.zip}"
+puts "Country: #{multi.country}"