Class: Holistics::Sources

Inherits:
SubcommandBase show all
Defined in:
lib/holistics/sources.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubcommandBase

banner, subcommand_prefix

Constructor Details

#initialize(*args) ⇒ Sources

Returns a new instance of Sources.


3
4
5
6
# File 'lib/holistics/sources.rb', line 3

def initialize(*args)
  super
  @this = Model::Resource.new(Holistics.client, 'data_sources')
end

Class Method Details

.help(*args) ⇒ Object


7
8
9
10
11
12
13
14
# File 'lib/holistics/sources.rb', line 7

def self.help(*args)
  super
  puts <<-INSTRUCTION
Examples:
  holistics sources list # List all data sources

  INSTRUCTION
end

Instance Method Details

#info(id) ⇒ Object


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/holistics/sources.rb', line 23

def info(id)
  puts "`sources info #{id}` called with options: #{options}" if Holistics.debug?
  item = @this.find(id)
  puts "Source ID: " + item['id'].to_s.yellow
  {
    name: item['name'],
    dbtype: item['dbtype'],
    slug: item['slug'],
    settings: item['settings']
  }.each { |k, v| puts "\t" + [k,v].join(": ") }
end

#listObject


17
18
19
20
# File 'lib/holistics/sources.rb', line 17

def list
  puts "`sources list` called with options: #{options}" if Holistics.debug?
  tp(@this.all)
end