Class: Fclay::RemoteStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/fclay/remote_storage.rb

Defined Under Namespace

Classes: Base, Provider, S3, SSH

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, data) ⇒ RemoteStorage

Returns a new instance of RemoteStorage.



6
7
8
9
# File 'lib/fclay/remote_storage.rb', line 6

def initialize name,data
  @name = name.to_s
  @data = data
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/fclay/remote_storage.rb', line 4

def name
  @name
end

Instance Method Details

#bucket_nameObject



22
23
24
25
# File 'lib/fclay/remote_storage.rb', line 22

def bucket_name
  return "" unless s3?
  @data[:bucket]
end

#bucket_objectObject



16
17
18
19
20
# File 'lib/fclay/remote_storage.rb', line 16

def bucket_object
  return nil if !@data || !s3? 
  s3 = Aws::S3::Resource.new
  s3.bucket(bucket_name)
end

#hostObject



27
28
29
# File 'lib/fclay/remote_storage.rb', line 27

def host 
  @data.try(:[],:host)
end

#s3?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/fclay/remote_storage.rb', line 11

def s3?
  return false unless @data
  @data[:kind] == "s3"
end