pusher 2.0.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c186f5455002119a1783a5d4fe40df5f60db90a5a028fbcfc2d792efd3ef993
4
- data.tar.gz: 8efdc4ef40dd9fbe41ce6d9695e2e4a5eddb79d2f462d3ce2a68f6475cb6afe8
3
+ metadata.gz: 71dc5eb4f9d389dce37f6ec8c1f78390402b31bd94edcb6f22094c70edeb2d72
4
+ data.tar.gz: 3b2d0db0ffe052cbd8c71b252ced1d5910ece64a08100a92c0f17b5ac9b6fa8a
5
5
  SHA512:
6
- metadata.gz: 9182e53ee76a64c33205fd7dfbcf5ad7b35bcf9934096baa380fa1f6ab89acaeb770ccba76eb8a9a6c4fd8abe8f848cae605a784ed67ed2a52b52bbc65a0495e
7
- data.tar.gz: aa4faf02269292f19ea9724de6562a128dfaf37cc3ee34caf7941a9f3e50cb55cdea1a75b05323d3fe8ed93a92ce7e682fc59d1116e5377f3c1c73af6eea015e
6
+ metadata.gz: 2f644cc58f1b8accd8785eeffc3fc74bad4c20677032455d96e655944ee0818f99802ed339a3f5f9049acd57ea1166817f6c01feba926c9b61256260239c6354
7
+ data.tar.gz: c0d4edd095918225bea29707df4e8e0364b16218c367b40f72c5541fe98232e4698e83e58ea8260b7caeeea54d314ec343ea25050f1f7847747d01a003c68221
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.3
4
+
5
+ * [FIXED] Corrected the channels limit when publishing events. Upped from 10 to 100.
6
+
7
+ ## 2.0.2
8
+
9
+ * [CHANGED] made encryption_master_key_base64 globally configurable
10
+
11
+ ## 2.0.1
12
+
13
+ * [CHANGED] Only include lib and essential docs in gem.
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  * [CHANGED] Use TLS by default.
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 Version](https://badge.fury.io/rb/pusher.svg)](https://badge.fury.io/rb/pusher)
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 `false`. It will set the `scheme` and `port`. Custom `scheme` and `port` values take precendence over `use_tls`.
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 HTTP. HTTPS can be used by setting `encrypted` to `true`.
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.encrypted = true
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/client.rb CHANGED
@@ -401,7 +401,7 @@ module Pusher
401
401
 
402
402
  def trigger_params(channels, event_name, data, params)
403
403
  channels = Array(channels).map(&:to_s)
404
- raise Pusher::Error, "Too many channels (#{channels.length}), max 10" if channels.length > 10
404
+ raise Pusher::Error, "Too many channels (#{channels.length}), max 100" if channels.length > 100
405
405
 
406
406
  encoded_data = if channels.any?{ |c| c.match(/^private-encrypted-/) } then
407
407
  raise Pusher::Error, "Cannot trigger to multiple channels if any are encrypted" if channels.length > 1
@@ -1,3 +1,3 @@
1
1
  module Pusher
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.3'
3
3
  end
data/lib/pusher.rb CHANGED
@@ -27,8 +27,10 @@ module Pusher
27
27
  class << self
28
28
  extend Forwardable
29
29
 
30
- def_delegators :default_client, :scheme, :host, :port, :app_id, :key, :secret, :http_proxy
31
- def_delegators :default_client, :scheme=, :host=, :port=, :app_id=, :key=, :secret=, :http_proxy=
30
+ def_delegators :default_client, :scheme, :host, :port, :app_id, :key,
31
+ :secret, :http_proxy, :encryption_master_key_base64
32
+ def_delegators :default_client, :scheme=, :host=, :port=, :app_id=, :key=,
33
+ :secret=, :http_proxy=, :encryption_master_key_base64=
32
34
 
33
35
  def_delegators :default_client, :authentication_token, :url, :cluster
34
36
  def_delegators :default_client, :encrypted=, :url=, :cluster=
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.0
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pusher
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2022-08-19 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,17 +181,11 @@ 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
204
187
  metadata: {}
205
- post_install_message:
188
+ post_install_message:
206
189
  rdoc_options: []
207
190
  require_paths:
208
191
  - lib
@@ -218,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
201
  version: '0'
219
202
  requirements: []
220
203
  rubygems_version: 3.1.2
221
- signing_key:
204
+ signing_key:
222
205
  specification_version: 4
223
206
  summary: Pusher Channels API client
224
207
  test_files: []
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
@@ -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
@@ -1,24 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
- .yardoc
21
- Gemfile.lock
22
-
23
- ## PROJECT::SPECIFIC
24
- .bundle
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec) do |s|
7
- s.pattern = 'spec/**/*.rb'
8
- end
9
-
10
- task :default => :spec
11
- task :test => :spec
@@ -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>
@@ -1,7 +0,0 @@
1
- ## Description
2
-
3
- Add a short description of the change. If this is related to an issue, please add a reference to the issue.
4
-
5
- ## CHANGELOG
6
-
7
- * [CHANGED] Describe your change here. Look at CHANGELOG.md to see the format.
data/pusher.gemspec DELETED
@@ -1,36 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require File.expand_path('../lib/pusher/version', __FILE__)
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "pusher"
7
- s.version = Pusher::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Pusher"]
10
- s.email = ["support@pusher.com"]
11
- s.homepage = "http://github.com/pusher/pusher-http-ruby"
12
- s.summary = %q{Pusher Channels API client}
13
- s.description = %q{Wrapper for Pusher Channels REST api: : https://pusher.com/channels}
14
- s.license = "MIT"
15
-
16
- s.required_ruby_version = ">= 2.6"
17
-
18
- s.add_dependency "multi_json", "~> 1.15"
19
- s.add_dependency 'pusher-signature', "~> 0.1.8"
20
- s.add_dependency "httpclient", "~> 2.8"
21
- s.add_dependency "jruby-openssl" if defined?(JRUBY_VERSION)
22
-
23
- s.add_development_dependency "rspec", "~> 3.9"
24
- s.add_development_dependency "webmock", "~> 3.9"
25
- s.add_development_dependency "em-http-request", "~> 1.1"
26
- s.add_development_dependency "addressable", "~> 2.7"
27
- s.add_development_dependency "rake", "~> 13.0"
28
- s.add_development_dependency "rack", "~> 2.2"
29
- s.add_development_dependency "json", "~> 2.3"
30
- s.add_development_dependency "rbnacl", "~> 7.1"
31
-
32
- s.files = `git ls-files`.split("\n")
33
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
34
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
35
- s.require_paths = ["lib"]
36
- end