Class: Moromi::Aws::Sns::Message::Fcm
- Defined in:
- lib/moromi/aws/sns/message/fcm.rb
Instance Attribute Summary collapse
-
#android_channel_id ⇒ Object
readonly
Returns the value of attribute android_channel_id.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#body_loc_args ⇒ Object
readonly
Returns the value of attribute body_loc_args.
-
#body_loc_key ⇒ Object
readonly
Returns the value of attribute body_loc_key.
-
#click_action ⇒ Object
readonly
Returns the value of attribute click_action.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#sound ⇒ Object
readonly
Returns the value of attribute sound.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
- #title ⇒ Object readonly
-
#title_loc_args ⇒ Object
readonly
Returns the value of attribute title_loc_args.
-
#title_loc_key ⇒ Object
readonly
Returns the value of attribute title_loc_key.
Instance Method Summary collapse
-
#initialize(title: nil, body: nil, android_channel_id: nil, icon: nil, sound: nil, tag: nil, color: nil, click_action: nil, body_loc_key: nil, body_loc_args: nil, title_loc_key: nil, title_loc_args: nil, type: nil, custom_data: {}) ⇒ Fcm
constructor
A new instance of Fcm.
- #to_hash ⇒ Object
- #to_message_json ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(title: nil, body: nil, android_channel_id: nil, icon: nil, sound: nil, tag: nil, color: nil, click_action: nil, body_loc_key: nil, body_loc_args: nil, title_loc_key: nil, title_loc_args: nil, type: nil, custom_data: {}) ⇒ Fcm
Returns a new instance of Fcm.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 20 def initialize(title: nil, body: nil, android_channel_id: nil, icon: nil, sound: nil, tag: nil, color: nil, click_action: nil, body_loc_key: nil, body_loc_args: nil, title_loc_key: nil, title_loc_args: nil, type: nil, custom_data: {}) @title = title @body = body @android_channel_id = android_channel_id @icon = icon @sound = sound @tag = tag @color = color @click_action = click_action @body_loc_key = body_loc_key @body_loc_args = body_loc_args @title_loc_key = title_loc_key @title_loc_args = title_loc_args @type = type || self.class.name @custom_data = setup_initial_custom_data({type: @type}.merge(custom_data)) end |
Instance Attribute Details
#android_channel_id ⇒ Object (readonly)
Returns the value of attribute android_channel_id.
9 10 11 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 9 def android_channel_id @android_channel_id end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 8 def body @body end |
#body_loc_args ⇒ Object (readonly)
Returns the value of attribute body_loc_args.
16 17 18 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 16 def body_loc_args @body_loc_args end |
#body_loc_key ⇒ Object (readonly)
Returns the value of attribute body_loc_key.
15 16 17 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 15 def body_loc_key @body_loc_key end |
#click_action ⇒ Object (readonly)
Returns the value of attribute click_action.
14 15 16 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 14 def click_action @click_action end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
13 14 15 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 13 def color @color end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
10 11 12 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 10 def icon @icon end |
#sound ⇒ Object (readonly)
Returns the value of attribute sound.
11 12 13 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 11 def sound @sound end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
12 13 14 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 12 def tag @tag end |
#title ⇒ Object (readonly)
7 8 9 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 7 def title @title end |
#title_loc_args ⇒ Object (readonly)
Returns the value of attribute title_loc_args.
18 19 20 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 18 def title_loc_args @title_loc_args end |
#title_loc_key ⇒ Object (readonly)
Returns the value of attribute title_loc_key.
17 18 19 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 17 def title_loc_key @title_loc_key end |
Instance Method Details
#to_hash ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 41 def to_hash { title: @title, body: @body, android_channel_id: @android_channel_id, icon: @icon, sound: @sound, tag: @tag, color: @color, click_action: @click_action, body_loc_key: @body_loc_key, body_loc_args: @body_loc_args, title_loc_key: @title_loc_key, title_loc_args: @title_loc_args, type: @type, custom_data: @custom_data } end |
#to_message_json ⇒ Object
60 61 62 63 64 |
# File 'lib/moromi/aws/sns/message/fcm.rb', line 60 def notification = to_hash %i[custom_data type].each { |k| notification.delete(k) } {notification: notification, data: @custom_data}.to_json end |