Class: DTK::Network::Client::Command::Info

Inherits:
DTK::Network::Client::Command show all
Defined in:
lib/client/command/info.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DTK::Network::Client::Command

wrap_command

Methods included from RestWrapper

#rest_delete, #rest_get, #rest_post

Methods included from Client::PermissionsUtil

#validate_permissions!

Methods included from Util::Tar

#gzip, #tar, #ungzip, #untar

Constructor Details

#initialize(module_ref, options = {}) ⇒ Info

Returns a new instance of Info.



4
5
6
7
# File 'lib/client/command/info.rb', line 4

def initialize(module_ref, options = {})
  @module_ref = module_ref
  @about      = options[:about] || :versions
end

Class Method Details

.run(module_info, opts = {}) ⇒ Object



9
10
11
12
# File 'lib/client/command/info.rb', line 9

def self.run(module_info, opts = {})
  module_ref      = ModuleRef.new(module_info)
  new(module_ref, opts).info
end

Instance Method Details

#infoObject



14
15
16
17
18
19
20
21
# File 'lib/client/command/info.rb', line 14

def info
  case @about.to_sym
  when :versions
    versions
  else
    module_info
  end
end

#module_infoObject



28
29
# File 'lib/client/command/info.rb', line 28

def module_info
end

#versionsObject



23
24
25
26
# File 'lib/client/command/info.rb', line 23

def versions
  modules_info = rest_get('modules/get_versions', { name: @module_ref.name, namespace: @module_ref.namespace })
  modules_info['versions'] || []
end