Class: Ravelry::Author

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

Overview

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

You should not create ‘Author` 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(pattern_author) ⇒ Author

Creates new ‘Author` from Ravelry API PatternAuthor attributes.

All class variables are readonly.



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

def initialize(pattern_author)
  @id = pattern_author[:id]
  @name = pattern_author[:name]
  @permalink = pattern_author[:permalink]
  @patterns_count = pattern_author[:patterns_count]
  @favorites_count = pattern_author[:favorites_count]
end

Instance Attribute Details

#favorites_countObject (readonly)

Returns the value of attribute favorites_count.



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

def favorites_count
  @favorites_count
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#patterns_countObject (readonly)

Returns the value of attribute patterns_count.



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

def patterns_count
  @patterns_count
end

Returns the value of attribute permalink.



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

def permalink
  @permalink
end