Class: Kiita::Tag

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/kiita/tag.rb

Constant Summary collapse

@@attributes =
%w[name icon_url item_count follower_count following]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#raw_attributes

Constructor Details

#initialize(url_name, options = {}) ⇒ Tag

Returns a new instance of Tag.



11
12
13
14
15
16
17
18
19
20
# File 'lib/kiita/tag.rb', line 11

def initialize(url_name, options = {})
  if url_name.is_a?(Hash)
    options = url_name
    @url_name = options["url_name"]
  else
    @url_name = url_name
  end

  super(options)
end

Instance Attribute Details

#url_nameObject (readonly)

Returns the value of attribute url_name.



4
5
6
# File 'lib/kiita/tag.rb', line 4

def url_name
  @url_name
end

Class Method Details

.all(options = {}) ⇒ Object



26
27
28
# File 'lib/kiita/tag.rb', line 26

def self.all(options = {})
  Kiita::API.get("/tags", options).map{|tag| Kiita::Tag.new(tag) }
end

Instance Method Details

#posts(options = {}) ⇒ Object



22
23
24
# File 'lib/kiita/tag.rb', line 22

def posts(options = {})
  Kiita::API.get("/tags/#{url_name}/items", options).map{|post| Kiita::Post.new(post) }
end