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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75823542cbe534c4fc5ea5b689561375bc207ac290a940fcf7a910551b07ed19
4
- data.tar.gz: 1af5961433f78e43d38759a93d69141487b973412273a975703be3cc49d05055
3
+ metadata.gz: 926899af0486552a8a8ee17b545d656e994c4767175932e4f0c5d3d325a65ca0
4
+ data.tar.gz: 19ba2ac29c3d5f54cbe9a7d08f94c34f5af57adbae7c451401287bf8ee4a8ed7
5
5
  SHA512:
6
- metadata.gz: d8d06b6e15df152bf1f6a07bb8d8b948fa3bca1bf47c3afacc8f1c8ff6c1d1b4af8ffd71b4419194b3fffb3883c35dac44d45f6ddebf8f781e6826756445a2e1
7
- data.tar.gz: 5b4a2ed5d16c6b950d4560e4b83363e69d61d320b18c2e114496be7a895cfec08da802953fcac10524d37e2e504660489229dda98e63970c82e7923a0aa09697
6
+ metadata.gz: 2f1676fed4bbc5fa23ee154ebd50b40076c0f8cca80811bb8067cc6a21b237500740fcb4b0cabdb5c9bae55bb7d11f5cd5c1a72b2d2d82854179ed1495022f23
7
+ data.tar.gz: 45dd3c0985917a43d0522ccf68d1fe88dd39ab5961cb2e6eed0dbd8f0737e1342ffa0e871bcd4bc1e0e76590119d44fd6dff875e73860014a2c319e45c3af543
@@ -1,3 +1,3 @@
1
1
  module Exponent
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.0.4'.freeze
3
3
  end
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
- "Request timed out: #{response.code} #{response.response_body}"
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
- "Request timed out: #{response.code} #{response.response_body}"
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.2
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: 2022-11-01 00:00:00.000000000 Z
13
+ date: 2024-04-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus