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(type, destination, primary = false, ec2_role = nil) ⇒ ExternalSource

Returns a new instance of ExternalSource.



6
7
8
9
10
11
# File 'lib/cipherpipe/external_source.rb', line 6

def initialize(type, destination, primary = false, ec2_role = nil)
  @type        = type
  @destination = destination
  @primary     = primary
  @ec2_role    = ec2_role
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

#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



13
14
15
16
17
18
19
# File 'lib/cipherpipe/external_source.rb', line 13

def download
  if provider.available?
    provider.download self
  else
    puts "#{type} is not available, download is being skipped."
  end
end

#primary?Boolean

Returns:

  • (Boolean)


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

def primary?
  primary
end

#upload(variables) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/cipherpipe/external_source.rb', line 25

def upload(variables)
  if provider.available?
    provider.upload self, variables
  else
    puts "#{type} is not available, upload is being skipped."
  end
end