Module: Nylas::Model::ClassMethods
- Defined in:
- lib/nylas/model.rb
Overview
Allows you to narrow in exactly what kind of model you're working with
Instance Attribute Summary collapse
-
#creatable ⇒ Object
Returns the value of attribute creatable.
-
#destroyable ⇒ Object
Returns the value of attribute destroyable.
-
#filterable ⇒ Object
Returns the value of attribute filterable.
-
#listable ⇒ Object
Returns the value of attribute listable.
-
#raw_mime_type ⇒ Object
Returns the value of attribute raw_mime_type.
- #resources_path ⇒ Object
-
#searchable ⇒ Object
Returns the value of attribute searchable.
-
#showable ⇒ Object
Returns the value of attribute showable.
-
#updatable ⇒ Object
Returns the value of attribute updatable.
Instance Method Summary collapse
- #allows_operations(creatable: false, showable: false, listable: false, filterable: false, searchable: false, updatable: false, destroyable: false) ⇒ Object
- #creatable? ⇒ Boolean
- #destroyable? ⇒ Boolean
- #exposable_as_raw? ⇒ Boolean
- #filterable? ⇒ Boolean
- #from_hash(data, api:) ⇒ Object
- #from_json(json, api:) ⇒ Object
- #listable? ⇒ Boolean
- #searchable? ⇒ Boolean
- #showable? ⇒ Boolean
- #updatable? ⇒ Boolean
Instance Attribute Details
#creatable ⇒ Object
Returns the value of attribute creatable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def creatable @creatable end |
#destroyable ⇒ Object
Returns the value of attribute destroyable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def destroyable @destroyable end |
#filterable ⇒ Object
Returns the value of attribute filterable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def filterable @filterable end |
#listable ⇒ Object
Returns the value of attribute listable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def listable @listable end |
#raw_mime_type ⇒ Object
Returns the value of attribute raw_mime_type.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def raw_mime_type @raw_mime_type end |
#resources_path ⇒ Object
183 184 185 |
# File 'lib/nylas/model.rb', line 183 def resources_path(*) @resources_path end |
#searchable ⇒ Object
Returns the value of attribute searchable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def searchable @searchable end |
#showable ⇒ Object
Returns the value of attribute showable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def showable @showable end |
#updatable ⇒ Object
Returns the value of attribute updatable.
139 140 141 |
# File 'lib/nylas/model.rb', line 139 def updatable @updatable end |
Instance Method Details
#allows_operations(creatable: false, showable: false, listable: false, filterable: false, searchable: false, updatable: false, destroyable: false) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/nylas/model.rb', line 143 def allows_operations(creatable: false, showable: false, listable: false, filterable: false, searchable: false, updatable: false, destroyable: false) self.creatable ||= creatable self.showable ||= showable self.listable ||= listable self.filterable ||= filterable self.searchable ||= searchable self.updatable ||= updatable self.destroyable ||= destroyable end |
#creatable? ⇒ Boolean
155 156 157 |
# File 'lib/nylas/model.rb', line 155 def creatable? creatable end |
#destroyable? ⇒ Boolean
179 180 181 |
# File 'lib/nylas/model.rb', line 179 def destroyable? destroyable end |
#exposable_as_raw? ⇒ Boolean
187 188 189 |
# File 'lib/nylas/model.rb', line 187 def exposable_as_raw? !raw_mime_type.nil? end |
#filterable? ⇒ Boolean
167 168 169 |
# File 'lib/nylas/model.rb', line 167 def filterable? filterable end |
#from_hash(data, api:) ⇒ Object
195 196 197 198 |
# File 'lib/nylas/model.rb', line 195 def from_hash(data, api:) instance = new(**data.merge(api: api)) instance end |
#from_json(json, api:) ⇒ Object
191 192 193 |
# File 'lib/nylas/model.rb', line 191 def from_json(json, api:) from_hash(JSON.parse(json, symbolize_names: true), api: api) end |
#listable? ⇒ Boolean
163 164 165 |
# File 'lib/nylas/model.rb', line 163 def listable? listable end |
#searchable? ⇒ Boolean
171 172 173 |
# File 'lib/nylas/model.rb', line 171 def searchable? searchable end |
#showable? ⇒ Boolean
159 160 161 |
# File 'lib/nylas/model.rb', line 159 def showable? showable end |
#updatable? ⇒ Boolean
175 176 177 |
# File 'lib/nylas/model.rb', line 175 def updatable? updatable end |