class DTK::Client::Operation::Module

Constants

BaseRoute
MODULE_LOCK
OPERATIONS

Private Class Methods

handle_error(base_path, &block) click to toggle source
# File lib/client/operation/module.rb, line 84
def self.handle_error(base_path, &block)
  begin
    block.call
  rescue Error::ServerNotOkResponse => ex
    if response = ex.response
      unless response.ok?
        # If install fails, delete dtk.module.lock file
        FileUtils.rm_rf("#{base_path}/#{MODULE_LOCK}")
      end
    end

    raise ex
  end
end
module_ref_hash(module_ref, opts = {}) click to toggle source

opts can have keys:

:module_type

Can be used as input hash for QueryParams and PostBody

# File lib/client/operation/module.rb, line 75
def self.module_ref_hash(module_ref, opts = {})
  {
    :namespace    => module_ref.namespace,
    :module_name  => module_ref.module_name,
    :version?     => module_ref.version,
    :module_type? => opts[:module_type]
  }
end
module_ref_post_body(module_ref) click to toggle source
# File lib/client/operation/module.rb, line 64
def self.module_ref_post_body(module_ref)
  PostBody.new(module_ref_hash(module_ref))
end
module_ref_query_string_hash(module_ref) click to toggle source
# File lib/client/operation/module.rb, line 68
def self.module_ref_query_string_hash(module_ref)
  QueryStringHash.new(module_ref_hash(module_ref))
end
module_version_exists?(module_ref, opts = {}) click to toggle source
# File lib/client/operation/module.rb, line 53
def self.module_version_exists?(module_ref, opts = {})
  query_string_hash = module_ref_query_string_hash(module_ref)

  if ret_remote_info = opts[:remote_info]
    query_string_hash = query_string_hash.merge(:remote_info => ret_remote_info, :rsa_pub_key => opts[:rsa_pub_key])
  end

  response = rest_get(BaseRoute, query_string_hash)
  response.data.empty? ? nil : response
end

Private Instance Methods

module_version_exists?(module_ref, opts = {}) click to toggle source

opts can have keys

:remote_info - Boolean
:rsa_pub_key
# File lib/client/operation/module.rb, line 50
def module_version_exists?(module_ref, opts = {})
  self.class.module_version_exists?(module_ref, opts)
end