Module: ActsAsPushable::Pushable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/acts_as_pushable/pushable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #add_device(device_params) ⇒ Object
- #add_device!(device_params) ⇒ Object
- #android_devices ⇒ Object
- #ios_devices ⇒ Object
- #send_push_notification(title:, message:, **options) ⇒ Object
Instance Method Details
#add_device(device_params) ⇒ Object
22 23 24 25 |
# File 'lib/acts_as_pushable/pushable.rb', line 22 def add_device(device_params) device = build_device(device_params) device.save end |
#add_device!(device_params) ⇒ Object
27 28 29 30 |
# File 'lib/acts_as_pushable/pushable.rb', line 27 def add_device!(device_params) device = build_device(device_params) device.save! end |
#android_devices ⇒ Object
18 19 20 |
# File 'lib/acts_as_pushable/pushable.rb', line 18 def android_devices devices.where(platform: 'android') end |
#ios_devices ⇒ Object
14 15 16 |
# File 'lib/acts_as_pushable/pushable.rb', line 14 def ios_devices devices.where(platform: 'ios') end |
#send_push_notification(title:, message:, **options) ⇒ Object
32 33 34 35 36 |
# File 'lib/acts_as_pushable/pushable.rb', line 32 def send_push_notification(title:, message:, **) devices.each do |device| device.send_push_notification(title: title, message: , **) end end |