Module: Flucti::APIAccess
Defined Under Namespace
Modules: DeniedAccessRescue
Constant Summary collapse
- HOST =
"api.flucti.com".freeze
Constants included from Utilities
Constants included from Utilities::Miscellaneous
Utilities::Miscellaneous::BOGUS_ERROR_MESSAGES
Instance Method Summary collapse
Methods included from Utilities::Miscellaneous
#clean_name, #command, #error!, #sh, #try_save
Methods included from Utilities::TaskPacking
Methods included from Utilities::UserInterface
#confirm, #puts_list, #puts_long, #puts_subtitle, #puts_title, #qcommand, #quote, #terminal_width
Instance Method Details
#configure! ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/flucti/api_access.rb', line 16 def configure! if (init = Parameters.store_dir / "init.rb").file? load(init) end Resources::BasicResource.site = site Resources::BasicResource.extend DeniedAccessRescue end |
#site ⇒ Object
8 9 10 |
# File 'lib/flucti/api_access.rb', line 8 def site site_with_api_key(Parameters.fetch(:api_key) || (api_key_tasks.switch; Parameters.fetch(:api_key))) end |
#site_with_api_key(key) ⇒ Object
12 13 14 |
# File 'lib/flucti/api_access.rb', line 12 def site_with_api_key(key) WebService::Site.new("http://#{key}@#{HOST}") end |
#solve_denied_access! ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/flucti/api_access.rb', line 24 def solve_denied_access! puts_title "Access denied" puts_long <<-MSG You API key seems invalid. If you reset it recently, please enter the new one at the prompt below. Otherwise, please contact us at #{SUPPORT_EMAIL_ADDR} so that we can sort it out. MSG api_key_tasks.prompt_and_store_key configure! end |