Sha256: fe31d1b6dc83fb391d773b5541a1b6874977533ec814a2d09bc118892e5faea6

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

module Redd
  module Client
    class Unauthenticated
      module Account
        def login(username, password, remember = false)
          meth = :post
          path = "/api/login"
          params = {
            api_type: "json", user: username,
            passwd: password, rem: remember
          }
          response = send(meth, path, params)
          data = response.body[:json][:data]

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redd-0.1.2 lib/redd/client/unauthenticated/account.rb
redd-0.1.1 lib/redd/client/unauthenticated/account.rb
redd-0.1.0 lib/redd/client/unauthenticated/account.rb