Sha256: 43fc0a232c6482ec7e0c26c88f9684ba848dd2c24c80d18bb7df5296aa9b0425

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

module NTimeLine

  # Category of timeline.
  class Category
    attr_reader :display_name, :sub_categories

    def initialize(elt)
      @display_name = elt.elements["dispaly_name"].to_s
      @sub_categories = []
      elt.each_element("sub_categories/category") do |category|
        @sub_categories << Category.new(category)
      end
    end
  end

  # CategoryResponse is a list of categories.
  class CategoryResponse < Array
    def initialize(doc)
      super
      doc.root.each_element("/response/result/categories/category") do |category|
        self << Category.from_xml(category)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ntimeline-0.1.0 lib/ntimeline/category.rb