expo-push 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/expo-push/version.rb +1 -1
- data/lib/expo-push.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926899af0486552a8a8ee17b545d656e994c4767175932e4f0c5d3d325a65ca0
|
4
|
+
data.tar.gz: 19ba2ac29c3d5f54cbe9a7d08f94c34f5af57adbae7c451401287bf8ee4a8ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1676fed4bbc5fa23ee154ebd50b40076c0f8cca80811bb8067cc6a21b237500740fcb4b0cabdb5c9bae55bb7d11f5cd5c1a72b2d2d82854179ed1495022f23
|
7
|
+
data.tar.gz: 45dd3c0985917a43d0522ccf68d1fe88dd39ab5961cb2e6eed0dbd8f0737e1342ffa0e871bcd4bc1e0e76590119d44fd6dff875e73860014a2c319e45c3af543
|
data/lib/expo-push/version.rb
CHANGED
data/lib/expo-push.rb
CHANGED
@@ -38,6 +38,7 @@ module Exponent
|
|
38
38
|
class Client
|
39
39
|
def initialize(**args)
|
40
40
|
@http_client = args[:http_client] || Typhoeus
|
41
|
+
@params = args[:params].presence || {}
|
41
42
|
@error_builder = ErrorBuilder.new
|
42
43
|
# future versions will deprecate this
|
43
44
|
@response_handler = args[:response_handler] || ResponseHandler.new
|
@@ -70,6 +71,7 @@ module Exponent
|
|
70
71
|
@http_client.post(
|
71
72
|
push_url,
|
72
73
|
body: messages.to_json,
|
74
|
+
params: @params,
|
73
75
|
headers: headers,
|
74
76
|
accept_encoding: @gzip
|
75
77
|
)
|
@@ -118,14 +120,17 @@ module Exponent
|
|
118
120
|
|
119
121
|
case response.code.to_s
|
120
122
|
when '504'
|
121
|
-
# NOTE: Raise specific error so app knows to retry the request.
|
122
123
|
raise Exponent::Push::GatewayTimeoutError.new(
|
123
|
-
"
|
124
|
+
"#{response.code} #{response.response_body}"
|
125
|
+
)
|
126
|
+
when '503'
|
127
|
+
raise Exponent::Push::UpstreamConnectError.new(
|
128
|
+
"#{response.code} #{response.response_body}"
|
124
129
|
)
|
125
130
|
when '502'
|
126
131
|
# NOTE: Raise specific error so app knows to retry the request.
|
127
132
|
raise Exponent::Push::BadGatewayError.new(
|
128
|
-
"
|
133
|
+
"#{response.code} #{response.response_body}"
|
129
134
|
)
|
130
135
|
when '400'
|
131
136
|
# NOTE: The app will want to handle expo server error response differently.
|
@@ -259,7 +264,7 @@ module Exponent
|
|
259
264
|
def self.error_names
|
260
265
|
%w[DeviceNotRegistered MessageTooBig
|
261
266
|
MessageRateExceeded InvalidCredentials GatewayTimeout
|
262
|
-
BadGateway Unknown]
|
267
|
+
BadGateway UpstreamConnect Unknown]
|
263
268
|
end
|
264
269
|
|
265
270
|
error_names.each do |error_name|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expo-push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Ruder
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typhoeus
|