Module: Teamlab::MailAccounts
- Included in:
- Defined in:
- lib/teamlab/modules/mail/mail_accounts.rb
Overview
Methods for working with mail accounts
Instance Method Summary collapse
- #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
- #delete_account(email) ⇒ Object
- #get_account_by_email(email) ⇒ Object
- #get_account_list ⇒ Object
- #get_default_account_settings(email, options = {}) ⇒ Object
- #set_account_state(email, state) ⇒ Object
- #set_account_state_by_mailbox(mailbox_id, email_in_folder) ⇒ Object
-
#set_default_account(email, is_default) ⇒ Object
Sets the default account specified in the request.
- #update_account(name, email, password, options = {}) ⇒ Object
Instance Method Details
#create_account_by_email(email, password) ⇒ Object
26 27 28 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 26 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
18 19 20 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 18 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
22 23 24 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 22 def create_oauth_account(email, token, = {}) @request.post(%w[accounts oauth], { email: email, token: token }.merge()) end |
#delete_account(email) ⇒ Object
49 50 51 52 53 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 49 def delete_account(email) @request.delete(['accounts', email.to_s]) rescue StandardError @request.delete(['accounts'], email: email.to_s) # for version 8.7 end |
#get_account_by_email(email) ⇒ Object
10 11 12 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 10 def get_account_by_email(email) @request.get(['accounts', email.to_s]) end |
#get_account_list ⇒ Object
6 7 8 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 6 def get_account_list @request.get(%w[accounts]) end |
#get_default_account_settings(email, options = {}) ⇒ Object
14 15 16 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 14 def get_default_account_settings(email, = {}) @request.get(['accounts', email.to_s, 'default'], ) end |
#set_account_state(email, state) ⇒ Object
34 35 36 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 34 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
38 39 40 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 38 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_default_account(email, is_default) ⇒ Object
Sets the default account specified in the request
45 46 47 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 45 def set_default_account(email, is_default) @request.put(%w[accounts default], email: email, isDefault: is_default) end |
#update_account(name, email, password, options = {}) ⇒ Object
30 31 32 |
# File 'lib/teamlab/modules/mail/mail_accounts.rb', line 30 def update_account(name, email, password, = {}) @request.put(%w[accounts], { name: name, email: email, password: password }.merge()) end |