ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
480 stars 96 forks source link

add `apns_collapse_id` to the to_hash method in Apnotic::Notification #103

Closed marc-neumann closed 3 years ago

marc-neumann commented 3 years ago

Hi,

In this old pull request https://github.com/ostinelli/apnotic/pull/19 the apns_collapse_id was added. It would be nice if this id could also be added to the to_hash method in Apnotic::Notification. something like this in line https://github.com/ostinelli/apnotic/blob/master/lib/apnotic/notification.rb#L27

def to_hash
  { aps: aps }.tap do |result|
    result.merge!(custom_payload) if custom_payload
    result[:aps].merge!(apns_collapse_id: apns_collapse_id) if apns_collapse_id
  end
end
benubois commented 3 years ago

Hi @TigerTim,

I believe apns-collapse-id is a header and sending it in the body would have no effect or be invalid. It does get correctly set in Request.