class Cipherpipe::ExternalSource

Constants

UnknownProviderError

Attributes

destination[R]
ec2_role[R]
options[R]
primary[R]
type[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/cipherpipe/external_source.rb, line 6
def initialize(options = {})
  @type        = options.delete "type"
  @destination = options.delete "destination"
  @primary     = options.delete "primary"
  @ec2_role    = options.delete "ec2_role"
  @options     = options
end

Public Instance Methods

download() click to toggle source
# File lib/cipherpipe/external_source.rb, line 14
def download
  if provider.available?
    provider.download self
  else
    puts "#{type} is not available, download is being skipped."
  end
end
primary?() click to toggle source
# File lib/cipherpipe/external_source.rb, line 22
def primary?
  primary
end
upload(variables) click to toggle source
# File lib/cipherpipe/external_source.rb, line 26
def upload(variables)
  if provider.available?
    provider.upload self, variables
  else
    puts "#{type} is not available, upload is being skipped."
  end
end

Private Instance Methods

provider() click to toggle source
# File lib/cipherpipe/external_source.rb, line 36
def provider
  @provider ||= case type
  when "vault"
    require_relative "vault"
    Cipherpipe::Vault
  when "1password"
    require_relative "one_password"
    Cipherpipe::OnePassword
  else
    raise UnknownProviderError, "unknown provider #{type}"
  end
end