Module: Teamlab::MailTags

Included in:
Mail
Defined in:
lib/teamlab/modules/mail/mail_tags.rb

Overview

Methods for working with mail tags

Instance Method Summary collapse

Instance Method Details

#create_tag(name, options = {}) ⇒ Object



10
11
12
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 10

def create_tag(name, options = {})
  @request.post(%w[tags], { name: name }.merge(options))
end

#delete_tag(id) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 26

def delete_tag(id)
  @request.delete(['tags', id.to_s])
end

#get_tag_listObject



6
7
8
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 6

def get_tag_list
  @request.get(%w[tags])
end

#remove_tag_from_messages(id, *message_ids) ⇒ Object



22
23
24
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 22

def remove_tag_from_messages(id, *message_ids)
  @request.put(['tags', id.to_s, 'remove'], messages: message_ids.flatten)
end

#set_tag_to_messages(id, *message_ids) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 18

def set_tag_to_messages(id, *message_ids)
  @request.put(['tags', id.to_s, 'set'], messages: message_ids.flatten)
end

#update_tag(id, name, options = {}) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/mail/mail_tags.rb', line 14

def update_tag(id, name, options = {})
  @request.put(['tags', id.to_s], { name: name }.merge(options))
end