expo-server-sdk 0.1.0 → 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/.gitignore +2 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +13 -13
- data/README.md +22 -20
- data/expo-server-sdk.gemspec +2 -2
- data/lib/expo/server/sdk/version.rb +1 -1
- data/lib/push/client.rb +5 -4
- data/lib/push/receipts.rb +2 -2
- metadata +14 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88fbd428de8ccf50c783cd846f236d259560fc6dc4eeed67f6bced8e1851dc8f
|
4
|
+
data.tar.gz: 6f720c4b67e2d19d75a72cce990deae055f55fecdac6d0e04fc10a3cfe6175b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7bfc9795ac626e819cccc0dcb023cef728fa3d4e7721a6e4f2af67c79c7bd41d5744794f1eb29571cd957ea8eaa951692db0f6b18e3c70e2f8fb456d68d6375
|
7
|
+
data.tar.gz: 113707ebc856f9488cde8ac359cb0e02f329a12c238c8e0bab0b89eef83a43e51339e53d4be5a02f5b6db33006f31a924845465139677f2117184abbfffbbd93
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.1.4
|
4
|
+
|
5
|
+
- Change `ruby` version requirement to major only (2.6+)
|
6
|
+
|
7
|
+
## 0.1.3
|
8
|
+
|
9
|
+
- Fix typo in README.md
|
10
|
+
- Change `http` version requirement to be loose (4+)
|
11
|
+
|
12
|
+
## 0.1.2
|
13
|
+
|
14
|
+
- Add CHANGELOG.md
|
15
|
+
- Add shields to README.md
|
16
|
+
- Fix failing outdated tests
|
17
|
+
|
18
|
+
## 0.1.1
|
19
|
+
|
20
|
+
- Fix various release issues
|
21
|
+
|
22
|
+
## 0.1.0
|
23
|
+
|
24
|
+
Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
expo-server-sdk (0.1.
|
4
|
+
expo-server-sdk (0.1.4)
|
5
5
|
connection_pool (~> 2.2)
|
6
|
-
http (
|
6
|
+
http (>= 4.0, < 6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
connection_pool (2.2.5)
|
15
15
|
domain_name (0.5.20190701)
|
16
16
|
unf (>= 0.0.5, < 1.0.0)
|
17
|
-
ffi (1.15.
|
17
|
+
ffi (1.15.4-x64-mingw32)
|
18
18
|
ffi-compiler (1.0.1)
|
19
19
|
ffi (>= 1.0.0)
|
20
20
|
rake
|
@@ -23,37 +23,37 @@ GEM
|
|
23
23
|
http-cookie (~> 1.0)
|
24
24
|
http-form_data (~> 2.2)
|
25
25
|
llhttp-ffi (~> 0.4.0)
|
26
|
-
http-cookie (1.0.
|
26
|
+
http-cookie (1.0.4)
|
27
27
|
domain_name (~> 0.5)
|
28
28
|
http-form_data (2.3.0)
|
29
29
|
llhttp-ffi (0.4.0)
|
30
30
|
ffi-compiler (~> 1.0)
|
31
31
|
rake (~> 13.0)
|
32
32
|
minitest (5.14.4)
|
33
|
-
parallel (1.
|
34
|
-
parser (3.0.
|
33
|
+
parallel (1.21.0)
|
34
|
+
parser (3.0.2.0)
|
35
35
|
ast (~> 2.4.1)
|
36
36
|
public_suffix (4.0.6)
|
37
37
|
rainbow (3.0.0)
|
38
|
-
rake (13.0.
|
39
|
-
regexp_parser (1.
|
38
|
+
rake (13.0.6)
|
39
|
+
regexp_parser (2.1.1)
|
40
40
|
rexml (3.2.5)
|
41
|
-
rubocop (1.
|
41
|
+
rubocop (1.22.3)
|
42
42
|
parallel (~> 1.10)
|
43
43
|
parser (>= 3.0.0.0)
|
44
44
|
rainbow (>= 2.2.2, < 4.0)
|
45
45
|
regexp_parser (>= 1.8, < 3.0)
|
46
46
|
rexml
|
47
|
-
rubocop-ast (>= 1.
|
47
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
49
|
unicode-display_width (>= 1.4.0, < 3.0)
|
50
|
-
rubocop-ast (1.
|
50
|
+
rubocop-ast (1.13.0)
|
51
51
|
parser (>= 3.0.1.1)
|
52
52
|
ruby-progressbar (1.11.0)
|
53
53
|
unf (0.1.4)
|
54
54
|
unf_ext
|
55
|
-
unf_ext (0.0.
|
56
|
-
unicode-display_width (2.
|
55
|
+
unf_ext (0.0.8-x64-mingw32)
|
56
|
+
unicode-display_width (2.1.0)
|
57
57
|
|
58
58
|
PLATFORMS
|
59
59
|
x64-mingw32
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Expo::Server::SDK
|
2
2
|
|
3
|
+
[](https://github.com/SleeplessByte/expo-server-sdk-ruby/actions/workflows/main.yml) [](https://rubygems.org/gems/expo-server-sdk)
|
4
|
+
|
3
5
|
This gem was written because of the relatively little attention and improvement [expo-server-sdk-ruby](https://github.com/expo-community/expo-server-sdk-ruby) receives.
|
4
6
|
|
5
7
|
It does **not** work in the same way, so you'll want to read the documentation carefully if you intend to migrate.
|
@@ -14,11 +16,15 @@ gem 'expo-server-sdk'
|
|
14
16
|
|
15
17
|
And then execute:
|
16
18
|
|
17
|
-
|
19
|
+
```shell
|
20
|
+
bundle install
|
21
|
+
```
|
18
22
|
|
19
23
|
Or install it yourself as:
|
20
24
|
|
21
|
-
|
25
|
+
```shell
|
26
|
+
gem install expo-server-sdk
|
27
|
+
```
|
22
28
|
|
23
29
|
## Usage
|
24
30
|
|
@@ -62,7 +68,7 @@ some_push_tokens.each do |push_token|
|
|
62
68
|
# - #category_id
|
63
69
|
#
|
64
70
|
messages << client.notification
|
65
|
-
.to(
|
71
|
+
.to(push_token)
|
66
72
|
.sound('default')
|
67
73
|
.body('This is a test notification')
|
68
74
|
.data({ withSome: 'data' })
|
@@ -88,10 +94,7 @@ tickets = client.send!(messages)
|
|
88
94
|
# a batch contains failed errors, or completely failed pages:
|
89
95
|
#
|
90
96
|
tickets.each_error do |error|
|
91
|
-
if error.
|
92
|
-
puts error.message
|
93
|
-
# => "This indicates the entire request had an error"
|
94
|
-
else
|
97
|
+
if error.respond_to?(:explain)
|
95
98
|
puts error.explain
|
96
99
|
# => "The device cannot receive push notifications anymore and you should
|
97
100
|
# stop sending messages to the corresponding Expo push token."
|
@@ -105,7 +108,10 @@ tickets.each_error do |error|
|
|
105
108
|
|
106
109
|
error.original_push_token
|
107
110
|
# => ExpoPushToken[xxxxxxxxxxxxxxxxxxxxxx]
|
108
|
-
|
111
|
+
else
|
112
|
+
puts error.message
|
113
|
+
# => "This indicates the entire request had an error"
|
114
|
+
else
|
109
115
|
end
|
110
116
|
|
111
117
|
# Later, after the Expo push notification service has delivered the
|
@@ -227,13 +233,17 @@ client = Expo::Push::Client.new(
|
|
227
233
|
|
228
234
|
## Development
|
229
235
|
|
230
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
236
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
237
|
+
Then, run `rake test` to run the tests.
|
238
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
231
239
|
|
232
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
240
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
241
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
233
242
|
|
234
243
|
## Contributing
|
235
244
|
|
236
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/SleeplessByte/expo-server-sdk
|
245
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/SleeplessByte/expo-server-sdk-ruby>.
|
246
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/SleeplessByte/expo-server-sdk-ruby/blob/main/CODE_OF_CONDUCT.md).
|
237
247
|
|
238
248
|
## License
|
239
249
|
|
@@ -241,12 +251,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
241
251
|
|
242
252
|
## Code of Conduct
|
243
253
|
|
244
|
-
Everyone interacting in the `Expo::Server::SDK` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/SleeplessByte/expo-server-sdk/blob/
|
245
|
-
|
246
|
-
```
|
247
|
-
|
248
|
-
```
|
249
|
-
|
250
|
-
```
|
251
|
-
|
252
|
-
```
|
254
|
+
Everyone interacting in the `Expo::Server::SDK` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/SleeplessByte/expo-server-sdk/blob/main/CODE_OF_CONDUCT.md).
|
data/expo-server-sdk.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
'has many outstanding issues and open pull requests.'
|
14
14
|
spec.homepage = 'https://github.com/sleeplessbyte/expo-server-sdk-ruby'
|
15
15
|
spec.license = 'MIT'
|
16
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
17
17
|
|
18
18
|
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
19
19
|
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
# Uncomment to register a new dependency of your gem
|
35
35
|
# spec.add_dependency "example-gem", "~> 1.0"
|
36
36
|
spec.add_dependency 'connection_pool', '~> 2.2'
|
37
|
-
spec.add_dependency 'http', '
|
37
|
+
spec.add_dependency 'http', '>= 4.0', '< 6.0'
|
38
38
|
|
39
39
|
# For more information and examples about making a new gem, checkout our
|
40
40
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/push/client.rb
CHANGED
@@ -209,8 +209,8 @@ module Expo
|
|
209
209
|
|
210
210
|
def send!(notifications)
|
211
211
|
send(notifications).tap do |result|
|
212
|
-
result.each_error do |error|
|
213
|
-
raise error
|
212
|
+
result.each_error do |error|
|
213
|
+
raise error if error.is_a?(Error)
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
@@ -228,12 +228,13 @@ module Expo
|
|
228
228
|
end
|
229
229
|
|
230
230
|
errors = parsed_response['errors']
|
231
|
+
data = parsed_response['data']
|
231
232
|
|
232
233
|
if errors&.length&.positive?
|
233
234
|
ReceiptsWithErrors.new(data: parsed_response, errors: errors)
|
234
235
|
else
|
235
|
-
results =
|
236
|
-
Receipt.new(data:
|
236
|
+
results = data.map do |receipt_id, receipt_value|
|
237
|
+
Receipt.new(data: receipt_value, receipt_id: receipt_id)
|
237
238
|
end
|
238
239
|
|
239
240
|
Receipts.new(results: results, requested_ids: receipt_ids)
|
data/lib/push/receipts.rb
CHANGED
@@ -70,7 +70,7 @@ module Expo
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def each
|
73
|
-
|
73
|
+
results.each do |receipt|
|
74
74
|
next unless receipt.ok?
|
75
75
|
|
76
76
|
yield receipt
|
@@ -87,7 +87,7 @@ module Expo
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def unresolved_ids
|
90
|
-
requested_ids - results.
|
90
|
+
requested_ids - results.map(&:receipt_id)
|
91
91
|
end
|
92
92
|
|
93
93
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expo-server-sdk
|
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
|
- Derk-Jan Karrenbeld
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '6.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.0'
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '6.0'
|
41
47
|
description: This gem has been written to fix shortcomings with the current community
|
42
48
|
provided gem, which has many outstanding issues and open pull requests.
|
43
49
|
email:
|
@@ -50,6 +56,7 @@ files:
|
|
50
56
|
- ".github/workflows/main.yml"
|
51
57
|
- ".gitignore"
|
52
58
|
- ".rubocop.yml"
|
59
|
+
- CHANGELOG.md
|
53
60
|
- CODE_OF_CONDUCT.md
|
54
61
|
- Gemfile
|
55
62
|
- Gemfile.lock
|
@@ -82,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
89
|
requirements:
|
83
90
|
- - ">="
|
84
91
|
- !ruby/object:Gem::Version
|
85
|
-
version: 2.6.
|
92
|
+
version: 2.6.0
|
86
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
94
|
requirements:
|
88
95
|
- - ">="
|