Method: Lowdown::Notification#formatted_payload

Defined in:
lib/lowdown/notification.rb

#formatted_payloadHash

Unless the payload contains an aps entry, the payload is assumed to be a mix of APN defined attributes and custom attributes and re-organized according to the specifications.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/lowdown/notification.rb', line 94

def formatted_payload
  if @payload.key?("aps")
    @payload
  else
    payload = {}
    payload["aps"] = aps = {}
    @payload.each do |key, value|
      next if value.nil?
      key = key.to_s
      if APS_KEYS.include?(key)
        aps[key] = value
      else
        payload[key] = value
      end
    end
    payload
  end
end