Class: Jiveapps::Command::Oauth

Inherits:
BaseWithApp show all
Defined in:
lib/jiveapps/commands/oauth.rb

Instance Attribute Summary

Attributes inherited from BaseWithApp

#app

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

Methods inherited from BaseWithApp

#initialize

Methods inherited from Base

#extract_app, #extract_app_from_git_config, #extract_app_in_dir, #extract_option, #git_remotes, #initialize, #jiveapps

Methods included from Helpers

#ask, #catch_args, #check_git_version, #confirm, #confirm_command, #debug, #debug_mode?, #display, #display_oauth_services, #error, #get_app_prop_with_default, #get_or_set_git_prop, #git_version, #has_program?, #home_directory, #run, #running_on_a_mac?, #running_on_windows?, #sh, #usage, #user_git_version

Constructor Details

This class inherits a constructor from Jiveapps::Command::BaseWithApp

Instance Method Details

#addObject

Register a new OAuth Service for use with this app



12
13
14
15
16
17
18
19
# File 'lib/jiveapps/commands/oauth.rb', line 12

def add
  usage "jiveapps oauth:add <servicename> <key> <secret>"
  catch_args :servicename, :key, :secret

  display "=== Registering a new OAuth Service: \"#{@servicename}\""
  response = jiveapps.add_oauth_service(app, @servicename, @key, @secret)
  list
end

#listObject Also known as: index

Lists OAuth Services registered for this app



5
6
7
8
# File 'lib/jiveapps/commands/oauth.rb', line 5

def list
  oauth_services = jiveapps.list_oauth_services(app)
  display_oauth_services(oauth_services, app)
end

#removeObject

Remove an OAuth Service



22
23
24
25
26
27
28
29
30
# File 'lib/jiveapps/commands/oauth.rb', line 22

def remove
  usage "jiveapps oauth:remove <servicename>"
  catch_args :servicename

  return unless confirm "Are you sure you wish to remove the OAuth service \"#{@servicename}\"? (y/n)?"
  display "=== Removing Oauth Service \"#{@servicename}\""
  response = jiveapps.remove_oauth_service(app, @servicename)
  list
end