Sha256: 095d0e8c60535ba25a0282aedad1435f07b2b07465619cd382bc010478272071

Contents?: true

Size: 593 Bytes

Versions: 18

Compression:

Stored size: 593 Bytes

Contents

module HaveAPI::CLI::Authentication
  class Basic < Base
    register :basic

    def options(opts)
      opts.on('--username USER', 'User name') do |u|
        @user = u
      end

      opts.on('--password PASSWORD', 'Password') do |p|
        @password = p
      end
    end

    def validate
      @user ||= ask('User name: ') { |q| q.default = nil }.to_s

      @password ||= ask('Password: ') do |q|
        q.default = nil
        q.echo = false
      end.to_s
    end

    def authenticate
      @communicator.authenticate(:basic, {user: @user, password: @password})
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
haveapi-client-0.11.1 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.11.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.10.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.9.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.8.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.7.1 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.7.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.6.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.5.4 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.5.3 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.5.2 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.5.1 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.5.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.4.2 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.4.1 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.4.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.3.0 lib/haveapi/cli/authentication/basic.rb
haveapi-client-0.2.0 lib/haveapi/cli/authentication/basic.rb