class Lorkhan::Response

A wrapper around the HTTP/2 response from Apple

Attributes

body[R]
headers[R]

Public Class Methods

new(raw) click to toggle source

This class should never be instantiated directly.

# File lib/lorkhan/response.rb, line 11
def initialize(raw)
  @headers = raw.headers
  @body    = JSON.parse(raw.body)
rescue JSON::ParserError
  @body = nil
end

Public Instance Methods

apns_id() click to toggle source

Get the APNS id for the notification

# File lib/lorkhan/response.rb, line 35
def apns_id
  headers['apns-id']
end
ok?() click to toggle source

Convenience method to check if the status is 200

# File lib/lorkhan/response.rb, line 21
def ok?
  status == 200
end
status() click to toggle source

Get the HTTP status

# File lib/lorkhan/response.rb, line 28
def status
  headers[':status'].to_i
end