Class: Alexa::UrlInfo::ContactInfo
- Inherits:
-
Object
- Object
- Alexa::UrlInfo::ContactInfo
- Includes:
- Container
- Defined in:
- lib/alexa/url_info/contact_info.rb
Instance Attribute Summary
Attributes included from Container
Instance Method Summary collapse
-
#initialize(xml_node = nil) ⇒ ContactInfo
constructor
A new instance of ContactInfo.
Methods included from Container
included, #keys, #method_missing, #to_mongo
Constructor Details
#initialize(xml_node = nil) ⇒ ContactInfo
Returns a new instance of ContactInfo.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/alexa/url_info/contact_info.rb', line 6 def initialize(xml_node = nil) @data = {} if ! xml_node.nil? @data[:data_url] = xml_node.xpath('DataUrl').text.strip @data[:phone_numbers] = [] xml_node.xpath('PhoneNumbers/PhoneNumber').each do |p| @data[:phone_numbers] << p.text.strip end @data[:owner_name] = xml_node.xpath('OwnerName').text.strip @data[:email] = xml_node.xpath('Email').text.strip @data[:streets] = [] xml_node.xpath('PhysicalAddress/Streets/Street').each do |s| @data[:streets] << s.text.strip end @data[:city] = xml_node.xpath('PhysicalAddress/City').text.strip @data[:state] = xml_node.xpath('PhysicalAddress/State').text.strip @data[:postal_code] = xml_node.xpath('PhysicalAddress/PostalCode').text.strip @data[:country] = xml_node.xpath('PhysicalAddress/Country').text.strip @data[:stock_symbol] = xml_node.xpath('CompanyStockTicker/Symbol').text.strip end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Alexa::Container