Class: HeyYou::Builder::FcmPush

Inherits:
Base
  • Object
show all
Defined in:
lib/hey_you/builder/fcm_push.rb

Constant Summary collapse

NOTIFICATION_KEYS =
HeyYouFcmPush::MessageObject::Notification::TRANSLATED_KEYS.map(&:to_s).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#androidObject (readonly)

Returns the value of attribute android.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def android
  @android
end

#apnsObject (readonly)

Returns the value of attribute apns.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def apns
  @apns
end

#conditionObject (readonly)

Returns the value of attribute condition.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def condition
  @condition
end

#fcm_optionsObject (readonly)

Returns the value of attribute fcm_options.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def fcm_options
  @fcm_options
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def name
  @name
end

#notificationObject (readonly)

Returns the value of attribute notification.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def notification
  @notification
end

#push_dataObject (readonly)

Returns the value of attribute push_data.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def push_data
  @push_data
end

#topicObject (readonly)

Returns the value of attribute topic.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def topic
  @topic
end

#webpushObject (readonly)

Returns the value of attribute webpush.



7
8
9
# File 'lib/hey_you/builder/fcm_push.rb', line 7

def webpush
  @webpush
end

Instance Method Details

#buildObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hey_you/builder/fcm_push.rb', line 11

def build
  @topic = ch_data.fetch('topic', nil)
  @condition = ch_data.fetch('condition', nil)
  @name = ch_data.fetch('name', nil)

  @notification = interpolate_notification(ch_data.fetch('notification', nil)&.deep_dup)

  @android = interpolate_notification(ch_data.fetch('android', nil)&.deep_dup)
  @webpush = interpolate_notification(ch_data.fetch('webpush', nil)&.deep_dup)
  @apns = interpolate_notification(ch_data.fetch('apns', nil)&.deep_dup)
  @fcm_options = interpolate_notification(ch_data.fetch('fcm_options', nil)&.deep_dup)
  @push_data = ch_data.fetch('push_data', nil)&.deep_dup
end