Class: Exponent::Push::ErrorBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/exponent-server-sdk-jm.rb

Instance Method Summary collapse

Instance Method Details

#parse_push_ticket(push_ticket) ⇒ Object



249
250
251
252
253
254
# File 'lib/exponent-server-sdk-jm.rb', line 249

def parse_push_ticket(push_ticket)
  with_error_handling(push_ticket) do
    message = push_ticket.fetch('message')
    get_error_class(push_ticket.fetch('details').fetch('error')).new(message)
  end
end

#parse_response(response) ⇒ Object



239
240
241
242
243
244
245
246
247
# File 'lib/exponent-server-sdk-jm.rb', line 239

def parse_response(response)
  with_error_handling(response) do
    error      = response.fetch('errors')
    error_name = error.fetch('code')
    message    = error.fetch('message')

    get_error_class(error_name).new(message)
  end
end