class Fappu::Tag

Constants

URL

Attributes

name[RW]
url[RW]

Public Class Methods

list() click to toggle source
# 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
new(args) click to toggle source
# 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

Private Class Methods

tag_parameters(tag) click to toggle source
# File lib/fappu/tag.rb, line 24
def self.tag_parameters(tag)
  params = {
    name: tag["tag_name"],
    url: tag["tag_url"]
  }
end