Class: MojFileUploaderApiClient::AddFile
- Inherits:
-
HttpClient
- Object
- HttpClient
- MojFileUploaderApiClient::AddFile
- Defined in:
- lib/mojfile_uploader_api_client/add_file.rb
Constant Summary
Constants inherited from HttpClient
Instance Attribute Summary collapse
-
#collection_ref ⇒ Object
Returns the value of attribute collection_ref.
-
#data ⇒ Object
Returns the value of attribute data.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#folder ⇒ Object
Returns the value of attribute folder.
Attributes inherited from HttpClient
Instance Method Summary collapse
- #endpoint ⇒ Object
-
#initialize(collection_ref: nil, folder: nil, filename:, data:) ⇒ AddFile
constructor
A new instance of AddFile.
- #payload ⇒ Object
- #verb ⇒ Object
Methods inherited from HttpClient
#call, configure, #options, #payload?
Constructor Details
#initialize(collection_ref: nil, folder: nil, filename:, data:) ⇒ AddFile
Returns a new instance of AddFile.
5 6 7 8 9 10 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 5 def initialize(collection_ref: nil, folder: nil, filename:, data:) self.collection_ref = collection_ref self.folder = folder self.filename = filename self.data = data end |
Instance Attribute Details
#collection_ref ⇒ Object
Returns the value of attribute collection_ref.
3 4 5 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 3 def collection_ref @collection_ref end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 3 def data @data end |
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 3 def filename @filename end |
#folder ⇒ Object
Returns the value of attribute folder.
3 4 5 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 3 def folder @folder end |
Instance Method Details
#endpoint ⇒ Object
22 23 24 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 22 def endpoint File.join(collection_ref.to_s, 'new') end |
#payload ⇒ Object
16 17 18 19 20 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 16 def payload payload = {file_filename: filename, file_data: data} payload[:folder] = folder if folder payload end |
#verb ⇒ Object
12 13 14 |
# File 'lib/mojfile_uploader_api_client/add_file.rb', line 12 def verb :post end |