Class: Tessa::Upload::UploadsFile
- Inherits:
-
Object
- Object
- Tessa::Upload::UploadsFile
- Defined in:
- lib/tessa/upload/uploads_file.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#upload ⇒ Object
readonly
Returns the value of attribute upload.
Class Method Summary collapse
Instance Method Summary collapse
- #call(file) ⇒ Object
-
#initialize(upload:, connection: self.class.connection_factory) ⇒ UploadsFile
constructor
A new instance of UploadsFile.
Constructor Details
#initialize(upload:, connection: self.class.connection_factory) ⇒ UploadsFile
Returns a new instance of UploadsFile.
4 5 6 7 |
# File 'lib/tessa/upload/uploads_file.rb', line 4 def initialize(upload:, connection: self.class.connection_factory) @upload = upload @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
2 3 4 |
# File 'lib/tessa/upload/uploads_file.rb', line 2 def connection @connection end |
#upload ⇒ Object (readonly)
Returns the value of attribute upload.
2 3 4 |
# File 'lib/tessa/upload/uploads_file.rb', line 2 def upload @upload end |
Class Method Details
.connection_factory ⇒ Object
15 16 17 |
# File 'lib/tessa/upload/uploads_file.rb', line 15 def self.connection_factory Tessa::FakeConnection.new end |
Instance Method Details
#call(file) ⇒ Object
9 10 11 12 13 |
# File 'lib/tessa/upload/uploads_file.rb', line 9 def call(file) connection .public_send(upload.upload_method, upload.upload_url, File.read(file)) .success? end |