Module: Teamlab::MailMessages
- Included in:
- Defined in:
- lib/teamlab/modules/mail/mail_messages.rb
Overview
Methods for working with mail messages
Instance Method Summary collapse
- #attach_teamlab_document(message_id, file_id, options = {}) ⇒ Object
- #delete_attachment_from_message(message_id, attachment_id) ⇒ Object
- #export_all_message_attachments_to_my_docs(message_id) ⇒ Object
- #export_attachments_to_my_docs(attachment_id) ⇒ Object
- #export_mail_to_crm_relations_history(message_id, *crm_contact_ids) ⇒ Object
- #get_filtered_messages(page, options = {}) ⇒ Object
- #get_message(id, options = {}) ⇒ Object
- #get_message_modify_date ⇒ Object
- #get_message_template ⇒ Object
- #get_previous_or_next_message_id(id, direction, options = {}) ⇒ Object
- #move_messages_to_folder(folder_id, *message_ids) ⇒ Object
- #remove_messages(*ids) ⇒ Object
- #restore_message_to_folders ⇒ Object
- #save_message(id, options = {}) ⇒ Object
- #send_message(id, options = {}) ⇒ Object
- #set_message_crm_status(emails, *user_ids) ⇒ Object
- #set_message_status(status, *ids) ⇒ Object
Instance Method Details
#attach_teamlab_document(message_id, file_id, options = {}) ⇒ Object
30 31 32 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 30 def attach_teamlab_document(, file_id, = {}) @request.post(['messages', .to_s, 'document'], { fileId: file_id }.merge()) end |
#delete_attachment_from_message(message_id, attachment_id) ⇒ Object
70 71 72 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 70 def (, ) @request.delete(['messages', .to_s, 'attachments', .to_s]) end |
#export_all_message_attachments_to_my_docs(message_id) ⇒ Object
66 67 68 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 66 def () @request.put(%w[attachments mydocuments export], messageId: ) end |
#export_attachments_to_my_docs(attachment_id) ⇒ Object
62 63 64 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 62 def () @request.put(%w[attachment mydocuments export], attachmentId: ) end |
#export_mail_to_crm_relations_history(message_id, *crm_contact_ids) ⇒ Object
58 59 60 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 58 def export_mail_to_crm_relations_history(, *crm_contact_ids) @request.put(%w[messages crm export], messageId: , crmContactIds: crm_contact_ids.flatten) end |
#get_filtered_messages(page, options = {}) ⇒ Object
6 7 8 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 6 def (page, = {}) @request.get(%w[messages], { page: page }.merge()) end |
#get_message(id, options = {}) ⇒ Object
10 11 12 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 10 def (id, = {}) @request.get(['messages', id.to_s], ) end |
#get_message_modify_date ⇒ Object
18 19 20 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 18 def @request.get(%w[messages modify_date]) end |
#get_message_template ⇒ Object
14 15 16 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 14 def @request.get(%w[messages template]) end |
#get_previous_or_next_message_id(id, direction, options = {}) ⇒ Object
22 23 24 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 22 def (id, direction, = {}) @request.get(['messages', id.to_s, direction.to_s], ) end |
#move_messages_to_folder(folder_id, *message_ids) ⇒ Object
38 39 40 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 38 def (folder_id, *) @request.put(%w[,essages move], folderId: folder_id, ids: .flatten) end |
#remove_messages(*ids) ⇒ Object
50 51 52 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 50 def (*ids) @request.put(%w[messages remove], ids: ids.flatten) end |
#restore_message_to_folders ⇒ Object
54 55 56 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 54 def @request.put(%w[messages restore]) end |
#save_message(id, options = {}) ⇒ Object
46 47 48 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 46 def (id, = {}) @request.put(%w[messages save], { id: id }.merge()) end |
#send_message(id, options = {}) ⇒ Object
42 43 44 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 42 def (id, = {}) @request.put(%w[messages send], { id: id }.merge()) end |
#set_message_crm_status(emails, *user_ids) ⇒ Object
26 27 28 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 26 def (emails, *user_ids) @request.post(%w[messages update_crm], emails: emails, userIds: user_ids.flatten) end |
#set_message_status(status, *ids) ⇒ Object
34 35 36 |
# File 'lib/teamlab/modules/mail/mail_messages.rb', line 34 def (status, *ids) @request.put(%w[messages mark], status: status, ids: ids.flatten) end |