class Mconnect::CLI

Public Instance Methods

auth() click to toggle source
# File lib/mconnect.rb, line 30
def auth
  authorizer = Mconnect::Authorizer.new

  say 'Copy and paste the following URL in your browser:'
  say "\t#{authorizer.authorize_url}"

  authorizer.verifier = ask('When you sign in, copy and paste the oauth verifier here:').to_s

  create_file "#{Dir.home}/.mconnect/authorization.yml" do
    authorizer.authorization.to_yaml
  end
end
config(options = {}) click to toggle source
# File lib/mconnect.rb, line 18
def config options = {}
  say "Let's setup a configuration file.."

  options['consumer_key']    = ask('What is the consumer key?').to_s
  options['consumer_secret'] = ask('What is the consumer secret?').to_s

  create_file "#{Dir.home}/.mconnect/config.yml" do
    options.to_yaml
  end
end
get() click to toggle source
# File lib/mconnect.rb, line 46
def get
  directory  = options[:o].to_s
  endpoint   = options[:e].to_s
  authorizer = Mconnect::Authorizer.new
  worker     = Mconnect::Worker.new authorizer.access_token, endpoint
  generator  = Mconnect::Generator.new(worker.content, directory, endpoint)

  generator.save_csv
end