Class: Howcast::Client::Category
- Inherits:
-
Object
- Object
- Howcast::Client::Category
- Extended by:
- WatchAttrAccessors
- Includes:
- XmlMethods
- Defined in:
- lib/howcast/client/category.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#permalink ⇒ Object
Returns the value of attribute permalink.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Category
constructor
Creates a new Category object which is used to encapsulate all the attributes available from the Howcast Category API.
Methods included from WatchAttrAccessors
Methods included from XmlMethods
Constructor Details
#initialize(attributes = {}) ⇒ Category
Creates a new Category object which is used to encapsulate all the attributes available from the Howcast Category API. The parents attribute will be an array of category ancestors of the form:
[{:id => 1, :name => 'root'}, {:id => 2, :name => 'immediate parent'}]
Inputs
-
attributes
– A hash to set the various attributes of the category object
Examples
Initialize a category with name “Arts & Crafts”
Category.new :name => "Arts & Crafts"
44 45 46 47 48 |
# File 'lib/howcast/client/category.rb', line 44 def initialize(attributes={}) attributes.each do |k, v| self.send("#{k}=", v) if self.respond_to?(k) end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
29 30 31 |
# File 'lib/howcast/client/category.rb', line 29 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
29 30 31 |
# File 'lib/howcast/client/category.rb', line 29 def name @name end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
29 30 31 |
# File 'lib/howcast/client/category.rb', line 29 def parent_id @parent_id end |
#parents ⇒ Object
Returns the value of attribute parents.
29 30 31 |
# File 'lib/howcast/client/category.rb', line 29 def parents @parents end |
#permalink ⇒ Object
Returns the value of attribute permalink.
29 30 31 |
# File 'lib/howcast/client/category.rb', line 29 def permalink @permalink end |