Class: Redditor

Inherits:
Object
  • Object
show all
Defined in:
lib/Rubbit/Rubbit_Objects.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Redditor

Returns a new instance of Redditor.



52
53
54
55
56
57
58
59
60
# File 'lib/Rubbit/Rubbit_Objects.rb', line 52

def initialize(json)
  if(json['kind']=='t2')
    data = json['data']
    data.each_key do |k|
      self.class.module_eval {attr_accessor(k)}
      self.send("#{k}=",data[k])
    end
  end
end

Instance Method Details

#get_comments(limit = 100) ⇒ Object



66
67
68
# File 'lib/Rubbit/Rubbit_Objects.rb', line 66

def get_comments(limit=100)
  return ContentGenerator.new('http://www.reddit.com/user/'+@name.to_s+'/comments.json',limit)
end

#get_overview(limit = 100) ⇒ Object



62
63
64
# File 'lib/Rubbit/Rubbit_Objects.rb', line 62

def get_overview(limit=100)
  return ContentGenerator.new('http://www.reddit.com/user/'+@name.to_s+'/.json',limit)
end

#get_submitted(limit = 100) ⇒ Object



70
71
72
# File 'lib/Rubbit/Rubbit_Objects.rb', line 70

def (limit=100)
  return ContentGenerator.new('http://www.reddit.com/user/'+@name.to_s+'/submitted.json',limit)
end