Class: KazeClient::UploadAttachmentRequest
- Inherits:
-
KazeClient::Utils::FinalRequest
- Object
- Request
- KazeClient::Utils::FinalRequest
- KazeClient::UploadAttachmentRequest
- Includes:
- KazeClient::Utils::AuthentifiedRequest
- Defined in:
- lib/kaze_client/request/requests/upload_attachment_request.rb
Overview
Upload an ActiveStorage::Attachment to a job document from a job.
Constant Summary
Constants inherited from Request
Instance Attribute Summary
Attributes included from KazeClient::Utils::AuthentifiedRequest
Attributes inherited from Request
#body, #headers, #method, #query, #url
Instance Method Summary collapse
-
#initialize(attachment) ⇒ UploadAttachmentRequest
constructor
A new instance of UploadAttachmentRequest.
- #send_attachment(direct_uploads) ⇒ Object
Methods included from KazeClient::Utils::AuthentifiedRequest
Methods inherited from Request
Constructor Details
#initialize(attachment) ⇒ UploadAttachmentRequest
Returns a new instance of UploadAttachmentRequest.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kaze_client/request/requests/upload_attachment_request.rb', line 20 def initialize() super(:post, 'api/direct_uploads') # @type [ActiveStorage::Attachment] @attachment = @body = { blob: { filename: @attachment.filename, byte_size: @attachment.byte_size, checksum: @attachment.checksum, content_type: @attachment.content_type } } end |
Instance Method Details
#send_attachment(direct_uploads) ⇒ Object
36 37 38 39 |
# File 'lib/kaze_client/request/requests/upload_attachment_request.rb', line 36 def (direct_uploads) header = direct_uploads['headers'] HTTParty.put(direct_uploads['url'], { body: @attachment.download, headers: header }) end |