Class: Gmail::Label
Class Method Summary
collapse
Instance Method Summary
collapse
#update, #update!
Methods included from Base::Get
included
#delete, included
included
Methods included from Base::List
included
Methods inherited from APIResource
base_method, class_name
Methods inherited from GmailObject
#[], #[]=, #as_json, #detailed, #initialize, #inspect, #refresh, #to_hash, #to_json, #to_s, #values
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Gmail::GmailObject
Class Method Details
.boxes ⇒ Object
17
18
19
|
# File 'lib/gmail/label.rb', line 17
def self.boxes
@boxes ||= [:inbox, :sent, :trash, :important, :starred, :draft, :spam, :unread, :category_updates, :category_promotions, :category_social, :category_personal, :category_forums ]
end
|
Instance Method Details
#messages(filters = {}) ⇒ Object
27
28
29
30
31
|
# File 'lib/gmail/label.rb', line 27
def messages filters={}
filters = {labelIds: [id]}.merge(filters)
filters[:labelIds] = filters[:labelIds] | [id]
Message.all(filters)
end
|
#save ⇒ Object
9
10
11
|
# File 'lib/gmail/label.rb', line 9
def save
update(to_hash)
end
|
#save! ⇒ Object
13
14
15
|
# File 'lib/gmail/label.rb', line 13
def save!
update!(to_hash)
end
|
#threads(filters = {}) ⇒ Object
41
42
43
44
45
|
# File 'lib/gmail/label.rb', line 41
def threads filters={}
filters = {labelIds: [id]}.merge(filters)
filters[:labelIds] = filters[:labelIds] | [id]
Thread.all(filters)
end
|
#unread_messages ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/gmail/label.rb', line 33
def unread_messages
if messagesUnread == 0
[]
else
Message.all({labelIds: [id, "UNREAD"]})
end
end
|
#unread_threads ⇒ Object
47
48
49
|
# File 'lib/gmail/label.rb', line 47
def unread_threads
Thread.all({labelIds: [id, "UNREAD"]})
end
|