Class: IonicNotification::PushService
- Inherits:
-
Object
- Object
- IonicNotification::PushService
- Includes:
- HTTParty
- Defined in:
- lib/ionic_notification/push_service.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
writeonly
Sets the attribute body.
Instance Method Summary collapse
-
#initialize(notification) ⇒ PushService
constructor
A new instance of PushService.
- #notify! ⇒ Object
- #payload ⇒ Object
Constructor Details
#initialize(notification) ⇒ PushService
Returns a new instance of PushService.
8 9 10 |
# File 'lib/ionic_notification/push_service.rb', line 8 def initialize(notification) @notification = notification end |
Instance Attribute Details
#body=(value) ⇒ Object
Sets the attribute body
6 7 8 |
# File 'lib/ionic_notification/push_service.rb', line 6 def body=(value) @body = value end |
Instance Method Details
#notify! ⇒ Object
12 13 14 15 |
# File 'lib/ionic_notification/push_service.rb', line 12 def notify! resp = self.class.post("/api/v1/push", payload) IonicNotification.store(sent_notification(resp)) end |
#payload ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ionic_notification/push_service.rb', line 17 def payload = {} .merge!(body: body). merge!(basic_auth: auth). merge!(headers: headers) end |