Class: FlexmlsApi::CLI::ConsoleCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/flexmls_api/cli.rb

Constant Summary collapse

OPTIONS_ENV =
{
  :endpoint          => "API_ENDPOINT",
  # OAUTH2 Options
  :access_uri  => "ACCESS_URI",
  :username=> "USERNAME",
  :password=> "PASSWORD",
  :client_id=> "CLIENT_ID",
  :client_secret=> "CLIENT_SECRET",
  # API AUTH Options
  :api_key => "API_KEY", 
  :api_secret => "API_SECRET",
  :api_user => "API_USER",
  # OTHER
  :debug=> "DEBUG",
  :console => "FLEXMLS_API_CONSOLE"  # not a public option, meant to distinguish bin/flexmls_api and script/console
}

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/flexmls_api/cli.rb', line 33

def self.execute(stdout, arguments=[])
  options = setup_options(stdout,arguments)
  libs =  " -r irb/completion"
  # Perhaps use a console_lib to store any extra methods I may want available in the cosole
  libs << (options[:oauth2] ? setup_oauth2 : setup_api_auth)
  
  bundler = (options[:console] ? "bundle exec" : "")  
  cmd = "#{export_env(options)} #{bundler} #{irb} #{libs} --simple-prompt"
  puts "Loading flexmls_api gem..."
  exec "#{cmd}"
end

.irbObject



45
46
47
# File 'lib/flexmls_api/cli.rb', line 45

def self.irb()
  RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
end