Class: Teamlab::Mail
- Inherits:
-
Object
- Object
- Teamlab::Mail
- Defined in:
- lib/teamlab/modules/mail.rb
Instance Method Summary collapse
- #add_tag_to_conversations(tag_id, *conversation_ids) ⇒ Object
- #add_trusted_address(address) ⇒ Object
- #attach_teamlab_document(message_id, file_id, options = {}) ⇒ Object
- #create_account_by_email(email, password) ⇒ Object
- #create_account_with_custom_mail_service(name, email, account, password, options = {}) ⇒ Object
- #create_oauth_account(email, token, options = {}) ⇒ Object
- #create_tag(name, options = {}) ⇒ Object
- #delete_account(email) ⇒ Object
- #delete_alert_by_id(id) ⇒ Object
- #delete_attachment_from_message(message_id, attachment_id) ⇒ Object
- #delete_tag(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
-
#generate_custom_guid ⇒ Object
region GUID.
- #get_account_by_email(email) ⇒ Object
-
#get_account_list ⇒ Object
region Accounts.
-
#get_alerts_list ⇒ Object
region Alerts.
-
#get_contact_list_for_auto_complete(term) ⇒ Object
region Contacts.
- #get_crm_linked_entities(message_id) ⇒ Object
- #get_default_account_settings(email, options = {}) ⇒ Object
-
#get_filtered_conversations(options = {}) ⇒ Object
region Conversations.
-
#get_filtered_messages(page, options = {}) ⇒ Object
region Messages.
- #get_folder_change_date(folder_id) ⇒ Object
-
#get_folders(options = {}) ⇒ Object
region Folders.
-
#get_html_of_help_center ⇒ Object
region HelpCenter.
-
#get_meail_signature(mailbox_id) ⇒ Object
endregion.
- #get_message(id, options = {}) ⇒ Object
- #get_message_modify_date ⇒ Object
- #get_message_template ⇒ Object
- #get_messages_linked_into_one_chain(message_id, load_all_content) ⇒ Object
- #get_previous_or_next_conversation_id(id, direction, options = {}) ⇒ Object
- #get_previous_or_next_message_id(id, direction, options = {}) ⇒ Object
-
#get_tag_list ⇒ Object
region Tags.
-
#get_trusted_addresses ⇒ Object
region IMAGES.
-
#initialize ⇒ Mail
constructor
A new instance of Mail.
- #is_chain_crm_linked_by_message(message_id) ⇒ Object
- #mark_conversation_as_crm_linked(message_id, *crm_contact_ids) ⇒ Object
- #move_conversations_to_folder(folder_id, *message_ids) ⇒ Object
- #move_messages_to_folder(folder_id, *message_ids) ⇒ Object
- #remove_all_messages_from_folder(folder_id) ⇒ Object
- #remove_conversations(*ids) ⇒ Object
- #remove_from_trusted_addresses(address) ⇒ Object
- #remove_messages(*ids) ⇒ Object
- #remove_tag_from_conversations(tag_id, *conversation_ids) ⇒ Object
- #remove_tag_from_messages(id, *message_ids) ⇒ Object
- #restore_conversations_to_folders(*ids) ⇒ Object
- #restore_message_to_folders ⇒ Object
- #save_message(id, options = {}) ⇒ Object
- #send_message(id, options = {}) ⇒ Object
- #set_account_state(email, state) ⇒ Object
- #set_account_state_by_mailbox(mailbox_id, email_in_folder) ⇒ Object
- #set_conversations_status(status, *ids) ⇒ Object
- #set_message_crm_status(emails, *user_ids) ⇒ Object
- #set_message_status(status, *ids) ⇒ Object
- #set_tag_to_messages(id, *message_ids) ⇒ Object
- #unmark_conversation_link_with_crm(message_id, *crm_contact_ids) ⇒ Object
- #update_account(name, email, password, options = {}) ⇒ Object
- #update_signature(mailbox_id, html, options = {}) ⇒ Object
- #update_tag(id, name, options = {}) ⇒ Object
Constructor Details
Instance Method Details
#add_tag_to_conversations(tag_id, *conversation_ids) ⇒ Object
207 208 209 |
# File 'lib/teamlab/modules/mail.rb', line 207 def add_tag_to_conversations(tag_id, *conversation_ids) @request.put(['conversations', 'tag', tag_id.to_s, 'set'], messages: conversation_ids.flatten) end |
#add_trusted_address(address) ⇒ Object
247 248 249 |
# File 'lib/teamlab/modules/mail.rb', line 247 def add_trusted_address(address) @request.post(%w(display_messages addresses), addres: address) end |
#attach_teamlab_document(message_id, file_id, options = {}) ⇒ Object
33 34 35 |
# File 'lib/teamlab/modules/mail.rb', line 33 def attach_teamlab_document(, file_id, = {}) @request.post(['messages', .to_s, 'document'], { fileId: file_id }.merge()) end |
#create_account_by_email(email, password) ⇒ Object
117 118 119 |
# File 'lib/teamlab/modules/mail.rb', line 117 def create_account_by_email(email, password) @request.post(%w(accounts simple), email: email, password: password) end |
#create_account_with_custom_mail_service(name, email, account, password, options = {}) ⇒ Object
109 110 111 |
# File 'lib/teamlab/modules/mail.rb', line 109 def create_account_with_custom_mail_service(name, email, account, password, = {}) @request.post(%w(accounts), { name: name, email: email, account: account, password: password }.merge()) end |
#create_oauth_account(email, token, options = {}) ⇒ Object
113 114 115 |
# File 'lib/teamlab/modules/mail.rb', line 113 def create_oauth_account(email, token, = {}) @request.post(%w(accounts oauth), { email: email, token: token }.merge()) end |
#create_tag(name, options = {}) ⇒ Object
263 264 265 |
# File 'lib/teamlab/modules/mail.rb', line 263 def create_tag(name, = {}) @request.post(%w(tags), { name: name }.merge()) end |
#delete_account(email) ⇒ Object
133 134 135 136 137 |
# File 'lib/teamlab/modules/mail.rb', line 133 def delete_account(email) @request.delete(['accounts', email.to_s]) rescue @request.delete(['accounts'], email: email.to_s) # for version 8.7 end |
#delete_alert_by_id(id) ⇒ Object
147 148 149 |
# File 'lib/teamlab/modules/mail.rb', line 147 def delete_alert_by_id(id) @request.delete(['alert', id.to_s]) end |
#delete_attachment_from_message(message_id, attachment_id) ⇒ Object
73 74 75 |
# File 'lib/teamlab/modules/mail.rb', line 73 def (, ) @request.delete(['messages', .to_s, 'attachments', .to_s]) end |
#delete_tag(id) ⇒ Object
279 280 281 |
# File 'lib/teamlab/modules/mail.rb', line 279 def delete_tag(id) @request.delete(['tags', id.to_s]) end |
#export_all_message_attachments_to_my_docs(message_id) ⇒ Object
69 70 71 |
# File 'lib/teamlab/modules/mail.rb', line 69 def () @request.put(%w(attachments mydocuments export), messageId: ) end |
#export_attachments_to_my_docs(attachment_id) ⇒ Object
65 66 67 |
# File 'lib/teamlab/modules/mail.rb', line 65 def () @request.put(%w(attachment mydocuments export), attachmentId: ) end |
#export_mail_to_crm_relations_history(message_id, *crm_contact_ids) ⇒ Object
61 62 63 |
# File 'lib/teamlab/modules/mail.rb', line 61 def export_mail_to_crm_relations_history(, *crm_contact_ids) @request.put(%w(messages crm export), messageId: , crmContactIds: crm_contact_ids.flatten) end |
#generate_custom_guid ⇒ Object
region GUID
235 236 237 |
# File 'lib/teamlab/modules/mail.rb', line 235 def generate_custom_guid @request.get(%w(random_guid)) end |
#get_account_by_email(email) ⇒ Object
101 102 103 |
# File 'lib/teamlab/modules/mail.rb', line 101 def get_account_by_email(email) @request.get(['accounts', email.to_s]) end |
#get_account_list ⇒ Object
region Accounts
97 98 99 |
# File 'lib/teamlab/modules/mail.rb', line 97 def get_account_list @request.get(%w(accounts)) end |
#get_alerts_list ⇒ Object
region Alerts
143 144 145 |
# File 'lib/teamlab/modules/mail.rb', line 143 def get_alerts_list @request.get('alert') end |
#get_contact_list_for_auto_complete(term) ⇒ Object
region Contacts
155 156 157 |
# File 'lib/teamlab/modules/mail.rb', line 155 def get_contact_list_for_auto_complete(term) @request.get(%w(contacts), term: term) end |
#get_crm_linked_entities(message_id) ⇒ Object
159 160 161 |
# File 'lib/teamlab/modules/mail.rb', line 159 def get_crm_linked_entities() @request.get(%w(crm linked entities), messageId: ) end |
#get_default_account_settings(email, options = {}) ⇒ Object
105 106 107 |
# File 'lib/teamlab/modules/mail.rb', line 105 def get_default_account_settings(email, = {}) @request.get(['accounts', email.to_s, 'default'], ) end |
#get_filtered_conversations(options = {}) ⇒ Object
region Conversations
167 168 169 |
# File 'lib/teamlab/modules/mail.rb', line 167 def get_filtered_conversations( = {}) @request.get(%w(conversations), ) end |
#get_filtered_messages(page, options = {}) ⇒ Object
region Messages
9 10 11 |
# File 'lib/teamlab/modules/mail.rb', line 9 def (page, = {}) @request.get(%w(messages), { page: page }.merge()) end |
#get_folder_change_date(folder_id) ⇒ Object
223 224 225 |
# File 'lib/teamlab/modules/mail.rb', line 223 def get_folder_change_date(folder_id) @request.get(['folders', folder_id.to_s, 'modify_date']) end |
#get_folders(options = {}) ⇒ Object
region Folders
219 220 221 |
# File 'lib/teamlab/modules/mail.rb', line 219 def get_folders( = {}) @request.get(%w(folders), ) end |
#get_html_of_help_center ⇒ Object
region HelpCenter
81 82 83 |
# File 'lib/teamlab/modules/mail.rb', line 81 def get_html_of_help_center @request.get(%w(helpcenter)) end |
#get_meail_signature(mailbox_id) ⇒ Object
endregion
87 88 89 |
# File 'lib/teamlab/modules/mail.rb', line 87 def get_meail_signature(mailbox_id) @request.get(['signature', mailbox_id.to_s]) end |
#get_message(id, options = {}) ⇒ Object
13 14 15 |
# File 'lib/teamlab/modules/mail.rb', line 13 def (id, = {}) @request.get(['messages', id.to_s], ) end |
#get_message_modify_date ⇒ Object
21 22 23 |
# File 'lib/teamlab/modules/mail.rb', line 21 def @request.get(%w(messages modify_date)) end |
#get_message_template ⇒ Object
17 18 19 |
# File 'lib/teamlab/modules/mail.rb', line 17 def @request.get(%w(messages template)) end |
#get_messages_linked_into_one_chain(message_id, load_all_content) ⇒ Object
171 172 173 |
# File 'lib/teamlab/modules/mail.rb', line 171 def (, load_all_content) @request.get(['conversation', .to_s], loadAllContent: load_all_content) end |
#get_previous_or_next_conversation_id(id, direction, options = {}) ⇒ Object
175 176 177 |
# File 'lib/teamlab/modules/mail.rb', line 175 def get_previous_or_next_conversation_id(id, direction, = {}) @request.get(['conversation', id.to_s, direction.to_s], ) end |
#get_previous_or_next_message_id(id, direction, options = {}) ⇒ Object
25 26 27 |
# File 'lib/teamlab/modules/mail.rb', line 25 def (id, direction, = {}) @request.get(['messages', id.to_s, direction.to_s], ) end |
#get_tag_list ⇒ Object
region Tags
259 260 261 |
# File 'lib/teamlab/modules/mail.rb', line 259 def get_tag_list @request.get(%w(tags)) end |
#get_trusted_addresses ⇒ Object
region IMAGES
243 244 245 |
# File 'lib/teamlab/modules/mail.rb', line 243 def get_trusted_addresses @request.get(%w(display_messages addresses)) end |
#is_chain_crm_linked_by_message(message_id) ⇒ Object
179 180 181 |
# File 'lib/teamlab/modules/mail.rb', line 179 def () @request.get(%w(conversations link crm status), messageId: ) end |
#mark_conversation_as_crm_linked(message_id, *crm_contact_ids) ⇒ Object
199 200 201 |
# File 'lib/teamlab/modules/mail.rb', line 199 def mark_conversation_as_crm_linked(, *crm_contact_ids) @request.put(%w(conversations crm mark), messageId: , crmContactIds: crm_contact_ids.flatten) end |
#move_conversations_to_folder(folder_id, *message_ids) ⇒ Object
183 184 185 |
# File 'lib/teamlab/modules/mail.rb', line 183 def move_conversations_to_folder(folder_id, *) @request.put(%w(conversations move), folderId: folder_id, ids: .flatten) end |
#move_messages_to_folder(folder_id, *message_ids) ⇒ Object
41 42 43 |
# File 'lib/teamlab/modules/mail.rb', line 41 def (folder_id, *) @request.put(%w(,essages move), folderId: folder_id, ids: .flatten) end |
#remove_all_messages_from_folder(folder_id) ⇒ Object
227 228 229 |
# File 'lib/teamlab/modules/mail.rb', line 227 def (folder_id) @request.get(['folders', folder_id.to_s, 'messages']) end |
#remove_conversations(*ids) ⇒ Object
191 192 193 |
# File 'lib/teamlab/modules/mail.rb', line 191 def remove_conversations(*ids) @request.put(%w(conversations remove), ids: ids.flatten) end |
#remove_from_trusted_addresses(address) ⇒ Object
251 252 253 |
# File 'lib/teamlab/modules/mail.rb', line 251 def remove_from_trusted_addresses(address) @request.delete(%w(display_messages addresses), addres: address) end |
#remove_messages(*ids) ⇒ Object
53 54 55 |
# File 'lib/teamlab/modules/mail.rb', line 53 def (*ids) @request.put(%w(messages remove), ids: ids.flatten) end |
#remove_tag_from_conversations(tag_id, *conversation_ids) ⇒ Object
211 212 213 |
# File 'lib/teamlab/modules/mail.rb', line 211 def remove_tag_from_conversations(tag_id, *conversation_ids) @request.put(['conversations', 'tag', tag_id.to_s, 'unset'], messages: conversation_ids.flatten) end |
#remove_tag_from_messages(id, *message_ids) ⇒ Object
275 276 277 |
# File 'lib/teamlab/modules/mail.rb', line 275 def (id, *) @request.put(['tags', id.to_s, 'remove'], messages: .flatten) end |
#restore_conversations_to_folders(*ids) ⇒ Object
195 196 197 |
# File 'lib/teamlab/modules/mail.rb', line 195 def restore_conversations_to_folders(*ids) @request.put(%w(conversations restore), ids: ids.flatten) end |
#restore_message_to_folders ⇒ Object
57 58 59 |
# File 'lib/teamlab/modules/mail.rb', line 57 def @request.put(%w(messages restore)) end |
#save_message(id, options = {}) ⇒ Object
49 50 51 |
# File 'lib/teamlab/modules/mail.rb', line 49 def (id, = {}) @request.put(%w(messages save), { id: id }.merge()) end |
#send_message(id, options = {}) ⇒ Object
45 46 47 |
# File 'lib/teamlab/modules/mail.rb', line 45 def (id, = {}) @request.put(%w(messages send), { id: id }.merge()) end |
#set_account_state(email, state) ⇒ Object
125 126 127 |
# File 'lib/teamlab/modules/mail.rb', line 125 def set_account_state(email, state) @request.put(['accounts', email.to_s, 'state'], state: state) end |
#set_account_state_by_mailbox(mailbox_id, email_in_folder) ⇒ Object
129 130 131 |
# File 'lib/teamlab/modules/mail.rb', line 129 def set_account_state_by_mailbox(mailbox_id, email_in_folder) @request.put(['accounts', mailbox_id.to_s, 'emailinfolder'], emailInFolder: email_in_folder) end |
#set_conversations_status(status, *ids) ⇒ Object
187 188 189 |
# File 'lib/teamlab/modules/mail.rb', line 187 def set_conversations_status(status, *ids) @request.put(%w(conversations mark), status: status, ids: ids.flatten) end |
#set_message_crm_status(emails, *user_ids) ⇒ Object
29 30 31 |
# File 'lib/teamlab/modules/mail.rb', line 29 def (emails, *user_ids) @request.post(%w(messages update_crm), emails: emails, userIds: user_ids.flatten) end |
#set_message_status(status, *ids) ⇒ Object
37 38 39 |
# File 'lib/teamlab/modules/mail.rb', line 37 def (status, *ids) @request.put(%w(messages mark), status: status, ids: ids.flatten) end |
#set_tag_to_messages(id, *message_ids) ⇒ Object
271 272 273 |
# File 'lib/teamlab/modules/mail.rb', line 271 def (id, *) @request.put(['tags', id.to_s, 'set'], messages: .flatten) end |
#unmark_conversation_link_with_crm(message_id, *crm_contact_ids) ⇒ Object
203 204 205 |
# File 'lib/teamlab/modules/mail.rb', line 203 def unmark_conversation_link_with_crm(, *crm_contact_ids) @request.put(%w(conversations crm unmark), messageId: , crmContactIds: crm_contact_ids.flatten) end |
#update_account(name, email, password, options = {}) ⇒ Object
121 122 123 |
# File 'lib/teamlab/modules/mail.rb', line 121 def update_account(name, email, password, = {}) @request.put(%w(accounts), { name: name, email: email, password: password }.merge()) end |
#update_signature(mailbox_id, html, options = {}) ⇒ Object
91 92 93 |
# File 'lib/teamlab/modules/mail.rb', line 91 def update_signature(mailbox_id, html, = {}) @request.post(['signature', 'update', mailbox_id.to_s], { html: html }.merge()) end |
#update_tag(id, name, options = {}) ⇒ Object
267 268 269 |
# File 'lib/teamlab/modules/mail.rb', line 267 def update_tag(id, name, = {}) @request.put(['tags', id.to_s], { name: name }.merge()) end |