Class: ChefLicensing::LicenseKeyFetcher::Prompt
- Inherits:
-
Object
- Object
- ChefLicensing::LicenseKeyFetcher::Prompt
- Defined in:
- lib/chef-licensing/license_key_fetcher/prompt.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#license_type ⇒ Object
Returns the value of attribute license_type.
-
#tui_engine ⇒ Object
Returns the value of attribute tui_engine.
Instance Method Summary collapse
- #append_info_to_tui_engine(extra_info_hash) ⇒ Object
- #fetch ⇒ Object
-
#initialize(config = {}) ⇒ Prompt
constructor
A new instance of Prompt.
Constructor Details
#initialize(config = {}) ⇒ Prompt
Returns a new instance of Prompt.
8 9 10 11 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 8 def initialize(config = {}) @config = config initialize_tui_engine end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 6 def config @config end |
#license_type ⇒ Object
Returns the value of attribute license_type.
6 7 8 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 6 def license_type @license_type end |
#tui_engine ⇒ Object
Returns the value of attribute tui_engine.
6 7 8 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 6 def tui_engine @tui_engine end |
Instance Method Details
#append_info_to_tui_engine(extra_info_hash) ⇒ Object
27 28 29 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 27 def append_info_to_tui_engine(extra_info_hash) tui_engine.append_info_to_input(extra_info_hash) end |
#fetch ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/chef-licensing/license_key_fetcher/prompt.rb', line 13 def fetch # Here info is a hash of { interaction_id: response } info = tui_engine.run_interaction(config[:start_interaction]) # The interaction_id ask_for_license_id holds the license key # TODO: Do we move this to tui_engine? if info[:fetch_license_id].nil? [] else self.license_type = info[:license_type] [info[:fetch_license_id]] end end |