Class: Nylas::Thread
- Inherits:
-
Object
show all
- Includes:
- Model
- Defined in:
- lib/nylas/thread.rb
Overview
Ruby representation of the Nylas /threads API
Constant Summary
collapse
- UPDATABLE_ATTRIBUTES =
%i[label_ids folder_id starred unread].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, #save_all_attributes, #to_json, #update_all_attributes
Instance Method Details
#starred? ⇒ Boolean
53
54
55
|
# File 'lib/nylas/thread.rb', line 53
def starred?
starred
end
|
#unread? ⇒ Boolean
57
58
59
|
# File 'lib/nylas/thread.rb', line 57
def unread?
unread
end
|
#update(data) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/nylas/thread.rb', line 40
def update(data)
unupdatable_attributes = data.keys.reject { |name| UPDATABLE_ATTRIBUTES.include?(name) }
unless unupdatable_attributes.empty?
raise ArgumentError, "Cannot update #{unupdatable_attributes} only " \
"#{UPDATABLE_ATTRIBUTES} are updatable"
end
super(**data)
end
|
#update_folder(folder_id) ⇒ Object
49
50
51
|
# File 'lib/nylas/thread.rb', line 49
def update_folder(folder_id)
update(folder_id: folder_id)
end
|