module Rubillow::Models::Addressable
Common data for responses containing address information.
Attributes
address[RW]
@return [Hash] Address information (all are strings, keys are: :street, :city, :state, :zipcode, :latitude, :longitude).
@example
puts address[:street] puts address[:city]
Public Instance Methods
full_address()
click to toggle source
get the full, formatted address
@return [String] formatted address
# File lib/rubillow/models/addressable.rb, line 16 def full_address @address[:street] + ', ' + @address[:city] + ', ' + @address[:state] + ' ' + @address[:zipcode] end
Protected Instance Methods
extract_address(xml)
click to toggle source
@private
# File lib/rubillow/models/addressable.rb, line 23 def extract_address(xml) address = xml.xpath('//address') if !address.empty? @address = { :street => address.xpath('//street').first.text, :city => address.xpath('//city').first.text, :state => address.xpath('//state').first.text, :zipcode => address.xpath('//zipcode').first.text, :latitude => address.xpath('//latitude').first.text, :longitude => address.xpath('//longitude').first.text, } end end