pusher 0.17.0 → 2.0.3

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.
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: 0.17.0
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pusher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.15'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pusher-signature
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,126 +44,143 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.7'
47
+ version: '2.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.7'
54
+ version: '2.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '3.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '3.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '3.9'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '3.9'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: em-http-request
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.1.0
89
+ version: '1.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: addressable
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.7'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 1.1.0
110
+ version: '2.7'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rake
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ">="
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '0'
117
+ version: '13.0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ">="
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '0'
124
+ version: '13.0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rack
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ">="
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '0'
131
+ version: '2.2'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ">="
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '0'
138
+ version: '2.2'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: json
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ">="
143
+ - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '0'
145
+ version: '2.3'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ">="
150
+ - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0'
139
- description: Wrapper for pusher.com REST api
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
+ description: 'Wrapper for Pusher Channels REST api: : https://pusher.com/channels'
140
168
  email:
141
169
  - support@pusher.com
142
170
  executables: []
143
171
  extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
146
- - ".document"
147
- - ".gemtest"
148
- - ".gitignore"
149
- - ".travis.yml"
150
174
  - CHANGELOG.md
151
- - Gemfile
152
175
  - LICENSE
153
176
  - README.md
154
- - Rakefile
155
- - examples/async_message.rb
156
177
  - lib/pusher.rb
157
178
  - lib/pusher/channel.rb
158
179
  - lib/pusher/client.rb
159
180
  - lib/pusher/request.rb
160
181
  - lib/pusher/resource.rb
182
+ - lib/pusher/version.rb
161
183
  - lib/pusher/webhook.rb
162
- - pusher.gemspec
163
- - spec/channel_spec.rb
164
- - spec/client_spec.rb
165
- - spec/spec_helper.rb
166
- - spec/web_hook_spec.rb
167
184
  homepage: http://github.com/pusher/pusher-http-ruby
168
185
  licenses:
169
186
  - MIT
@@ -176,16 +193,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
193
  requirements:
177
194
  - - ">="
178
195
  - !ruby/object:Gem::Version
179
- version: '0'
196
+ version: '2.6'
180
197
  required_rubygems_version: !ruby/object:Gem::Requirement
181
198
  requirements:
182
199
  - - ">="
183
200
  - !ruby/object:Gem::Version
184
201
  version: '0'
185
202
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.4.5.1
203
+ rubygems_version: 3.1.2
188
204
  signing_key:
189
205
  specification_version: 4
190
- summary: Pusher API client
206
+ summary: Pusher Channels API client
191
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/.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,19 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 1.9.2
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - 2.3.0
10
- - jruby-18mode
11
- - jruby-19mode
12
- - rbx-2
13
-
14
- matrix:
15
- allow_failures:
16
- - rmv: 1.9.2
17
- - rvm: jruby-18mode
18
- - rvm: jruby-19mode
19
- - 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
- }
data/pusher.gemspec DELETED
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "pusher"
6
- s.version = "0.17.0"
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ["Pusher"]
9
- s.email = ["support@pusher.com"]
10
- s.homepage = "http://github.com/pusher/pusher-http-ruby"
11
- s.summary = %q{Pusher API client}
12
- s.description = %q{Wrapper for pusher.com REST api}
13
- s.license = "MIT"
14
-
15
- s.add_dependency "multi_json", "~> 1.0"
16
- s.add_dependency 'pusher-signature', "~> 0.1.8"
17
- s.add_dependency "httpclient", "~> 2.7"
18
- s.add_dependency "jruby-openssl" if defined?(JRUBY_VERSION)
19
-
20
- s.add_development_dependency "rspec", "~> 3.0"
21
- s.add_development_dependency "webmock"
22
- s.add_development_dependency "em-http-request", "~> 1.1.0"
23
- s.add_development_dependency "rake"
24
- s.add_development_dependency "rack"
25
- s.add_development_dependency "json"
26
-
27
- s.files = `git ls-files`.split("\n")
28
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
- s.require_paths = ["lib"]
31
- end
data/spec/channel_spec.rb DELETED
@@ -1,168 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe Pusher::Channel do
5
- before do
6
- @client = Pusher::Client.new({
7
- :app_id => '20',
8
- :key => '12345678900000001',
9
- :secret => '12345678900000001',
10
- :host => 'api.pusherapp.com',
11
- :port => 80,
12
- })
13
- @channel = @client['test_channel']
14
- end
15
-
16
- let(:pusher_url_regexp) { %r{/apps/20/events} }
17
-
18
- def stub_post(status, body = nil)
19
- options = {:status => status}
20
- options.merge!({:body => body}) if body
21
-
22
- stub_request(:post, pusher_url_regexp).to_return(options)
23
- end
24
-
25
- def stub_post_to_raise(e)
26
- stub_request(:post, pusher_url_regexp).to_raise(e)
27
- end
28
-
29
- describe '#trigger!' do
30
- it "should use @client.trigger internally" do
31
- expect(@client).to receive(:trigger)
32
- @channel.trigger('new_event', 'Some data')
33
- end
34
- end
35
-
36
- describe '#trigger' do
37
- it "should log failure if error raised in http call" do
38
- stub_post_to_raise(HTTPClient::BadResponseError)
39
-
40
- expect(Pusher.logger).to receive(:error).with("Exception from WebMock (HTTPClient::BadResponseError) (Pusher::HTTPError)")
41
- expect(Pusher.logger).to receive(:debug) #backtrace
42
- channel = Pusher::Channel.new(@client.url, 'test_channel', @client)
43
- channel.trigger('new_event', 'Some data')
44
- end
45
-
46
- it "should log failure if Pusher returns an error response" do
47
- stub_post 401, "some signature info"
48
- expect(Pusher.logger).to receive(:error).with("some signature info (Pusher::AuthenticationError)")
49
- expect(Pusher.logger).to receive(:debug) #backtrace
50
- channel = Pusher::Channel.new(@client.url, 'test_channel', @client)
51
- channel.trigger('new_event', 'Some data')
52
- end
53
- end
54
-
55
- describe "#initialization" do
56
- it "should not be too long" do
57
- expect { @client['b'*201] }.to raise_error(Pusher::Error)
58
- end
59
-
60
- it "should not use bad characters" do
61
- expect { @client['*^!±`/""'] }.to raise_error(Pusher::Error)
62
- end
63
- end
64
-
65
- describe "#trigger_async" do
66
- it "should use @client.trigger_async internally" do
67
- expect(@client).to receive(:trigger_async)
68
- @channel.trigger_async('new_event', 'Some data')
69
- end
70
- end
71
-
72
- describe '#info' do
73
- it "should call the Client#channel_info" do
74
- expect(@client).to receive(:get).with("/channels/mychannel", anything)
75
- @channel = @client['mychannel']
76
- @channel.info
77
- end
78
-
79
- it "should assemble the requested attributes into the info option" do
80
- expect(@client).to receive(:get).with(anything, {
81
- :info => "user_count,connection_count"
82
- })
83
- @channel = @client['presence-foo']
84
- @channel.info(%w{user_count connection_count})
85
- end
86
- end
87
-
88
- describe '#users' do
89
- it "should call the Client#channel_users" do
90
- expect(@client).to receive(:get).with("/channels/presence-mychannel/users").and_return({:users => {'id' => '4'}})
91
- @channel = @client['presence-mychannel']
92
- @channel.users
93
- end
94
- end
95
-
96
- describe "#authentication_string" do
97
- def authentication_string(*data)
98
- lambda { @channel.authentication_string(*data) }
99
- end
100
-
101
- it "should return an authentication string given a socket id" do
102
- auth = @channel.authentication_string('1.1')
103
-
104
- expect(auth).to eq('12345678900000001:02259dff9a2a3f71ea8ab29ac0c0c0ef7996c8f3fd3702be5533f30da7d7fed4')
105
- end
106
-
107
- it "should raise error if authentication is invalid" do
108
- [nil, ''].each do |invalid|
109
- expect(authentication_string(invalid)).to raise_error Pusher::Error
110
- end
111
- end
112
-
113
- describe 'with extra string argument' do
114
- it 'should be a string or nil' do
115
- expect(authentication_string('1.1', 123)).to raise_error Pusher::Error
116
- expect(authentication_string('1.1', {})).to raise_error Pusher::Error
117
-
118
- expect(authentication_string('1.1', 'boom')).not_to raise_error
119
- expect(authentication_string('1.1', nil)).not_to raise_error
120
- end
121
-
122
- it "should return an authentication string given a socket id and custom args" do
123
- auth = @channel.authentication_string('1.1', 'foobar')
124
-
125
- expect(auth).to eq("12345678900000001:#{hmac(@client.secret, "1.1:test_channel:foobar")}")
126
- end
127
- end
128
- end
129
-
130
- describe '#authenticate' do
131
- before :each do
132
- @custom_data = {:uid => 123, :info => {:name => 'Foo'}}
133
- end
134
-
135
- it 'should return a hash with signature including custom data and data as json string' do
136
- allow(MultiJson).to receive(:encode).with(@custom_data).and_return 'a json string'
137
-
138
- response = @channel.authenticate('1.1', @custom_data)
139
-
140
- expect(response).to eq({
141
- :auth => "12345678900000001:#{hmac(@client.secret, "1.1:test_channel:a json string")}",
142
- :channel_data => 'a json string'
143
- })
144
- end
145
-
146
- it 'should fail on invalid socket_ids' do
147
- expect {
148
- @channel.authenticate('1.1:')
149
- }.to raise_error Pusher::Error
150
-
151
- expect {
152
- @channel.authenticate('1.1foo', 'channel')
153
- }.to raise_error Pusher::Error
154
-
155
- expect {
156
- @channel.authenticate(':1.1')
157
- }.to raise_error Pusher::Error
158
-
159
- expect {
160
- @channel.authenticate('foo1.1', 'channel')
161
- }.to raise_error Pusher::Error
162
-
163
- expect {
164
- @channel.authenticate('foo', 'channel')
165
- }.to raise_error Pusher::Error
166
- end
167
- end
168
- end