Class: FirebaseCloudMessenger::Apns::ApnsObject

Inherits:
FirebaseObject show all
Defined in:
lib/firebase_cloud_messenger/apns/apns_object.rb

Direct Known Subclasses

Alert, ApsDictionary, Config, Payload

Instance Method Summary collapse

Methods inherited from FirebaseObject

#initialize

Constructor Details

This class inherits a constructor from FirebaseCloudMessenger::FirebaseObject

Instance Method Details

#to_hObject



4
5
6
7
8
9
10
11
12
# File 'lib/firebase_cloud_messenger/apns/apns_object.rb', line 4

def to_h
  fields.each_with_object({}) do |field, object_hash|
    val = send(field)
    next if val.nil?
    val = val.to_h if val.is_a?(FirebaseObject)

    object_hash[field.to_s.gsub("_", "-").to_sym] = val
  end
end