Class: PI::Cli::Command::Misc
Instance Method Summary collapse
Methods inherited from Base
#auth_token, #client, #initialize, #target_url
Constructor Details
This class inherits a constructor from PI::Cli::Command::Base
Instance Method Details
#set_target(target_url) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cli/commands/misc.rb', line 8 def set_target(target_url) PI::Cli::Config.store_target(target_url) if target_url =~ /(https?:\/\/)?staging.samsungcloud.org/ if /^https?/ =~ target_url target_url = target_url.split("//", 2) target_url = target_url[1] end target_url = "http://api.#{target_url}" else target_url = "http://#{target_url}" unless /^https?/ =~ target_url end target_url = target_url.gsub(/\/+$/, '') client = PI::Client.new(target_url) end |