Class: Maia::Device
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Maia::Device
- Defined in:
- app/models/maia/device.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.android ⇒ Object
34 35 36 |
# File 'app/models/maia/device.rb', line 34 def self.android where platform: 'android' end |
.ios ⇒ Object
30 31 32 |
# File 'app/models/maia/device.rb', line 30 def self.ios where platform: 'ios' end |
.owned_by(pushable) ⇒ Object
22 23 24 |
# File 'app/models/maia/device.rb', line 22 def self.owned_by(pushable) where(pushable: pushable).distinct end |
.tokens ⇒ Object
26 27 28 |
# File 'app/models/maia/device.rb', line 26 def self.tokens pluck(:token) end |
.unknown ⇒ Object
38 39 40 |
# File 'app/models/maia/device.rb', line 38 def self.unknown where platform: nil end |
Instance Method Details
#expire_token_in ⇒ Object
14 15 16 |
# File 'app/models/maia/device.rb', line 14 def expire_token_in 14.days end |
#reset_token_expiry ⇒ Object
10 11 12 |
# File 'app/models/maia/device.rb', line 10 def reset_token_expiry self.token_expires_at = Time.current + expire_token_in end |
#token_expired? ⇒ Boolean
18 19 20 |
# File 'app/models/maia/device.rb', line 18 def token_expired? token_expires_at.nil? || token_expires_at.past? end |