Class: RedditKit::Client

Inherits:
Object
  • Object
show all
Includes:
Account, Apps, Captcha, Comments, Flair, Links, Miscellaneous, Moderation, Multireddits, PrivateMessages, Search, Subreddits, Users, Utilities, Voting, Wiki
Defined in:
lib/redditkit/client.rb,
lib/redditkit/client/apps.rb,
lib/redditkit/client/wiki.rb,
lib/redditkit/client/flair.rb,
lib/redditkit/client/links.rb,
lib/redditkit/client/users.rb,
lib/redditkit/client/search.rb,
lib/redditkit/client/voting.rb,
lib/redditkit/client/account.rb,
lib/redditkit/client/captcha.rb,
lib/redditkit/client/comments.rb,
lib/redditkit/client/utilities.rb,
lib/redditkit/client/moderation.rb,
lib/redditkit/client/subreddits.rb,
lib/redditkit/client/multireddits.rb,
lib/redditkit/client/miscellaneous.rb,
lib/redditkit/client/private_messages.rb

Overview

The client for the reddit API, handling all interactions with reddit’s servers.

Defined Under Namespace

Modules: Account, Apps, Captcha, Comments, Flair, Links, Miscellaneous, Moderation, Multireddits, PrivateMessages, Search, Subreddits, Users, Utilities, Voting, Wiki

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Wiki

#add_wiki_editor, #edit_wiki_page, #hide_wiki_revision, #remove_wiki_editor, #revert_to_revision

Methods included from Voting

#downvote, #upvote, #vote, #withdraw_vote

Methods included from Users

#friend, #friends, #my_content, #register, #unfriend, #user, #user_content, #username_available?

Methods included from Subreddits

#random_subreddit, #recommended_subreddits, #search_subreddits_by_name, #subreddit, #subreddits, #subreddits_by_topic, #subscribe, #subscribed_subreddits, #unsubscribe

Methods included from Search

#search

Methods included from PrivateMessages

#block_author_of_message, #mark_as_read, #mark_as_unread, #messages, #send_message, #unblock

Methods included from Multireddits

#add_subreddit_to_multireddit, #copy_multireddit, #create_multireddit, #delete_multireddit, #multireddit, #multireddit_description, #my_multireddits, #remove_subreddit_from_multireddit, #rename_multireddit, #set_multireddit_description, #update_multireddit

Methods included from Moderation

#accept_moderator_invitation, #approve, #ban, #contributors_to_subreddit, #distinguish, #ignore_reports, #moderation_log, #moderators_of_subreddit, #remove, #reset_subreddit_header, #resign_as_contributor, #resign_as_moderator, #set_contest_mode, #set_sticky_post, #unban, #unignore_reports

Methods included from Miscellaneous

#delete, #edit, #report, #save, #unsave

Methods included from Links

#front_page, #hide, #link, #links, #links_with_domain, #mark_nsfw, #mark_sfw, #random_link, #submit, #unhide

Methods included from Flair

#apply_flair_template, #clear_flair_templates, #create_flair_template, #delete_flair_template, #delete_user_flair, #flair_list, #set_flair, #set_flair_options, #set_flair_with_csv, #toggle_flair

Methods included from Comments

#comment, #comments, #submit_comment

Methods included from Captcha

#captcha_url, #needs_captcha?, #new_captcha_identifier

Methods included from Apps

#add_developer, #create_app, #delete_app, #remove_developer, #revoke_app

Methods included from Account

#sign_in, #sign_out, #signed_in?, #update_account, #update_session

Constructor Details

#initialize(username = nil, password = nil) ⇒ Client

Returns a new instance of Client.



54
55
56
57
58
59
60
61
62
# File 'lib/redditkit/client.rb', line 54

def initialize(username = nil, password = nil)
  @username = username
  @password = password

  @cookie = nil
  @modhash = nil

  (username, password) unless username.nil? || password.nil?
end

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



49
50
51
# File 'lib/redditkit/client.rb', line 49

def api_endpoint
  @api_endpoint
end

#authentication_endpointObject

Returns the value of attribute authentication_endpoint.



50
51
52
# File 'lib/redditkit/client.rb', line 50

def authentication_endpoint
  @authentication_endpoint
end

Returns the value of attribute cookie.



46
47
48
# File 'lib/redditkit/client.rb', line 46

def cookie
  @cookie
end

#current_userObject (readonly)

Returns the value of attribute current_user.



45
46
47
# File 'lib/redditkit/client.rb', line 45

def current_user
  @current_user
end

#middlewareObject

Returns the value of attribute middleware.



52
53
54
# File 'lib/redditkit/client.rb', line 52

def middleware
  @middleware
end

#modhashObject (readonly)

Returns the value of attribute modhash.



47
48
49
# File 'lib/redditkit/client.rb', line 47

def modhash
  @modhash
end

#user_agentObject

Returns the value of attribute user_agent.



51
52
53
# File 'lib/redditkit/client.rb', line 51

def user_agent
  @user_agent
end

#usernameObject (readonly)

Returns the value of attribute username.



44
45
46
# File 'lib/redditkit/client.rb', line 44

def username
  @username
end