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
#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
68
69
70
71
72
73
74
75
|
# File 'lib/nylas/message.rb', line 68
def expanded
return self unless .nil?
assign(**api.execute(method: :get, path: resource_path, query: { view: "expanded" }))
transfer_attributes
self
end
|
#handle_folder ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/nylas/message.rb', line 83
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
77
78
79
80
81
|
# File 'lib/nylas/message.rb', line 77
def save
handle_folder
super
end
|
#starred? ⇒ Boolean
47
48
49
|
# File 'lib/nylas/message.rb', line 47
def starred?
starred
end
|
#unread? ⇒ Boolean
51
52
53
|
# File 'lib/nylas/message.rb', line 51
def unread?
unread
end
|
#update(payload) ⇒ Object
#update_folder(folder_id) ⇒ Object
64
65
66
|
# File 'lib/nylas/message.rb', line 64
def update_folder(folder_id)
update(folder_id: folder_id)
end
|