Exception: ApnsProviderApi::Notification::APNSError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/apns_provider_api/notification.rb

Constant Summary collapse

CODES =
{
  200 => "Success",
  400 => "Bad request",
  403 => "There was an error with the certificate",
  405 => "The request used a bad :method value. Only POST requests are supported",
  410 => "The device token is no longer active for the topic",
  413 => "The notification payload was too large",
  429 => "The server received too many requests for the same device token",
  500 => "Internal server error",
  503 => "The server is shutting down and unavailable"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ APNSError

Returns a new instance of APNSError.

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'lib/apns_provider_api/notification.rb', line 22

def initialize(code)
  raise ArgumentError unless CODES.include?(code)
  super(CODES[code])
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



20
21
22
# File 'lib/apns_provider_api/notification.rb', line 20

def code
  @code
end