pusher 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -4
- data/lib/pusher/version.rb +1 -1
- metadata +2 -19
- data/.github/stale.yml +0 -26
- data/.github/workflows/gh-release.yml +0 -35
- data/.github/workflows/publish.yml +0 -17
- data/.github/workflows/release.yml +0 -71
- data/.github/workflows/test.yml +0 -31
- data/.gitignore +0 -24
- data/Gemfile +0 -2
- data/Rakefile +0 -11
- data/examples/async_message.rb +0 -28
- data/examples/presence_channels/presence_channels.rb +0 -56
- data/examples/presence_channels/public/presence_channels.html +0 -28
- data/pull_request_template.md +0 -7
- data/pusher.gemspec +0 -36
- data/spec/channel_spec.rb +0 -187
- data/spec/client_spec.rb +0 -741
- data/spec/spec_helper.rb +0 -26
- data/spec/web_hook_spec.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ec4402d063ad4e8193f92bee0a9116987cd1388e3f21be49b7bfbe62ad4dbab
|
4
|
+
data.tar.gz: 0f974393c92fba1afbae6b85faf96d6950932cc0b24b538d1493300ec1e51e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f6e5cc6dc5a02db77200c18244e07dee27bc52abd3e4c376642b56e330d5d4bf86494c393ddeb340a38054c45ab3358eafc5a3d2dd0b8f17f471a8b6ba283d
|
7
|
+
data.tar.gz: ad18ed1ce95a46e383b9af71b38b528cae273083deafca6f3d187f4586a27d8a900c719be612a76822ef30b58b8e41ce15fac540f15f0f7904ce9276dd138b2c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This Gem provides a Ruby interface to [the Pusher HTTP API for Pusher Channels](https://pusher.com/docs/channels/library_auth_reference/rest-api).
|
4
4
|
|
5
|
-
[![Build Status](https://github.com/pusher/pusher-http-ruby/workflows/Tests/badge.svg)](https://github.com/pusher/pusher-http-ruby/actions?query=workflow%3ATests+branch%3Amaster) [![Gem
|
5
|
+
[![Build Status](https://github.com/pusher/pusher-http-ruby/workflows/Tests/badge.svg)](https://github.com/pusher/pusher-http-ruby/actions?query=workflow%3ATests+branch%3Amaster) [![Gem](https://img.shields.io/gem/v/pusher)](https://rubygems.org/gems/pusher) [![Gem](https://img.shields.io/gem/dt/pusher)](https://rubygems.org/gems/pusher)
|
6
6
|
|
7
7
|
## Supported Platforms
|
8
8
|
|
@@ -40,7 +40,7 @@ pusher = Pusher::Client.new(
|
|
40
40
|
)
|
41
41
|
```
|
42
42
|
|
43
|
-
The `cluster` value will set the `host` to `api-<cluster>.pusher.com`. The `use_tls` value is optional and defaults to `
|
43
|
+
The `cluster` value will set the `host` to `api-<cluster>.pusher.com`. The `use_tls` value is optional and defaults to `true`. It will set the `scheme` and `port`. A custom `port` value takes precendence over `use_tls`.
|
44
44
|
|
45
45
|
If you want to set a custom `host` value for your client then you can do so when instantiating a Pusher Channels client like so:
|
46
46
|
|
@@ -83,11 +83,11 @@ If you need to make requests via a HTTP proxy then it can be configured
|
|
83
83
|
Pusher.http_proxy = 'http://(user):(password)@(host):(port)'
|
84
84
|
```
|
85
85
|
|
86
|
-
By default API requests are made over
|
86
|
+
By default API requests are made over HTTPS. HTTP can be used by setting `use_tls` to `false`.
|
87
87
|
Issuing this command is going to reset `port` value if it was previously specified.
|
88
88
|
|
89
89
|
``` ruby
|
90
|
-
Pusher.
|
90
|
+
Pusher.use_tls = false
|
91
91
|
```
|
92
92
|
|
93
93
|
As of version 0.12, SSL certificates are verified when using the synchronous http client. If you need to disable this behaviour for any reason use:
|
data/lib/pusher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pusher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -171,20 +171,9 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
-
- ".github/stale.yml"
|
175
|
-
- ".github/workflows/gh-release.yml"
|
176
|
-
- ".github/workflows/publish.yml"
|
177
|
-
- ".github/workflows/release.yml"
|
178
|
-
- ".github/workflows/test.yml"
|
179
|
-
- ".gitignore"
|
180
174
|
- CHANGELOG.md
|
181
|
-
- Gemfile
|
182
175
|
- LICENSE
|
183
176
|
- README.md
|
184
|
-
- Rakefile
|
185
|
-
- examples/async_message.rb
|
186
|
-
- examples/presence_channels/presence_channels.rb
|
187
|
-
- examples/presence_channels/public/presence_channels.html
|
188
177
|
- lib/pusher.rb
|
189
178
|
- lib/pusher/channel.rb
|
190
179
|
- lib/pusher/client.rb
|
@@ -192,12 +181,6 @@ files:
|
|
192
181
|
- lib/pusher/resource.rb
|
193
182
|
- lib/pusher/version.rb
|
194
183
|
- lib/pusher/webhook.rb
|
195
|
-
- pull_request_template.md
|
196
|
-
- pusher.gemspec
|
197
|
-
- spec/channel_spec.rb
|
198
|
-
- spec/client_spec.rb
|
199
|
-
- spec/spec_helper.rb
|
200
|
-
- spec/web_hook_spec.rb
|
201
184
|
homepage: http://github.com/pusher/pusher-http-ruby
|
202
185
|
licenses:
|
203
186
|
- MIT
|
data/.github/stale.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# Configuration for probot-stale - https://github.com/probot/stale
|
2
|
-
|
3
|
-
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
4
|
-
daysUntilStale: 90
|
5
|
-
|
6
|
-
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
7
|
-
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
8
|
-
daysUntilClose: 7
|
9
|
-
|
10
|
-
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
11
|
-
onlyLabels: []
|
12
|
-
|
13
|
-
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
14
|
-
exemptLabels:
|
15
|
-
- pinned
|
16
|
-
- security
|
17
|
-
|
18
|
-
# Set to true to ignore issues with an assignee (defaults to false)
|
19
|
-
exemptAssignees: true
|
20
|
-
|
21
|
-
# Comment to post when marking as stale. Set to `false` to disable
|
22
|
-
markComment: >
|
23
|
-
This issue has been automatically marked as stale because it has not had
|
24
|
-
recent activity. It will be closed if no further activity occurs. If you'd
|
25
|
-
like this issue to stay open please leave a comment indicating how this issue
|
26
|
-
is affecting you. Thank you.
|
@@ -1,35 +0,0 @@
|
|
1
|
-
name: Github Release
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
create-release:
|
9
|
-
name: Create Release
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
steps:
|
12
|
-
- name: Checkout code
|
13
|
-
uses: actions/checkout@v2
|
14
|
-
- name: Setup git
|
15
|
-
run: |
|
16
|
-
git config user.email "pusher-ci@pusher.com"
|
17
|
-
git config user.name "Pusher CI"
|
18
|
-
- name: Prepare description
|
19
|
-
run: |
|
20
|
-
csplit -s CHANGELOG.md "/##/" {1}
|
21
|
-
cat xx01 > CHANGELOG.tmp
|
22
|
-
- name: Prepare tag
|
23
|
-
run: |
|
24
|
-
export TAG=$(head -1 CHANGELOG.tmp | cut -d' ' -f2)
|
25
|
-
echo "TAG=$TAG" >> $GITHUB_ENV
|
26
|
-
- name: Create Release
|
27
|
-
uses: actions/create-release@v1
|
28
|
-
env:
|
29
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
30
|
-
with:
|
31
|
-
tag_name: ${{ env.TAG }}
|
32
|
-
release_name: ${{ env.TAG }}
|
33
|
-
body_path: CHANGELOG.tmp
|
34
|
-
draft: false
|
35
|
-
prerelease: false
|
@@ -1,17 +0,0 @@
|
|
1
|
-
name: RubyGems release
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
build:
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v1
|
13
|
-
|
14
|
-
- name: Publish gem
|
15
|
-
uses: dawidd6/action-publish-gem@v1
|
16
|
-
with:
|
17
|
-
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
name: Release
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
types: [ labeled ]
|
6
|
-
branches:
|
7
|
-
- master
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
prepare-release:
|
11
|
-
name: Prepare release
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
|
14
|
-
steps:
|
15
|
-
- name: Set major release
|
16
|
-
if: ${{ github.event.label.name == 'release-major' }}
|
17
|
-
run: echo "RELEASE=major" >> $GITHUB_ENV
|
18
|
-
- name: Set minor release
|
19
|
-
if: ${{ github.event.label.name == 'release-minor' }}
|
20
|
-
run: echo "RELEASE=minor" >> $GITHUB_ENV
|
21
|
-
- name: Set patch release
|
22
|
-
if: ${{ github.event.label.name == 'release-patch' }}
|
23
|
-
run: echo "RELEASE=patch" >> $GITHUB_ENV
|
24
|
-
- name: Check release env
|
25
|
-
run: |
|
26
|
-
if [[ -z "${{ env.RELEASE }}" ]];
|
27
|
-
then
|
28
|
-
echo "You need to set a release label on PRs to the main branch"
|
29
|
-
exit 1
|
30
|
-
else
|
31
|
-
exit 0
|
32
|
-
fi
|
33
|
-
- name: Install semver-tool
|
34
|
-
run: |
|
35
|
-
export DIR=$(mktemp -d)
|
36
|
-
cd $DIR
|
37
|
-
curl https://github.com/fsaintjacques/semver-tool/archive/3.2.0.tar.gz -L -o semver.tar.gz
|
38
|
-
tar -xvf semver.tar.gz
|
39
|
-
sudo cp semver-tool-3.2.0/src/semver /usr/local/bin
|
40
|
-
- name: Bump version
|
41
|
-
run: |
|
42
|
-
export CURRENT=$(gem info pusher --remote --exact | grep -o "pusher ([0-9]*\.[0-9]*\.[0-9]*)" | awk -F '[()]' '{print $2}')
|
43
|
-
export NEW_VERSION=$(semver bump ${{ env.RELEASE }} $CURRENT)
|
44
|
-
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
45
|
-
- name: Checkout code
|
46
|
-
uses: actions/checkout@v2
|
47
|
-
- name: Setup git
|
48
|
-
run: |
|
49
|
-
git config user.email "pusher-ci@pusher.com"
|
50
|
-
git config user.name "Pusher CI"
|
51
|
-
git fetch
|
52
|
-
git checkout ${{ github.event.pull_request.head.ref }}
|
53
|
-
- name: Prepare CHANGELOG
|
54
|
-
run: |
|
55
|
-
echo "${{ github.event.pull_request.body }}" | csplit -s - "/##/"
|
56
|
-
echo "# Changelog
|
57
|
-
|
58
|
-
## ${{ env.VERSION }}
|
59
|
-
" >> CHANGELOG.tmp
|
60
|
-
grep "^*" xx01 >> CHANGELOG.tmp
|
61
|
-
grep -v "^# " CHANGELOG.md >> CHANGELOG.tmp
|
62
|
-
cp CHANGELOG.tmp CHANGELOG.md
|
63
|
-
- name: Prepare version.rb
|
64
|
-
run: |
|
65
|
-
sed -i "s|VERSION = '[^']*'|VERSION = '${{ env.VERSION }}'|" lib/pusher/version.rb
|
66
|
-
- name: Commit changes
|
67
|
-
run: |
|
68
|
-
git add CHANGELOG.md lib/pusher/version.rb
|
69
|
-
git commit -m "Bump to version ${{ env.VERSION }}"
|
70
|
-
- name: Push
|
71
|
-
run: git push
|
data/.github/workflows/test.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
name: Tests
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
push:
|
6
|
-
branches: [master, main]
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
test:
|
10
|
-
runs-on: ubuntu-20.04
|
11
|
-
strategy:
|
12
|
-
fail-fast: false
|
13
|
-
matrix:
|
14
|
-
ruby: ['2.6', '2.7', '3.0']
|
15
|
-
|
16
|
-
name: Ruby ${{ matrix.ruby }} Test
|
17
|
-
|
18
|
-
steps:
|
19
|
-
- name: Checkout
|
20
|
-
uses: actions/checkout@v2
|
21
|
-
|
22
|
-
- name: Setup Ruby
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
|
27
|
-
- name: Install dependencies
|
28
|
-
run: bundle install
|
29
|
-
|
30
|
-
- name: Run test suite
|
31
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/examples/async_message.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'pusher'
|
3
|
-
require 'eventmachine'
|
4
|
-
require 'em-http-request'
|
5
|
-
|
6
|
-
# To get these values:
|
7
|
-
# - Go to https://app.pusherapp.com/
|
8
|
-
# - Click on Choose App.
|
9
|
-
# - Click on one of your apps
|
10
|
-
# - Click API Access
|
11
|
-
Pusher.app_id = 'your_app_id'
|
12
|
-
Pusher.key = 'your_key'
|
13
|
-
Pusher.secret = 'your_secret'
|
14
|
-
|
15
|
-
|
16
|
-
EM.run {
|
17
|
-
deferrable = Pusher['test_channel'].trigger_async('my_event', 'hi')
|
18
|
-
|
19
|
-
deferrable.callback { # called on success
|
20
|
-
puts "Message sent successfully."
|
21
|
-
EM.stop
|
22
|
-
}
|
23
|
-
deferrable.errback { |error| # called on error
|
24
|
-
puts "Message could not be sent."
|
25
|
-
puts error
|
26
|
-
EM.stop
|
27
|
-
}
|
28
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'sinatra/cookies'
|
3
|
-
require 'sinatra/json'
|
4
|
-
require 'pusher'
|
5
|
-
|
6
|
-
# You can get these variables from http://dashboard.pusher.com
|
7
|
-
pusher = Pusher::Client.new(
|
8
|
-
app_id: 'your-app-id',
|
9
|
-
key: 'your-app-key',
|
10
|
-
secret: 'your-app-secret',
|
11
|
-
cluster: 'your-app-cluster'
|
12
|
-
)
|
13
|
-
|
14
|
-
set :public_folder, 'public'
|
15
|
-
|
16
|
-
get '/' do
|
17
|
-
redirect '/presence_channels.html'
|
18
|
-
end
|
19
|
-
|
20
|
-
# Emulate rails behaviour where this information would be stored in session
|
21
|
-
get '/signin' do
|
22
|
-
cookies[:user_id] = 'example_cookie'
|
23
|
-
'Ok'
|
24
|
-
end
|
25
|
-
|
26
|
-
# Auth endpoint: https://pusher.com/docs/channels/server_api/authenticating-users
|
27
|
-
post '/pusher/auth' do
|
28
|
-
channel_data = {
|
29
|
-
user_id: 'example_user',
|
30
|
-
user_info: {
|
31
|
-
name: 'example_name',
|
32
|
-
email: 'example_email'
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
if cookies[:user_id] == 'example_cookie'
|
37
|
-
response = pusher.authenticate(params[:channel_name], params[:socket_id], channel_data)
|
38
|
-
json response
|
39
|
-
else
|
40
|
-
status 403
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
get '/pusher_trigger' do
|
45
|
-
channels = ['presence-channel-test'];
|
46
|
-
|
47
|
-
begin
|
48
|
-
pusher.trigger(channels, 'test-event', {
|
49
|
-
message: 'hello world'
|
50
|
-
})
|
51
|
-
rescue Pusher::Error => e
|
52
|
-
# For example, Pusher::AuthenticationError, Pusher::HTTPError, or Pusher::Error
|
53
|
-
end
|
54
|
-
|
55
|
-
'Triggered!'
|
56
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<head>
|
3
|
-
<title>Pusher Test</title>
|
4
|
-
<script src="https://js.pusher.com/5.0/pusher.min.js"></script>
|
5
|
-
<script>
|
6
|
-
|
7
|
-
// Enable pusher logging - don't include this in production
|
8
|
-
Pusher.logToConsole = true;
|
9
|
-
|
10
|
-
var pusher = new Pusher('your-app-key', {
|
11
|
-
cluster: 'your-app-cluster',
|
12
|
-
forceTLS: true,
|
13
|
-
authEndpoint: '/pusher/auth'
|
14
|
-
});
|
15
|
-
|
16
|
-
var channel = pusher.subscribe('presence-channel-test');
|
17
|
-
channel.bind('test-event', function(data) {
|
18
|
-
alert(JSON.stringify(data));
|
19
|
-
});
|
20
|
-
</script>
|
21
|
-
</head>
|
22
|
-
<body>
|
23
|
-
<h1>Pusher Test</h1>
|
24
|
-
<p>
|
25
|
-
Try publishing an event to channel <code>presence-channel-test</code>
|
26
|
-
with event name <code>test-event</code>.
|
27
|
-
</p>
|
28
|
-
</body>
|