Class: Ravelry::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/ravelry/category.rb

Overview

There is no API access point for PatternCategories. The information used to create ‘Ravelry::Category` comes from Pattern objects.

You should not create ‘Category` objects manually; they are all created–and owned by–by a Pattern.

See Pattern for more information about ‘Pattern` objects.

This does not inherit from Data because it doesn’t have a corresponding API endpoint.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category) ⇒ Category

Creates new ‘Category` from Ravelry API PatternCategories attributes up to the great grandparent level

All class variables are readonly.



18
19
20
21
22
23
# File 'lib/ravelry/category.rb', line 18

def initialize(category)
  @name = category[:name]
  @permalink = category[:permalink]
  @category = category
  set_relatives
end

Instance Attribute Details

#grandparent_nameObject (readonly)

Returns the value of attribute grandparent_name.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def grandparent_name
  @grandparent_name
end

Returns the value of attribute grandparent_permalink.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def grandparent_permalink
  @grandparent_permalink
end

#greatgrandparent_nameObject (readonly)

Returns the value of attribute greatgrandparent_name.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def greatgrandparent_name
  @greatgrandparent_name
end

Returns the value of attribute greatgrandparent_permalink.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def greatgrandparent_permalink
  @greatgrandparent_permalink
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def name
  @name
end

#parent_nameObject (readonly)

Returns the value of attribute parent_name.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def parent_name
  @parent_name
end

Returns the value of attribute parent_permalink.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def parent_permalink
  @parent_permalink
end

Returns the value of attribute permalink.



12
13
14
# File 'lib/ravelry/category.rb', line 12

def permalink
  @permalink
end