Sha256: 4e4540021432c177cef58c082cf65fd93014e9995628e2e6f1ee8d66e0c1c46b
Contents?: true
Size: 798 Bytes
Versions: 4
Compression:
Stored size: 798 Bytes
Contents
require 'faraday' # Provides us protection against the FiveMobilePush API's error handling which # is currently incomplete. module Faraday class Response::Errors < Response::Middleware begin def self.register_on_complete(env) env[:response].on_complete do |finished_env| case finished_env[:status] when 400 raise FiveMobilePush::GeneralError, finished_env[:body] when 401 raise FiveMobilePush::UnauthorizedError, finished_env[:body] when 500 raise FiveMobilePush::ServerError, 'push.fivemobile.com is currently down' end end end rescue LoadError, NameError => e self.load_error = e end def initialize(app) super @parser = nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
five_mobile_push-0.4.3 | lib/faraday/errors.rb |
five_mobile_push-0.4.2 | lib/faraday/errors.rb |
five_mobile_push-0.4.1 | lib/faraday/errors.rb |
five_mobile_push-0.4.0 | lib/faraday/errors.rb |