Class: Getui::Apns
- Inherits:
-
Object
- Object
- Getui::Apns
- Defined in:
- lib/getui/apple.rb
Instance Attribute Summary collapse
-
#auto_badge ⇒ Object
Returns the value of attribute auto_badge.
-
#body ⇒ Object
Returns the value of attribute body.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(body, title: "", payload: nil) ⇒ Apns
constructor
A new instance of Apns.
Constructor Details
#initialize(body, title: "", payload: nil) ⇒ Apns
Returns a new instance of Apns.
4 5 6 7 8 9 10 |
# File 'lib/getui/apple.rb', line 4 def initialize(body, title: "", payload: nil) @body = body @title = title @auto_badge = "1" @payload = payload @sound = "default" end |
Instance Attribute Details
#auto_badge ⇒ Object
Returns the value of attribute auto_badge.
3 4 5 |
# File 'lib/getui/apple.rb', line 3 def auto_badge @auto_badge end |
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/getui/apple.rb', line 3 def body @body end |
#payload ⇒ Object
Returns the value of attribute payload.
3 4 5 |
# File 'lib/getui/apple.rb', line 3 def payload @payload end |
#sound ⇒ Object
Returns the value of attribute sound.
3 4 5 |
# File 'lib/getui/apple.rb', line 3 def sound @sound end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/getui/apple.rb', line 3 def title @title end |
Instance Method Details
#as_json ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/getui/apple.rb', line 12 def as_json { aps: { alert: { body: self.body, title: self.title, }, autoBadge: self.auto_badge, sound: self.sound, }, payload: payload, } end |