expo-push-middleware 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/expo-push-middleware/version.rb +1 -1
- data/lib/expo-push-middleware.rb +7 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04068aa86c30613188a0bc722db4cc4567ef319cd19fe105bed1d3973931ba2f'
|
4
|
+
data.tar.gz: 9581bc9ddedb6cb6dbc6eb39a490ef735530aca6d810b958bafd17984086d9b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/lib/expo-push-middleware.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
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'
|
4
5
|
require 'typhoeus'
|
5
6
|
require 'json'
|
6
7
|
|
@@ -21,13 +22,18 @@ module Expo
|
|
21
22
|
class Client
|
22
23
|
class Error < StandardError; end
|
23
24
|
|
25
|
+
class TooManyMessagesError < StandardError
|
26
|
+
end
|
27
|
+
|
24
28
|
def initialize(**args)
|
25
29
|
@http_client = args[:http_client] || Typhoeus
|
26
30
|
end
|
27
31
|
|
28
32
|
def send_messages(messages, **_)
|
29
33
|
# https://docs.expo.io/versions/latest/guides/push-notifications/#message-format
|
30
|
-
|
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
|
+
|
31
37
|
|
32
38
|
@http_client.post(
|
33
39
|
"#{Expo::Push::Middleware.config.api_url}/api/v1/push_requests",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expo-push-middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Camblan
|
@@ -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:
|