class Urbanairship::Common::AirshipFailure

Attributes

details[RW]

Raised when we get an error response from the server.

error[RW]

Raised when we get an error response from the server.

error_code[RW]

Raised when we get an error response from the server.

response[RW]

Raised when we get an error response from the server.

Public Class Methods

new() click to toggle source
# File lib/urbanairship/common.rb, line 118
def initialize
  @error = nil
  @error_code = nil
  @details = nil
  @response = nil
end

Public Instance Methods

from_response(response) click to toggle source

Instantiate a ValidationFailure from a Response object

# File lib/urbanairship/common.rb, line 126
def from_response(response)

  payload = response.body
  @error = payload['error']
  @error_code = payload['error_code']
  @details = payload['details']
  @response = response

  logger.error("Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}")

  self
end