Class: Fclay::RemoteStorage::Base

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

Direct Known Subclasses

S3, SSH

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, uploading_object) ⇒ Base

Returns a new instance of Base.



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

def initialize(name, uploading_object)
  @name = name
  @uploading_object = uploading_object
  @storage = get_storage_by_name(name)
  @options = @uploading_object.class.fclay_options
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#storageObject

Returns the value of attribute storage.



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

def storage
  @storage
end

#uploading_objectObject

Returns the value of attribute uploading_object.



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

def uploading_object
  @uploading_object
end

Class Method Details

.url(name = nil) ⇒ Object



21
22
# File 'lib/fclay/remote_storage/base.rb', line 21

def self.url(name = nil)
end

Instance Method Details

#delete_filesObject



18
19
# File 'lib/fclay/remote_storage/base.rb', line 18

def delete_files
end

#get_storage_by_name(name) ⇒ Object



24
25
26
# File 'lib/fclay/remote_storage/base.rb', line 24

def get_storage_by_name(name)
  Fclay.configuration.remote_storages[name]
end

#upload(options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/fclay/remote_storage/base.rb', line 12

def upload(options = {})
  uploading_object.update(file_status: 'idle', file_location: 'remote')
  uploading_object.try(:log, "Sucessful uploaded! file_status: 'idle', file_location: #{name}")
  uploading_object.try(:uploaded)
end