class Pushr::Daemon::Apns2Support::Request

Attributes

body[R]
headers[R]
path[R]

Public Class Methods

new(notification, token) click to toggle source
# File lib/pushr/daemon/apns2_support/request.rb, line 7
def initialize(notification, token)
  @path = "/3/device/#{notification.token}"
  @headers = build_headers_for(notification, token)
  @body = notification.body
end

Private Instance Methods

build_headers_for(notification, token) click to toggle source
# File lib/pushr/daemon/apns2_support/request.rb, line 15
def build_headers_for(notification, token)
  h = {}
  h['authorization'] = "bearer #{token}"
  h['apns-id'] = notification.apns_id if notification.apns_id
  h['apns-collapse-id'] = notification.apns_collapse_id if notification.apns_collapse_id
  h['apns-expiration'] = notification.apns_expiration if notification.apns_expiration
  h['apns-priority'] = notification.apns_priority if notification.apns_priority
  h['apns-topic'] = notification.apns_topic if notification.apns_topic
  h
end