Class: Aspera::Cli::Plugins::BasicAuth
- Defined in:
- lib/aspera/cli/plugins/basic_auth.rb
Overview
base class for applications supporting basic authentication
Constant Summary
Constants inherited from Base
Aspera::Cli::Plugins::Base::FILTER_ARGS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #basic_auth_api(subpath = nil) ⇒ Object
-
#basic_auth_params(subpath = nil) ⇒ Object
returns a Rest::Client object with basic auth.
Methods inherited from Base
#action_for, #add_manual_header, application_name, #bulk_result, command, command_registry, commands_under, #config, crud_commands, declare_options, define_action_method, #dispatch_child, #dispatch_from_registry, #dispatch_leaf, #dispatch_mount, #entity_create, #entity_delete, #entity_list, #entity_modify, entity_noun, #entity_res_path, #entity_show, #execute_action, #execute_leaf, file_matcher, #formatter, #generate_help, #http_config, #initialize, #invoke_action, operation_description, option_sources, option_specs, #options, #persistency, #presets, #progress_bar, #query_read_delete, register_option_spec, #resolve_argument, #resolve_arguments, #transfer, use_options, used_option_sources, #validate_registry
Methods included from OptionDeclarator
#declare_options, #option, #option_specs, #register_option_spec
Constructor Details
This class inherits a constructor from Aspera::Cli::Plugins::Base
Instance Method Details
#basic_auth_api(subpath = nil) ⇒ Object
29 30 31 |
# File 'lib/aspera/cli/plugins/basic_auth.rb', line 29 def basic_auth_api(subpath = nil) return Rest::Client.new(**basic_auth_params(subpath)) end |
#basic_auth_params(subpath = nil) ⇒ Object
returns a Rest::Client object with basic auth
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aspera/cli/plugins/basic_auth.rb', line 16 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 |