pusher 1.4.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Pusher
2
- VERSION = '1.4.0'
2
+ VERSION = '2.0.1'
3
3
  end
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: 1.4.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pusher
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-02 00:00:00.000000000 Z
11
+ date: 2021-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.8'
55
- - !ruby/object:Gem::Dependency
56
- name: rbnacl
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '7.1'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '7.1'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rspec
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +150,20 @@ dependencies:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
152
  version: '2.3'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rbnacl
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '7.1'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '7.1'
167
167
  description: 'Wrapper for Pusher Channels REST api: : https://pusher.com/channels'
168
168
  email:
169
169
  - support@pusher.com
@@ -171,37 +171,21 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
- - ".document"
175
- - ".gemtest"
176
- - ".github/stale.yml"
177
- - ".gitignore"
178
- - ".travis.yml"
179
174
  - CHANGELOG.md
180
- - Gemfile
181
175
  - LICENSE
182
176
  - README.md
183
- - Rakefile
184
- - examples/async_message.rb
185
- - examples/presence_channels/presence_channels.rb
186
- - examples/presence_channels/public/presence_channels.html
187
177
  - lib/pusher.rb
188
178
  - lib/pusher/channel.rb
189
179
  - lib/pusher/client.rb
190
- - lib/pusher/native_notification/client.rb
191
180
  - lib/pusher/request.rb
192
181
  - lib/pusher/resource.rb
193
182
  - lib/pusher/version.rb
194
183
  - lib/pusher/webhook.rb
195
- - pusher.gemspec
196
- - spec/channel_spec.rb
197
- - spec/client_spec.rb
198
- - spec/spec_helper.rb
199
- - spec/web_hook_spec.rb
200
184
  homepage: http://github.com/pusher/pusher-http-ruby
201
185
  licenses:
202
186
  - MIT
203
187
  metadata: {}
204
- post_install_message:
188
+ post_install_message:
205
189
  rdoc_options: []
206
190
  require_paths:
207
191
  - lib
@@ -209,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
193
  requirements:
210
194
  - - ">="
211
195
  - !ruby/object:Gem::Version
212
- version: '0'
196
+ version: '2.6'
213
197
  required_rubygems_version: !ruby/object:Gem::Requirement
214
198
  requirements:
215
199
  - - ">="
@@ -217,11 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
201
  version: '0'
218
202
  requirements: []
219
203
  rubygems_version: 3.1.2
220
- signing_key:
204
+ signing_key:
221
205
  specification_version: 4
222
206
  summary: Pusher Channels API client
223
- test_files:
224
- - spec/channel_spec.rb
225
- - spec/client_spec.rb
226
- - spec/spec_helper.rb
227
- - spec/web_hook_spec.rb
207
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gemtest DELETED
File without changes
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: 365
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. Thankyou.
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/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- before_install:
2
- - sudo apt-get -y install libsodium18
3
-
4
- language: ruby
5
- sudo: false
6
- rvm:
7
- - 2.4
8
- - 2.5
9
- - 2.6
10
- - jruby
11
- - rbx-2
12
-
13
- matrix:
14
- allow_failures:
15
- - rvm: jruby
16
- - rvm: rbx-2
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
- # (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,69 +0,0 @@
1
- module Pusher
2
- module NativeNotification
3
- class Client
4
- attr_reader :app_id, :host
5
-
6
- API_PREFIX = "server_api"
7
- API_VERSION = "v1"
8
-
9
- def initialize(app_id, host, scheme, pusher_client)
10
- @app_id = app_id
11
- @host = host
12
- @scheme = scheme
13
- @pusher_client = pusher_client
14
- end
15
-
16
- # Send a notification via the native notifications API
17
- def notify(interests, data = {})
18
- Request.new(
19
- @pusher_client,
20
- :post,
21
- url("/notifications"),
22
- {},
23
- payload(interests, data)
24
- ).send_sync
25
- end
26
-
27
- private
28
-
29
- # {
30
- # interests: [Array of interests],
31
- # apns: {
32
- # See https://pusher.com/docs/push_notifications/ios/server
33
- # },
34
- # gcm: {
35
- # See https://pusher.com/docs/push_notifications/android/server
36
- # }
37
- # }
38
- #
39
- # @raise [Pusher::Error] if the interests array is empty
40
- # @return [String]
41
- def payload(interests, data)
42
- interests = Array(interests).map(&:to_s)
43
-
44
- raise Pusher::Error, "Interests array must not be empty" if interests.length == 0
45
-
46
- data = deep_symbolize_keys!(data)
47
-
48
- data.merge!(interests: interests)
49
-
50
- MultiJson.encode(data)
51
- end
52
-
53
- def url(path = nil)
54
- URI.parse("#{@scheme}://#{@host}/#{API_PREFIX}/#{API_VERSION}/apps/#{@app_id}#{path}")
55
- end
56
-
57
- # Symbolize all keys in the hash recursively
58
- def deep_symbolize_keys!(hash)
59
- hash.keys.each do |k|
60
- ks = k.respond_to?(:to_sym) ? k.to_sym : k
61
- hash[ks] = hash.delete(k)
62
- deep_symbolize_keys!(hash[ks]) if hash[ks].kind_of?(Hash)
63
- end
64
-
65
- hash
66
- end
67
- end
68
- end
69
- end
data/pusher.gemspec DELETED
@@ -1,34 +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.add_dependency "multi_json", "~> 1.15"
17
- s.add_dependency 'pusher-signature', "~> 0.1.8"
18
- s.add_dependency "httpclient", "~> 2.8"
19
- s.add_dependency "jruby-openssl" if defined?(JRUBY_VERSION)
20
- s.add_dependency "rbnacl", "~> 7.1"
21
-
22
- s.add_development_dependency "rspec", "~> 3.9"
23
- s.add_development_dependency "webmock", "~> 3.9"
24
- s.add_development_dependency "em-http-request", "~> 1.1"
25
- s.add_development_dependency "addressable", "~> 2.7"
26
- s.add_development_dependency "rake", "~> 13.0"
27
- s.add_development_dependency "rack", "~> 2.2"
28
- s.add_development_dependency "json", "~> 2.3"
29
-
30
- s.files = `git ls-files`.split("\n")
31
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
32
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
33
- s.require_paths = ["lib"]
34
- end