Module: Gmail::Base::Modify

Included in:
Message, Thread
Defined in:
lib/gmail/base/modify.rb

Instance Method Summary collapse

Instance Method Details

#archiveObject



16
17
18
# File 'lib/gmail/base/modify.rb', line 16

def archive
  modify([], ["INBOX"])
end

#archive!Object



20
21
22
# File 'lib/gmail/base/modify.rb', line 20

def archive!
  modify!([], ["INBOX"])
end

#mark_as_readObject



48
49
50
# File 'lib/gmail/base/modify.rb', line 48

def mark_as_read
  modify([],["UNREAD"] )
end

#mark_as_read!Object



52
53
54
# File 'lib/gmail/base/modify.rb', line 52

def mark_as_read!
  modify!([],["UNREAD"] )
end

#mark_as_unreadObject



56
57
58
# File 'lib/gmail/base/modify.rb', line 56

def mark_as_unread
  modify(["UNREAD"],[] )
end

#mark_as_unread!Object



60
61
62
# File 'lib/gmail/base/modify.rb', line 60

def mark_as_unread!
  modify!(["UNREAD"],[] )
end

#modify(addLabelIds = [], removeLabelIds = []) ⇒ Object



11
12
13
14
# File 'lib/gmail/base/modify.rb', line 11

def modify(addLabelIds=[], removeLabelIds=[])
  response = Gmail.request(self.class.base_method.send("modify"),{id: id}, {addLabelIds: addLabelIds, removeLabelIds: removeLabelIds})
  d = Util.convert_to_gmail_object(response, self.class.class_name.downcase)
end

#modify!(addLabelIds = [], removeLabelIds = []) ⇒ Object



4
5
6
7
8
9
# File 'lib/gmail/base/modify.rb', line 4

def modify!(addLabelIds=[], removeLabelIds=[])
  response = Gmail.request(self.class.base_method.send("modify"),{id: id}, {addLabelIds: addLabelIds, removeLabelIds: removeLabelIds})
  d = Util.convert_to_gmail_object(response, self.class.class_name.downcase)
  @values = d.values
  self
end

#starObject



32
33
34
# File 'lib/gmail/base/modify.rb', line 32

def star
  modify(["STARRED"], [] )
end

#star!Object



36
37
38
# File 'lib/gmail/base/modify.rb', line 36

def star!
  modify!(["STARRED"], [] )
end

#unarchiveObject



24
25
26
# File 'lib/gmail/base/modify.rb', line 24

def unarchive
  modify(["INBOX"], [] )
end

#unarchive!Object



28
29
30
# File 'lib/gmail/base/modify.rb', line 28

def unarchive!
  modify!(["INBOX"], [] )
end

#unstarObject



40
41
42
# File 'lib/gmail/base/modify.rb', line 40

def unstar
  modify([],["STARRED"] )
end

#unstar!Object



44
45
46
# File 'lib/gmail/base/modify.rb', line 44

def unstar!
  modify!([],["STARRED"] )
end