Class: CLI

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

Instance Method Summary collapse

Instance Method Details

#balanceObject



41
42
43
44
# File 'lib/dscli/cli.rb', line 41

def balance
  api = Dscli::API.new
  puts api.balance
end

#compile(csdl) ⇒ Object



16
17
18
19
20
# File 'lib/dscli/cli.rb', line 16

def compile(csdl)
  api = Dscli::API.new
  definition = api.compile(csdl)
  puts definition
end

#configObject



7
8
9
10
11
12
13
# File 'lib/dscli/cli.rb', line 7

def config
	input = Dscli::Parameters.new.user_config(options)
	puts input.to_yaml
	open(ENV['HOME'] + '/.datasiftcli', 'w') do |f|
    f.write input.to_yaml
  end
end

#dpu(hash) ⇒ Object



29
30
31
32
# File 'lib/dscli/cli.rb', line 29

def dpu(hash)
  api = Dscli::API.new
  puts Yajl::Encoder.encode(api.dpu(hash), :pretty => true)
end

#stream(hash) ⇒ Object



35
36
37
38
# File 'lib/dscli/cli.rb', line 35

def stream(hash)
  api = Dscli::API.new
  api.stream(hash)
end

#usage(period = 'day') ⇒ Object



23
24
25
26
# File 'lib/dscli/cli.rb', line 23

def usage(period = 'day')
  api = Dscli::API.new
  puts Yajl::Encoder.encode(api.usage(period), :pretty => true)
end