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
#auth_method, #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
58
59
60
|
# File 'lib/nylas/thread.rb', line 58
def starred?
starred
end
|
#unread? ⇒ Boolean
62
63
64
|
# File 'lib/nylas/thread.rb', line 62
def unread?
unread
end
|
#update(data) ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/nylas/thread.rb', line 45
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
54
55
56
|
# File 'lib/nylas/thread.rb', line 54
def update_folder(folder_id)
update(folder_id: folder_id)
end
|