Sha256: 0d06f324827c32fa5f077888920e3d8a455ee011cfcfaf6a32cb8709789f2489

Contents?: true

Size: 1007 Bytes

Versions: 7

Compression:

Stored size: 1007 Bytes

Contents

module Redd
  module Client
    class Unauthenticated
      # Methods for managing accounts.
      module Account
        # Login to the reddit account.
        #
        # @param username [String] The username.
        # @param password [String] The password.
        # @param remember [Boolean] Indicates whether you intend to use the
        #   returned cookie for a long time.
        # @param options [Hash] The options to create an instance of
        #   {Redd::Client::Authenticated}.
        def login(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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redd-0.6.5 lib/redd/client/unauthenticated/account.rb
redd-0.6.4 lib/redd/client/unauthenticated/account.rb
redd-0.6.3 lib/redd/client/unauthenticated/account.rb
redd-0.6.2 lib/redd/client/unauthenticated/account.rb
redd-0.6.1 lib/redd/client/unauthenticated/account.rb
redd-0.6.0 lib/redd/client/unauthenticated/account.rb
redd-0.5.0 lib/redd/client/unauthenticated/account.rb