expo-push-middleware 0.1.2 → 0.1.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/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/lib/expo-push-middleware/version.rb +1 -1
- data/lib/expo-push-middleware.rb +9 -1
- metadata +16 -2
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/Gemfile.lock
CHANGED
data/lib/expo-push-middleware.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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:
|