Class: Pebbles::Command::Auth

Inherits:
Base
  • Object
show all
Defined in:
lib/pebbles/command/auth.rb

Overview

authentication (login, logout)

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#api, #app, #initialize, namespace

Methods included from Helpers

#action, #ask, #confirm_command, #create_git_remote, #debug, #debugging?, #display, #error, error_with_failure, error_with_failure=, #flatten_hash, #format_bytes, #format_error, #format_with_bang, #git, #has_git?, #has_git_remote?, #has_http_git_entry_in_netrc, #home_directory, #hputs, #json_decode, #launchy, #line_formatter, #longest, #output_with_bang, #running_on_a_mac?, #running_on_windows?, #styled_array, #styled_error, #styled_hash, #styled_header, #update_git_remote, #with_tty

Constructor Details

This class inherits a constructor from Pebbles::Command::Base

Instance Method Details

#indexObject

auth

Authenticate, display token and current user



10
11
12
13
14
# File 'lib/pebbles/command/auth.rb', line 10

def index
  validate_arguments!

  Pebbles::Command::Help.new.send(:help_for_command, current_command)
end

#loginObject

auth:login

log in with your Pebblescape credentials

Example:

$ pebbles auth:login Enter your Pebblescape credentials: Email: [email protected] Password (typing will be hidden): Authentication successful.



28
29
30
31
32
33
# File 'lib/pebbles/command/auth.rb', line 28

def 
  validate_arguments!

  Pebbles::Auth.
  display "Authentication successful."
end

#logoutObject

auth:logout

clear local authentication credentials

Example:

$ pebbles auth:logout Local credentials cleared.



46
47
48
49
50
51
# File 'lib/pebbles/command/auth.rb', line 46

def logout
  validate_arguments!

  Pebbles::Auth.logout
  display "Local credentials cleared."
end

#tokenObject

auth:token

display your api token

Example:

$ pebbles auth:token ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD



64
65
66
67
68
# File 'lib/pebbles/command/auth.rb', line 64

def token
  validate_arguments!

  display Pebbles::Auth.api_key
end

#whoamiObject

auth:whoami

display your Pebblescape email address

Example:

$ pebbles auth:whoami [email protected]



79
80
81
82
83
# File 'lib/pebbles/command/auth.rb', line 79

def whoami
  validate_arguments!

  display Pebbles::Auth.user
end