Class: Aucast::FileUpload
- Inherits:
-
Object
- Object
- Aucast::FileUpload
- Defined in:
- lib/aucast/file_upload.rb
Overview
Upload a file to Aucast webservice
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(file_path) ⇒ FileUpload
constructor
A new instance of FileUpload.
- #upload(endpoint) ⇒ Object
Constructor Details
#initialize(file_path) ⇒ FileUpload
Returns a new instance of FileUpload.
6 7 8 |
# File 'lib/aucast/file_upload.rb', line 6 def initialize(file_path) @file_path = file_path end |
Instance Method Details
#filename ⇒ Object
10 11 12 |
# File 'lib/aucast/file_upload.rb', line 10 def filename @file_path.split("/").last end |
#upload(endpoint) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aucast/file_upload.rb', line 14 def upload(endpoint) ret = endpoint.upload(@file_path) if ret true elsif ret.is_a? Hash and ret[:error] ret[:error] elsif ret.is_a? String ret else nil end end |