Module: Redd::Client::Unauthenticated::Account

Included in:
Redd::Client::Unauthenticated
Defined in:
lib/redd/client/unauthenticated/account.rb

Instance Method Summary collapse

Instance Method Details

#login(username, password, remember = false, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/redd/client/unauthenticated/account.rb', line 5

def (username, password, remember = false, options = {})
  response = post "/api/login",
    api_type: "json", user: username, passwd: password, rem: remember
  data = response[:json][:data]

  require "redd/client/authenticated"
  Redd::Client::Authenticated.new(
    data[:cookie], data[:modhash], options
  )
end