Class: Aspera::Cli::BasicAuthPlugin
- Defined in:
 - lib/aspera/cli/basic_auth_plugin.rb
 
Overview
base class for applications supporting basic authentication
Direct Known Subclasses
Plugins::Alee, Plugins::Aoc, Plugins::Console, Plugins::Faspex, Plugins::Faspex5, Plugins::Faspio, Plugins::Node, Plugins::Orchestrator, Plugins::Preview, Plugins::Server, Plugins::Shares
Constant Summary
Constants inherited from Plugin
Plugin::ALL_OPS, Plugin::GLOBAL_OPS, Plugin::INIT_PARAMS, Plugin::INSTANCE_OPS, Plugin::MAX_ITEMS, Plugin::MAX_PAGES, Plugin::REGEX_LOOKUP_ID_BY_FIELD
Class Method Summary collapse
Instance Method Summary collapse
- #basic_auth_api(subpath = nil) ⇒ Object
 - 
  
    
      #basic_auth_params(subpath = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns a Rest object with basic auth.
 - 
  
    
      #initialize(basic_options: true, **env)  ⇒ BasicAuthPlugin 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of BasicAuthPlugin.
 
Methods inherited from Plugin
declare_generic_options, #do_bulk_operation, #entity_action, #entity_command, #init_params, #instance_identifier, #query_option, #query_read_delete, #value_create_modify
Constructor Details
#initialize(basic_options: true, **env) ⇒ BasicAuthPlugin
Returns a new instance of BasicAuthPlugin.
      19 20 21 22  | 
    
      # File 'lib/aspera/cli/basic_auth_plugin.rb', line 19 def initialize(basic_options: true, **env) super(**env) BasicAuthPlugin.() if end  | 
  
Class Method Details
.declare_options(options) ⇒ Object
      11 12 13 14 15 16  | 
    
      # File 'lib/aspera/cli/basic_auth_plugin.rb', line 11 def () .declare(:url, 'URL of application, e.g. https://faspex.example.com/aspera/faspex') .declare(:username, "User's name to log in") .declare(:password, "User's password") . end  | 
  
Instance Method Details
#basic_auth_api(subpath = nil) ⇒ Object
      37 38 39  | 
    
      # File 'lib/aspera/cli/basic_auth_plugin.rb', line 37 def basic_auth_api(subpath=nil) return Rest.new(**basic_auth_params(subpath)) end  | 
  
#basic_auth_params(subpath = nil) ⇒ Object
returns a Rest object with basic auth
      25 26 27 28 29 30 31 32 33 34 35  | 
    
      # File 'lib/aspera/cli/basic_auth_plugin.rb', line 25 def basic_auth_params(subpath=nil) api_url = .get_option(:url, mandatory: true) api_url = "#{api_url}/#{subpath}" unless subpath.nil? return { base_url: api_url, auth: { type: :basic, username: .get_option(:username, mandatory: true), password: .get_option(:password, mandatory: true) }} end  |