Class: Cipherpipe::ExternalSource

Inherits:
Object
  • Object
show all
Defined in:
lib/cipherpipe/external_source.rb

Constant Summary collapse

UnknownProviderError =
Class.new Cipherpipe::Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ExternalSource

Returns a new instance of ExternalSource.



6
7
8
9
10
11
12
# 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

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



4
5
6
# File 'lib/cipherpipe/external_source.rb', line 4

def destination
  @destination
end

#ec2_roleObject (readonly)

Returns the value of attribute ec2_role.



4
5
6
# File 'lib/cipherpipe/external_source.rb', line 4

def ec2_role
  @ec2_role
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/cipherpipe/external_source.rb', line 4

def options
  @options
end

#primaryObject (readonly)

Returns the value of attribute primary.



4
5
6
# File 'lib/cipherpipe/external_source.rb', line 4

def primary
  @primary
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/cipherpipe/external_source.rb', line 4

def type
  @type
end

Instance Method Details

#downloadObject



14
15
16
17
18
19
20
# 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?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cipherpipe/external_source.rb', line 22

def primary?
  primary
end

#upload(variables) ⇒ Object



26
27
28
29
30
31
32
# 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