Class: Reddit::Vote

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_reddit_api/vote.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#debug, #last_action

Instance Method Summary collapse

Methods inherited from Base

base_headers, #base_headers, #cookie, #logged_in?, #login, #logout, #modhash, #read, #user, #user_agent, user_agent, #user_id

Constructor Details

#initialize(submission) ⇒ Vote

Returns a new instance of Vote.



6
7
8
# File 'lib/ruby_reddit_api/vote.rb', line 6

def initialize(submission)
  @submission = submission
end

Instance Attribute Details

#submissionObject (readonly)

Returns the value of attribute submission.



4
5
6
# File 'lib/ruby_reddit_api/vote.rb', line 4

def submission
  @submission
end

Instance Method Details

#downtrue, false

Downvote submission or comment

Returns:

  • (true, false)


18
19
20
# File 'lib/ruby_reddit_api/vote.rb', line 18

def down
  vote(:down)
end

#inspectString

Returns:

  • (String)


23
24
25
# File 'lib/ruby_reddit_api/vote.rb', line 23

def inspect
  "<Reddit::Vote>"
end

#uptrue, false

Upvote submission or comment

Returns:

  • (true, false)


12
13
14
# File 'lib/ruby_reddit_api/vote.rb', line 12

def up
  vote(:up)
end