Class: HeyYouFcmPush::MessageObject::ApnsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/hey_you_fcm_push/message_object/apns_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers: nil, payload: nil, fcm_options: nil) ⇒ ApnsConfig

Returns a new instance of ApnsConfig.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hey_you_fcm_push/message_object/apns_config.rb', line 6

def initialize(headers: nil, payload: nil, fcm_options: nil)
  fcm_options = fcm_options&.transform_keys(&:to_sym)

  hash = { headers: headers, payload: payload }

  if fcm_options
    hash.merge!(
      fcm_options: FcmOptions.new(analytics_label: fcm_options[:analytics_label], image: fcm_options[:image]).to_h
    )
  end

  @to_h = hash
end

Instance Attribute Details

#to_hObject (readonly)

Returns the value of attribute to_h.



4
5
6
# File 'lib/hey_you_fcm_push/message_object/apns_config.rb', line 4

def to_h
  @to_h
end