Sha256: 8ec81265cb77510e789bcec9d9ae1388d24b19cd2c15638241af9b3f2f00f610

Contents?: true

Size: 957 Bytes

Versions: 7

Compression:

Stored size: 957 Bytes

Contents

module Ravelry

  # There is no API access point for PatternAuthors. The information used to create `Ravelry::Author` comes from {Ravelry::Pattern} objects.
  #
  # You should not create `Author` objects manually; they are all created–and owned by–by a {Ravelry::Pattern}.
  #
  # See {Ravelry::Pattern} for more information about `Pattern` objects.
  #
  # This does not inherit from {Ravelry::Data} because it doesn't have a corresponding API endpoint.
  #
  class Author
    attr_reader :id, :name, :permalink, :patterns_count, :favorites_count

    # Creates new `Author` from Ravelry API PatternAuthor attributes.
    #
    # All class variables are readonly.
    #
    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
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ravelry-0.2.0 lib/ravelry/author.rb
ravelry-0.1.0 lib/ravelry/author.rb
ravelry-0.0.9 lib/ravelry/author.rb
ravelry-0.0.8 lib/ravelry/author.rb
ravelry-0.0.7 lib/ravelry/author.rb
ravelry-0.0.6 lib/ravelry/author.rb
ravelry-0.0.5 lib/ravelry/author.rb