Class: Alexa::UrlInfo::Categories

Inherits:
Object
  • Object
show all
Includes:
Container
Defined in:
lib/alexa/url_info/categories.rb

Instance Attribute Summary

Attributes included from Container

#data

Instance Method Summary collapse

Methods included from Container

included, #keys, #method_missing, #to_mongo

Constructor Details

#initialize(xml_node = nil) ⇒ Categories

Returns a new instance of Categories.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/alexa/url_info/categories.rb', line 6

def initialize(xml_node = nil)
  @data = {}
  @data[:categories] = []

  if xml_node != nil
    xml_node.xpath('CategoryData').each do |c|
      @data[:categories] << {
        :title         => c.xpath('Title').text.strip,
        :absolute_path => c.xpath('AbsolutePath').text.strip,
      }
    end
  end

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Alexa::Container