Class: Mode::Sdk::Cli
- Inherits:
-
Object
- Object
- Mode::Sdk::Cli
- Defined in:
- lib/mode/sdk/cli.rb
Overview
Provides command line interface functionality for importing data
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
hash of options.
Class Method Summary collapse
-
.env_get(key, prompt = nil) ⇒ String
Get value from environment variable or stdin prompt.
Instance Method Summary collapse
-
#import! ⇒ Object
Authenticate and import data.
-
#initialize(options = {}) ⇒ Mode::Sdk::Cli
constructor
Construct a new Cli instance.
Constructor Details
#initialize(options = {}) ⇒ Mode::Sdk::Cli
Construct a new Cli instance
31 32 33 |
# File 'lib/mode/sdk/cli.rb', line 31 def initialize( = {}) = end |
Instance Attribute Details
#options ⇒ Hash (readonly)
hash of options
11 12 13 |
# File 'lib/mode/sdk/cli.rb', line 11 def end |
Class Method Details
.env_get(key, prompt = nil) ⇒ String
Get value from environment variable or stdin prompt
238 239 240 241 242 243 |
# File 'lib/mode/sdk/cli.rb', line 238 def env_get(key, prompt = nil) return ENV[key] if ENV[key] $stdout.print "#{prompt}: " if prompt $stdin.gets.chomp end |
Instance Method Details
#import! ⇒ Object
Authenticate and import data
37 38 39 40 41 42 43 44 |
# File 'lib/mode/sdk/cli.rb', line 37 def import! authenticate! import.poll do |repr| handle_import_state(repr) end end |