Class: Fappu::Tag
- Inherits:
-
Object
- Object
- Fappu::Tag
- Defined in:
- lib/fappu/tag.rb
Constant Summary collapse
- URL =
"https://api.fakku.net/tags"
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(args) ⇒ Tag
Returns a new instance of Tag.
7 8 9 10 11 |
# File 'lib/fappu/tag.rb', line 7 def initialize args args.each do |k,v| instance_variable_set("@#{k}",v) unless v.nil? end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/fappu/tag.rb', line 4 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/fappu/tag.rb', line 4 def url @url end |
Class Method Details
.list ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/fappu/tag.rb', line 13 def self.list response = JSON.parse( URI.parse(URL).read ) arr = response["tags"] arr.collect do |tag| self.new(tag_parameters(tag)) end end |