Module: Andpush
- Defined in:
- lib/andpush.rb,
lib/andpush/client.rb,
lib/andpush/version.rb,
lib/andpush/exceptions.rb,
lib/andpush/json_handler.rb
Defined Under Namespace
Classes: APIError, BadGateway, BadRequest, Client, ClientError, Conflict, ExpectationFailed, FailedDependency, Forbidden, GatewayTimeout, Gone, HTTPVersionNotSupported, HttpError, ImaTeapot, InsufficientStorage, InternalServerError, JsonResponse, LengthRequired, Locked, LoopDetected, MethodNotAllowed, MisdirectedRequest, NetworkAuthenticationRequired, NetworkError, NotAcceptable, NotExtended, NotFound, NotImplemented, PayloadTooLarge, PaymentRequired, PreconditionFailed, PreconditionRequired, ProxyAuthenticationRequired, RangeNotSatisfiable, RequestHeaderFieldsTooLarge, RequestTimeout, ServerError, ServiceUnavailable, TooManyRequests, URITooLong, Unauthorized, UnavailableForLegalReasons, UnprocessableEntity, UnsupportedMediaType, UpgradeRequired, VariantAlsoNegotiates
Constant Summary collapse
- DOMAIN =
'https://fcm.googleapis.com'.freeze
- VERSION =
'0.1.0'.freeze
- STATUS_TO_EXCEPTION_MAPPING =
{ '400' => BadRequest, '401' => Unauthorized, '402' => PaymentRequired, '403' => Forbidden, '404' => NotFound, '405' => MethodNotAllowed, '406' => NotAcceptable, '407' => ProxyAuthenticationRequired, '408' => RequestTimeout, '409' => Conflict, '410' => Gone, '411' => LengthRequired, '412' => PreconditionFailed, '413' => PayloadTooLarge, '414' => URITooLong, '415' => UnsupportedMediaType, '416' => RangeNotSatisfiable, '417' => ExpectationFailed, '418' => ImaTeapot, '421' => MisdirectedRequest, '422' => UnprocessableEntity, '423' => Locked, '424' => FailedDependency, '426' => UpgradeRequired, '428' => PreconditionRequired, '429' => TooManyRequests, '431' => RequestHeaderFieldsTooLarge, '451' => UnavailableForLegalReasons, '500' => InternalServerError, '501' => NotImplemented, '502' => BadGateway, '503' => ServiceUnavailable, '504' => GatewayTimeout, '505' => HTTPVersionNotSupported, '506' => VariantAlsoNegotiates, '507' => InsufficientStorage, '508' => LoopDetected, '510' => NotExtended, '511' => NetworkAuthenticationRequired }.freeze
Class Method Summary collapse
Class Method Details
.build(server_key, domain: nil, request_handler: ConnectionPool.new) ⇒ Object
9 10 11 12 13 |
# File 'lib/andpush.rb', line 9 def self.build(server_key, domain: nil, request_handler: ConnectionPool.new) ::Andpush::Client .new(domain || DOMAIN, request_handler: request_handler) .register_interceptor(Authenticator.new(server_key)) end |