Class: Upload
- Inherits:
-
Object
- Object
- Upload
- Defined in:
- lib/db_time_machine/upload.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#fog_connection ⇒ Object
Returns the value of attribute fog_connection.
-
#fog_directory ⇒ Object
Returns the value of attribute fog_directory.
Instance Method Summary collapse
-
#initialize(f) ⇒ Upload
constructor
A new instance of Upload.
- #start ⇒ Object
Constructor Details
#initialize(f) ⇒ Upload
Returns a new instance of Upload.
5 6 7 8 9 |
# File 'lib/db_time_machine/upload.rb', line 5 def initialize(f) self.fog_connection = DbTimeMachine.configuration.fog_connection self.fog_directory = self.fog_connection.directories.get(DbTimeMachine.configuration.fog_dir) self.file = f end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
3 4 5 |
# File 'lib/db_time_machine/upload.rb', line 3 def file @file end |
#fog_connection ⇒ Object
Returns the value of attribute fog_connection.
3 4 5 |
# File 'lib/db_time_machine/upload.rb', line 3 def fog_connection @fog_connection end |
#fog_directory ⇒ Object
Returns the value of attribute fog_directory.
3 4 5 |
# File 'lib/db_time_machine/upload.rb', line 3 def fog_directory @fog_directory end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/db_time_machine/upload.rb', line 11 def start puts "uploading data to fog directory" self.fog_directory.files.create( :key => file.split('/').last, :body => File.open(file), :public => false ) puts "upload complate" end |