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
- #auth_method ⇒ Object
-
#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
#auth_method ⇒ Object
191 192 193 |
# File 'lib/nylas/model.rb', line 191 def auth_method(*) @auth_method || HttpClient::AuthMethod::BEARER end |
#creatable ⇒ Object
Returns the value of attribute creatable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def creatable @creatable end |
#destroyable ⇒ Object
Returns the value of attribute destroyable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def destroyable @destroyable end |
#filterable ⇒ Object
Returns the value of attribute filterable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def filterable @filterable end |
#listable ⇒ Object
Returns the value of attribute listable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def listable @listable end |
#raw_mime_type ⇒ Object
Returns the value of attribute raw_mime_type.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def raw_mime_type @raw_mime_type end |
#resources_path ⇒ Object
187 188 189 |
# File 'lib/nylas/model.rb', line 187 def resources_path(*) @resources_path end |
#searchable ⇒ Object
Returns the value of attribute searchable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def searchable @searchable end |
#showable ⇒ Object
Returns the value of attribute showable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def showable @showable end |
#updatable ⇒ Object
Returns the value of attribute updatable.
143 144 145 |
# File 'lib/nylas/model.rb', line 143 def updatable @updatable end |
Instance Method Details
#allows_operations(creatable: false, showable: false, listable: false, filterable: false, searchable: false, updatable: false, destroyable: false) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/nylas/model.rb', line 147 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
159 160 161 |
# File 'lib/nylas/model.rb', line 159 def creatable? creatable end |
#destroyable? ⇒ Boolean
183 184 185 |
# File 'lib/nylas/model.rb', line 183 def destroyable? destroyable end |
#exposable_as_raw? ⇒ Boolean
195 196 197 |
# File 'lib/nylas/model.rb', line 195 def exposable_as_raw? !raw_mime_type.nil? end |
#filterable? ⇒ Boolean
171 172 173 |
# File 'lib/nylas/model.rb', line 171 def filterable? filterable end |
#from_hash(data, api:) ⇒ Object
203 204 205 206 |
# File 'lib/nylas/model.rb', line 203 def from_hash(data, api:) instance = new(**data.merge(api: api)) instance end |
#from_json(json, api:) ⇒ Object
199 200 201 |
# File 'lib/nylas/model.rb', line 199 def from_json(json, api:) from_hash(JSON.parse(json, symbolize_names: true), api: api) end |
#listable? ⇒ Boolean
167 168 169 |
# File 'lib/nylas/model.rb', line 167 def listable? listable end |
#searchable? ⇒ Boolean
175 176 177 |
# File 'lib/nylas/model.rb', line 175 def searchable? searchable end |
#showable? ⇒ Boolean
163 164 165 |
# File 'lib/nylas/model.rb', line 163 def showable? showable end |
#updatable? ⇒ Boolean
179 180 181 |
# File 'lib/nylas/model.rb', line 179 def updatable? updatable end |