Class: Reddit::User
Instance Attribute Summary collapse
-
#comment_karma ⇒ Object
readonly
Returns the value of attribute comment_karma.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#created_utc ⇒ Object
readonly
Returns the value of attribute created_utc.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#has_mod_mail ⇒ Object
readonly
Returns the value of attribute has_mod_mail.
-
#is_mod ⇒ Object
readonly
Returns the value of attribute is_mod.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#link_karma ⇒ Object
readonly
Returns the value of attribute link_karma.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Api
Instance Method Summary collapse
- #friend ⇒ Object
- #id ⇒ Object
-
#initialize(json) ⇒ User
constructor
A new instance of User.
- #inspect ⇒ Object
- #to_s ⇒ Object
- #unfriend ⇒ Object
Methods inherited from Api
#browse, #comments, #post_replies, #received_messages, #sent_messages
Constructor Details
#initialize(json) ⇒ User
Returns a new instance of User.
5 6 7 8 |
# File 'lib/ruby_reddit_api/user.rb', line 5 def initialize(json) @debug = StringIO.new parse(json) end |
Instance Attribute Details
#comment_karma ⇒ Object (readonly)
Returns the value of attribute comment_karma.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def comment_karma @comment_karma end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def created @created end |
#created_utc ⇒ Object (readonly)
Returns the value of attribute created_utc.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def created_utc @created_utc end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def debug @debug end |
#has_mod_mail ⇒ Object (readonly)
Returns the value of attribute has_mod_mail.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def has_mod_mail @has_mod_mail end |
#is_mod ⇒ Object (readonly)
Returns the value of attribute is_mod.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def is_mod @is_mod end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def kind @kind end |
#link_karma ⇒ Object (readonly)
Returns the value of attribute link_karma.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def link_karma @link_karma end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ruby_reddit_api/user.rb', line 4 def name @name end |
Instance Method Details
#friend ⇒ Object
22 23 24 25 26 |
# File 'lib/ruby_reddit_api/user.rb', line 22 def friend capture_user_id resp=self.class.post("/api/friend", {:body => {:name => name, :container => user_id, :type => "friend", :uh => modhash}, :headers => base_headers, :debug_output => @debug }) resp.code == 200 end |
#id ⇒ Object
14 15 16 |
# File 'lib/ruby_reddit_api/user.rb', line 14 def id "#{kind}_#{@id}" end |
#inspect ⇒ Object
10 11 12 |
# File 'lib/ruby_reddit_api/user.rb', line 10 def inspect "<Reddit::User name='#{name}'>" end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/ruby_reddit_api/user.rb', line 18 def to_s name end |
#unfriend ⇒ Object
28 29 30 31 32 |
# File 'lib/ruby_reddit_api/user.rb', line 28 def unfriend capture_user_id resp=self.class.post("/api/unfriend", {:body => {:name => name, :container => user_id, :type => "friend", :uh => modhash}, :headers => base_headers, :debug_output => @debug }) resp.code == 200 end |