Class: HeyYouFcmPush::MessageObject::WebPushConfig
- Inherits:
-
Object
- Object
- HeyYouFcmPush::MessageObject::WebPushConfig
- Defined in:
- lib/hey_you_fcm_push/message_object/web_push_config.rb
Instance Attribute Summary collapse
-
#to_h ⇒ Object
readonly
Returns the value of attribute to_h.
Instance Method Summary collapse
-
#initialize(headers: nil, data: nil, notification: nil, fcm_options: nil) ⇒ WebPushConfig
constructor
A new instance of WebPushConfig.
Constructor Details
#initialize(headers: nil, data: nil, notification: nil, fcm_options: nil) ⇒ WebPushConfig
Returns a new instance of WebPushConfig.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hey_you_fcm_push/message_object/web_push_config.rb', line 6 def initialize(headers: nil, data: nil, notification: nil, fcm_options: nil) notification = notification&.transform_keys(&:to_sym) = &.transform_keys(&:to_sym) hash = { headers: headers, data: data, notification: (Notification.new(**notification).to_h if notification), } if hash.merge( fcm_options: FcmOptions.new(analytics_label: [:analytics_label], link: [:link]).to_h ) end @to_h = hash.compact end |
Instance Attribute Details
#to_h ⇒ Object (readonly)
Returns the value of attribute to_h.
4 5 6 |
# File 'lib/hey_you_fcm_push/message_object/web_push_config.rb', line 4 def to_h @to_h end |