Class: Reddit::Services::User

Inherits:
Object
  • Object
show all
Defined in:
lib/reddit/services/user.rb

Overview

Everything else in the services module is created at runtime through the “service.rb” generator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password, client_id, secret, user_agent_title, options = {}) ⇒ User

Returns a new instance of User.



12
13
14
15
16
17
18
19
20
# File 'lib/reddit/services/user.rb', line 12

def initialize(username, password, client_id, secret, user_agent_title, options = {})

  raise "user_agent_title must be set, please follow the reddit API rules" if user_agent_title == nil

  @name = username
  @connection = Reddit::Internal::Connection.new(username, password, client_id, secret, user_agent_title, options)
  @connection.()
  @token = @connection.token
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



10
11
12
# File 'lib/reddit/services/user.rb', line 10

def connection
  @connection
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/reddit/services/user.rb', line 7

def name
  @name
end

#tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/reddit/services/user.rb', line 8

def token
  @token
end