Class: Moonbase::Resources::InboxMessages::Attachments
- Inherits:
-
Object
- Object
- Moonbase::Resources::InboxMessages::Attachments
- Defined in:
- lib/moonbase/resources/inbox_messages/attachments.rb
Overview
Manage your inboxes, conversations, and messages
Instance Method Summary collapse
-
#create(inbox_message_id, file: nil, file_id: nil, request_options: {}) ⇒ Moonbase::Models::MessageAttachment
Add an attachment to a draft message.
-
#delete(id, inbox_message_id:, request_options: {}) ⇒ nil
Removes an attachment from a draft message.
-
#initialize(client:) ⇒ Attachments
constructor
private
A new instance of Attachments.
Constructor Details
#initialize(client:) ⇒ Attachments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Attachments.
66 67 68 |
# File 'lib/moonbase/resources/inbox_messages/attachments.rb', line 66 def initialize(client:) @client = client end |
Instance Method Details
#create(inbox_message_id, file: nil, file_id: nil, request_options: {}) ⇒ Moonbase::Models::MessageAttachment
Add an attachment to a draft message. You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/moonbase/resources/inbox_messages/attachments.rb', line 24 def create(, params = {}) parsed, = Moonbase::InboxMessages::AttachmentCreateParams.dump_request(params) @client.request( method: :post, path: ["inbox_messages/%1$s/attachments", ], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: Moonbase::MessageAttachment, options: ) end |
#delete(id, inbox_message_id:, request_options: {}) ⇒ nil
Removes an attachment from a draft message.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/moonbase/resources/inbox_messages/attachments.rb', line 49 def delete(id, params) parsed, = Moonbase::InboxMessages::AttachmentDeleteParams.dump_request(params) = parsed.delete(:inbox_message_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["inbox_messages/%1$s/attachments/%2$s", , id], model: NilClass, options: ) end |