expo-push-middleware 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36642e32e88da03150ad467ca7b2c6d87bddd903d9b07c6570548d9780efe850
4
- data.tar.gz: 05c4adecdbd9bee31ab99f2e94c2fc4141f2ac1e05766dc7e72abb7d1314ae7a
3
+ metadata.gz: '04068aa86c30613188a0bc722db4cc4567ef319cd19fe105bed1d3973931ba2f'
4
+ data.tar.gz: 9581bc9ddedb6cb6dbc6eb39a490ef735530aca6d810b958bafd17984086d9b1
5
5
  SHA512:
6
- metadata.gz: 6c4bee31ee97bc22a6645918e4beafe0e7a88235653869cf06bb2dcb0b99c7eb3aa1cf012df793e746c66dd8f5c1ba55f60bb0b831776a2bfe5ae39d3fbb5f8b
7
- data.tar.gz: 3955e83b59843033b37172d333ce0fc84e2ac70ec3d814a870eb293937e2a29e804430c79fc551bef17aefe1445372eebbb04d523c194c8d7f03e553a2a6a346
6
+ metadata.gz: c2bbfb95f52ec615a3711739c5a4c4c4687be5d6499d61b1e2bf77ad59aa0059a9d06a4f875661f16d9c262c865d84d88b39bde0afff4cc0779ecdab49404302
7
+ data.tar.gz: 5ed3c6a7bc08c8205b016af82e64fa7ebf96dbe1f51effbf05409c16249044fa1ab81ff70fb9fef844dbe8351aaeb00592fc4cebf2d737160680e7bdc2003e88
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.4] - 2023-03-31
4
+
5
+ - Raise error when request has more than 100 targetted devices
6
+
7
+ Expo SDK just breaks without handling errors in this situation.
8
+
9
+ ## [0.1.3] - 2023-03-31
10
+
11
+ - Require Typhoeus & Json classes.
12
+
13
+ Missing requires led to uninitialized constant errors in some cases.
14
+
3
15
  ## [0.1.1] - 2023-03-29
4
16
 
5
17
  - Fix typo in filename
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- expo-push-middleware (0.1.2)
4
+ expo-push-middleware (0.1.1)
5
5
  typhoeus
6
6
 
7
7
  GEM
@@ -3,7 +3,7 @@
3
3
  module Expo
4
4
  module Push
5
5
  module Middleware
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.4"
7
7
  end
8
8
  end
9
9
  end
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "expo-push-middleware/version"
4
+ require 'active_support/core_ext/hash/indifferent_access'
5
+ require 'typhoeus'
6
+ require 'json'
4
7
 
5
8
  module Expo
6
9
  module Push
@@ -19,13 +22,18 @@ module Expo
19
22
  class Client
20
23
  class Error < StandardError; end
21
24
 
25
+ class TooManyMessagesError < StandardError
26
+ end
27
+
22
28
  def initialize(**args)
23
29
  @http_client = args[:http_client] || Typhoeus
24
30
  end
25
31
 
26
32
  def send_messages(messages, **_)
27
33
  # https://docs.expo.io/versions/latest/guides/push-notifications/#message-format
28
- raise TooManyMessagesError, "Only 100 message objects at a time allowed." if messages.length > 100
34
+ expo_tokens = messages.map { |message| message.with_indifferent_access[:to] }.flatten
35
+ raise TooManyMessagesError, "Only 100 message objects at a time allowed." if expo_tokens.length > 100
36
+
29
37
 
30
38
  @http_client.post(
31
39
  "#{Expo::Push::Middleware.config.api_url}/api/v1/push_requests",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expo-push-middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Camblan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Middleware that intercepts push notifications, sends them to Expo Push
28
42
  API with monitoring as bonus.
29
43
  email: