Module: NotificationHub::DeviceManager
- Defined in:
- lib/notification_hub/device_manager.rb
Class Method Summary collapse
- .create_device(association_model_id, channel_code, device_details) ⇒ Object
- .delete_device(id) ⇒ Object
- .update_device(id, device_details) ⇒ Object
Class Method Details
.create_device(association_model_id, channel_code, device_details) ⇒ Object
5 6 7 8 |
# File 'lib/notification_hub/device_manager.rb', line 5 def create_device(association_model_id, channel_code, device_details) NotificationHub::Device.where("#{NotificationHub.association_model}_id" => association_model_id, channel_code: channel_code).where(device_details).first_or_create! end |
.delete_device(id) ⇒ Object
14 15 16 |
# File 'lib/notification_hub/device_manager.rb', line 14 def delete_device(id) NotificationHub::Device.find(id).destroy end |
.update_device(id, device_details) ⇒ Object
10 11 12 |
# File 'lib/notification_hub/device_manager.rb', line 10 def update_device(id, device_details) device = NotificationHub::Device.find(id).update_attributes(device_details) end |