Class: Dscli::Commands

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/dscli/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/dscli/commands.rb', line 8

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#compile(csdl) ⇒ Object



33
34
35
36
37
# File 'lib/dscli/commands.rb', line 33

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

#configObject

option :push, type: :boolean, desc: ‘Enter details of a new Push Destination’



16
17
18
19
20
21
22
23
24
25
# File 'lib/dscli/commands.rb', line 16

def config

  #if options[:user]
    open(ENV['HOME'] + '/.datasiftcli', 'w') do |f|
      f.write Dscli::Parameters.new.user_config(options).to_yaml
    end
  #end

  #TODO Add other config options such as new push destinations
end

#dpu(hash) ⇒ Object



46
47
48
49
# File 'lib/dscli/commands.rb', line 46

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

#stream(hash) ⇒ Object



52
53
54
55
# File 'lib/dscli/commands.rb', line 52

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

#usage(period = 'day') ⇒ Object



40
41
42
43
# File 'lib/dscli/commands.rb', line 40

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