Class: Exponent::Push::ErrorBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/expo-push.rb

Instance Method Summary collapse

Instance Method Details

#parse_push_ticket(push_ticket) ⇒ Object



219
220
221
222
223
224
# File 'lib/expo-push.rb', line 219

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



209
210
211
212
213
214
215
216
217
# File 'lib/expo-push.rb', line 209

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