Class: Nylas::Message
- Inherits:
-
Object
show all
- Includes:
- Model
- Defined in:
- lib/nylas/message.rb
Overview
Ruby representatin of a Nylas Message object
Constant Summary
collapse
- UPDATABLE_ATTRIBUTES =
%i[label_ids folder_id starred unread metadata].freeze
Instance Attribute Summary
Attributes included from Model
#api
Instance Method Summary
collapse
Methods included from Model
#auth_method, #create, #destroy, #execute, included, #model_class, #persisted?, #reload, #resource_path, #resources_path, #save_all_attributes, #to_json, #update_all_attributes
Instance Method Details
#expanded ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'lib/nylas/message.rb', line 75
def expanded
return self unless .nil?
assign(**api.execute(method: :get, path: resource_path, query: { view: "expanded" }))
transfer_attributes
self
end
|
#handle_folder ⇒ Object
90
91
92
93
94
95
96
|
# File 'lib/nylas/message.rb', line 90
def handle_folder
return if folder.nil?
self.folder_id = folder.id if folder_id.nil? && !self.to_h.dig(:folder, :id).nil?
self.folder = nil
end
|
#save ⇒ Object
84
85
86
87
88
|
# File 'lib/nylas/message.rb', line 84
def save
handle_folder
super
end
|
#starred? ⇒ Boolean
54
55
56
|
# File 'lib/nylas/message.rb', line 54
def starred?
starred
end
|
#unread? ⇒ Boolean
58
59
60
|
# File 'lib/nylas/message.rb', line 58
def unread?
unread
end
|
#update(payload) ⇒ Object
#update_folder(folder_id) ⇒ Object
71
72
73
|
# File 'lib/nylas/message.rb', line 71
def update_folder(folder_id)
update(folder_id: folder_id)
end
|