Class: Okapi::CLI
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- Okapi::CLI
- Defined in:
- lib/okapi/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.run(*args, &block) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/okapi/cli.rb', line 133 def self.run(*args, &block) super(*args, &block) rescue Okapi::ConfigurationError => e e. rescue Okapi::RequestError => e e. end |
Instance Method Details
#client ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/okapi/cli.rb', line 103 def client variables.load! anonymous = Okapi::Client.new(url, tenant, token) if no_tenant? anonymous elsif no_user? anonymous.tenant else anonymous.user end end |
#console ⇒ Object
129 130 131 |
# File 'lib/okapi/cli.rb', line 129 def console HighLine.new end |
#execute ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/okapi/cli.rb', line 116 def execute result = model if result.is_a?(String) result else JSON.pretty_generate result end end |
#variables ⇒ Object
125 126 127 |
# File 'lib/okapi/cli.rb', line 125 def variables @variables ||= PersistentVariables.new(config) end |