one_signal 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +30 -0
- data/CHANGELOG.txt +5 -1
- data/README.md +9 -5
- data/bin/console +18 -0
- data/bin/setup +18 -0
- data/lib/one_signal/player.rb +2 -2
- data/lib/one_signal/version.rb +1 -1
- data/test/player_test.rb +7 -4
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ecf8297187f5f593675815585d362c3a8c4c99c6af50bbf709023a3f14f042
|
4
|
+
data.tar.gz: 1f934153151a37c760d740c681566af64dc0b30b2ad06f2074395c79289aba7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b5248740e5a2ee2f456faff1f9641d3d37d9535d6bb826050beff88900f608eb7c7bf794bbffa9f65454acdc4966412645ef029995051c53b7e58a8ce341cca
|
7
|
+
data.tar.gz: b962c34e169b1751e88126d66ce7f964e0199859ec5ce2856b25ef3a7f758e5cea3209067286006418a94769ca1259d95d234c41450244b851a876c63a77ac88
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Build + Publish
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
permissions:
|
11
|
+
contents: read
|
12
|
+
packages: write
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.6
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.6.x
|
20
|
+
|
21
|
+
- name: Publish to RubyGems
|
22
|
+
run: |
|
23
|
+
mkdir -p $HOME/.gem
|
24
|
+
touch $HOME/.gem/credentials
|
25
|
+
chmod 0600 $HOME/.gem/credentials
|
26
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
27
|
+
gem build *.gemspec
|
28
|
+
gem push *.gem
|
29
|
+
env:
|
30
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/CHANGELOG.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 1.2.2 2021-09-02
|
2
|
+
|
3
|
+
* Fix delete a player method to include `params` argument: https://github.com/tbalthazar/onesignal-ruby/pull/20
|
4
|
+
|
1
5
|
=== 1.2.1 2021-09-01
|
2
6
|
|
3
7
|
* Add a method to delete a player: https://github.com/tbalthazar/onesignal-ruby/pull/18
|
@@ -16,7 +20,7 @@
|
|
16
20
|
|
17
21
|
=== 0.0.14 2016-02-22
|
18
22
|
|
19
|
-
* Change ruby required version from 2.2.0 to 2.1.0
|
23
|
+
* Change ruby required version from 2.2.0 to 2.1.0
|
20
24
|
|
21
25
|
=== 0.0.13 2016-02-18
|
22
26
|
|
data/README.md
CHANGED
@@ -12,19 +12,22 @@ gem install one_signal
|
|
12
12
|
|
13
13
|
## Development
|
14
14
|
|
15
|
+
Run `bin/setup` to install dependencies and set your API keys.
|
16
|
+
|
15
17
|
Run the tests
|
16
18
|
|
17
19
|
```
|
18
20
|
bundle exec rake
|
19
21
|
```
|
20
22
|
|
23
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment with authenticated library methods.
|
24
|
+
|
21
25
|
## Basic usage
|
22
26
|
|
23
|
-
See basic examples in [example.rb](/example.rb).
|
27
|
+
See some basic examples in [example.rb](/example.rb).
|
24
28
|
To run it:
|
25
|
-
-
|
26
|
-
-
|
27
|
-
- run `ruby example.rb`
|
29
|
+
- run `bin/setup` to set your API keys
|
30
|
+
- then run `ruby example.rb`
|
28
31
|
|
29
32
|
## Documentation
|
30
33
|
|
@@ -81,6 +84,7 @@ The return value of each method is a `Net::HTTPResponse`.
|
|
81
84
|
- OneSignal::Player.create_purchase(id:, params:)
|
82
85
|
- OneSignal::Player.create_focus(id:, params:)
|
83
86
|
- OneSignal::Player.update(id:, params:)
|
87
|
+
- OneSignal::Player.delete(id:, params:)
|
84
88
|
```
|
85
89
|
|
86
90
|
### Notifications
|
@@ -103,4 +107,4 @@ They are [listed here](https://github.com/tbalthazar/onesignal-ruby/graphs/contr
|
|
103
107
|
|
104
108
|
## License
|
105
109
|
|
106
|
-
Please see [LICENSE](/LICENSE) for licensing details.
|
110
|
+
Please see [LICENSE](/LICENSE) for licensing details.
|
data/bin/console
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dotenv/load"
|
5
|
+
require "one_signal"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
OneSignal::OneSignal.user_auth_key = ENV['USER_AUTH_KEY']
|
11
|
+
OneSignal::OneSignal.api_key = ENV['API_KEY']
|
12
|
+
|
13
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
14
|
+
# require "pry"
|
15
|
+
# Pry.start
|
16
|
+
|
17
|
+
require "irb"
|
18
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
|
5
|
+
bundle install
|
6
|
+
|
7
|
+
echo "Enter your OneSignal credentials."
|
8
|
+
echo "For dealing with Apps, you'll need a user auth key."
|
9
|
+
read -p 'User Auth Key: ' user_auth_key
|
10
|
+
echo "For dealing with Players and Notifications, you'll need an API key."
|
11
|
+
read -p 'API Key: ' api_key
|
12
|
+
|
13
|
+
cp .env.example .env
|
14
|
+
|
15
|
+
sed -i '' -e "s/YOUR_USER_AUTH_KEY_HERE/$user_auth_key/g" .env
|
16
|
+
sed -i '' -e "s/YOUR_API_KEY_HERE/$api_key/g" .env
|
17
|
+
|
18
|
+
echo "Done."
|
data/lib/one_signal/player.rb
CHANGED
@@ -154,7 +154,7 @@ module OneSignal
|
|
154
154
|
return response
|
155
155
|
end
|
156
156
|
|
157
|
-
def self.delete(id: "", opts: {})
|
157
|
+
def self.delete(id: "", params: {}, opts: {})
|
158
158
|
opts[:auth_key] ||= @@api_key
|
159
159
|
|
160
160
|
uri_string = @@base_uri
|
@@ -162,7 +162,7 @@ module OneSignal
|
|
162
162
|
uri_string += "/#{id}"
|
163
163
|
uri = URI.parse(uri_string)
|
164
164
|
|
165
|
-
response = send_delete_request(uri: uri, params:
|
165
|
+
response = send_delete_request(uri: uri, params: params, opts: opts)
|
166
166
|
|
167
167
|
ensure_http_status(response: response,
|
168
168
|
status: '200',
|
data/lib/one_signal/version.rb
CHANGED
data/test/player_test.rb
CHANGED
@@ -198,17 +198,20 @@ class PlayerTest < MiniTest::Test
|
|
198
198
|
def test_delete
|
199
199
|
response = mock_response_ok
|
200
200
|
OneSignal::OneSignal.expects(:send_delete_request)
|
201
|
-
.with(uri: @delete_uri, params:
|
201
|
+
.with(uri: @delete_uri, params: @params, opts: @default_opts)
|
202
202
|
.returns(response)
|
203
|
-
assert_equal response, OneSignal::Player.delete(id: @player_id
|
203
|
+
assert_equal response, OneSignal::Player.delete(id: @player_id,
|
204
|
+
params: @params)
|
204
205
|
end
|
205
206
|
|
206
207
|
def test_delete_with_auth_key
|
207
208
|
response = mock_response_ok
|
208
209
|
OneSignal::OneSignal.expects(:send_delete_request)
|
209
|
-
.with(uri: @delete_uri, params:
|
210
|
+
.with(uri: @delete_uri, params: @params, opts: @opts)
|
210
211
|
.returns(response)
|
211
|
-
assert_equal response, OneSignal::Player.delete(id: @player_id,
|
212
|
+
assert_equal response, OneSignal::Player.delete(id: @player_id,
|
213
|
+
params: @params,
|
214
|
+
opts: @opts)
|
212
215
|
end
|
213
216
|
|
214
217
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_signal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Balthazar
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -74,12 +74,15 @@ extra_rdoc_files: []
|
|
74
74
|
files:
|
75
75
|
- ".env.example"
|
76
76
|
- ".github/workflows/ci.yml"
|
77
|
+
- ".github/workflows/gem-push.yml"
|
77
78
|
- ".gitignore"
|
78
79
|
- CHANGELOG.txt
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
83
86
|
- example.rb
|
84
87
|
- lib/one_signal.rb
|
85
88
|
- lib/one_signal/app.rb
|
@@ -99,7 +102,7 @@ homepage: https://github.com/tbalthazar/onesignal-ruby
|
|
99
102
|
licenses:
|
100
103
|
- MIT
|
101
104
|
metadata: {}
|
102
|
-
post_install_message:
|
105
|
+
post_install_message:
|
103
106
|
rdoc_options: []
|
104
107
|
require_paths:
|
105
108
|
- lib
|
@@ -114,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
117
|
- !ruby/object:Gem::Version
|
115
118
|
version: '0'
|
116
119
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
120
|
+
rubygems_version: 3.0.3.1
|
121
|
+
signing_key:
|
119
122
|
specification_version: 4
|
120
123
|
summary: A library which implements the OneSignal API
|
121
124
|
test_files: []
|