pusher 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pusher/client.rb CHANGED
@@ -7,9 +7,9 @@ module Pusher
7
7
  # Initializes the client object.
8
8
  def initialize(options = {})
9
9
  options = {
10
- scheme: 'http',
11
- host: 'api.pusherapp.com',
12
- port: 80,
10
+ :scheme => 'http',
11
+ :host => 'api.pusherapp.com',
12
+ :port => 80,
13
13
  }.merge(options)
14
14
  @scheme, @host, @port, @app_id, @key, @secret = options.values_at(
15
15
  :scheme, :host, :port, :app_id, :key, :secret
data/pusher.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "pusher"
6
- s.version = "0.9.0"
6
+ s.version = "0.9.1"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Pusher"]
9
9
  s.email = ["support@pusher.com"]
data/spec/channel_spec.rb CHANGED
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Pusher::Channel do
4
4
  before do
5
- @client = Pusher::Client.new(
6
- app_id: '20',
7
- key: '12345678900000001',
8
- secret: '12345678900000001',
9
- host: 'api.pusherapp.com',
10
- port: 80,
11
- )
5
+ @client = Pusher::Client.new({
6
+ :app_id => '20',
7
+ :key => '12345678900000001',
8
+ :secret => '12345678900000001',
9
+ :host => 'api.pusherapp.com',
10
+ :port => 80,
11
+ })
12
12
  @client.encrypted = false
13
13
 
14
14
  WebMock.reset!
@@ -194,7 +194,7 @@ describe Pusher::Channel do
194
194
  it "should call the user_count api" do
195
195
  WebMock.stub_request(:get, @api_path).to_return({
196
196
  :status => 200,
197
- :body => JSON.generate(:user_count => 1)
197
+ :body => MultiJson.encode(:user_count => 1)
198
198
  })
199
199
  @channel = @client['presence-test_channel']
200
200
 
@@ -29,10 +29,10 @@ describe Pusher::WebHook do
29
29
 
30
30
  it "can be initialized with a hash" do
31
31
  request = {
32
- key: '1234',
33
- signature: 'asdf',
34
- content_type: 'application/json',
35
- body: MultiJson.encode(@hook_data),
32
+ :key => '1234',
33
+ :signature => 'asdf',
34
+ :content_type => 'application/json',
35
+ :body => MultiJson.encode(@hook_data),
36
36
  }
37
37
  wh = Pusher::WebHook.new(request)
38
38
  wh.key.should == '1234'
@@ -45,10 +45,10 @@ describe Pusher::WebHook do
45
45
  before :each do
46
46
  body = MultiJson.encode(@hook_data)
47
47
  request = {
48
- key: '1234',
49
- signature: HMAC::SHA256.hexdigest('asdf', body),
50
- content_type: 'application/json',
51
- body: body
48
+ :key => '1234',
49
+ :signature => HMAC::SHA256.hexdigest('asdf', body),
50
+ :content_type => 'application/json',
51
+ :body => body
52
52
  }
53
53
 
54
54
  @client = Pusher::Client.new
@@ -78,15 +78,15 @@ describe Pusher::WebHook do
78
78
  it "should validate with an extra token" do
79
79
  @client.key = '12345'
80
80
  @client.secret = 'xxx'
81
- @wh.valid?({key: '1234', secret: 'asdf'}).should be_true
81
+ @wh.valid?({:key => '1234', :secret => 'asdf'}).should be_true
82
82
  end
83
83
 
84
84
  it "should validate with an array of extra tokens" do
85
85
  @client.key = '123456'
86
86
  @client.secret = 'xxx'
87
87
  @wh.valid?([
88
- {key: '12345', secret: 'wtf'},
89
- {key: '1234', secret: 'asdf'}
88
+ {:key => '12345', :secret => 'wtf'},
89
+ {:key => '1234', :secret => 'asdf'}
90
90
  ]).should be_true
91
91
  end
92
92
 
@@ -94,14 +94,14 @@ describe Pusher::WebHook do
94
94
  @client.key = '123456'
95
95
  @client.secret = 'asdf'
96
96
  Pusher.logger.should_receive(:warn).with("Received webhook with unknown key: 1234")
97
- @wh.valid?({key: '12345', secret: 'asdf'}).should be_false
97
+ @wh.valid?({:key => '12345', :secret => 'asdf'}).should be_false
98
98
  end
99
99
 
100
100
  it "should not validate if secret is wrong with extra tokens" do
101
101
  @client.key = '123456'
102
102
  @client.secret = 'asdfxxx'
103
103
  Pusher.logger.should_receive(:warn).with(/Received WebHook with invalid signature/)
104
- @wh.valid?({key: '1234', secret: 'wtf'}).should be_false
104
+ @wh.valid?({:key => '1234', :secret => 'wtf'}).should be_false
105
105
  end
106
106
 
107
107
  it "should expose events" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70115752741600 !ruby/object:Gem::Requirement
16
+ requirement: &70337363184160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70115752741600
24
+ version_requirements: *70337363184160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ruby-hmac
27
- requirement: &70115752779060 !ruby/object:Gem::Requirement
27
+ requirement: &70337363195540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.4.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70115752779060
35
+ version_requirements: *70337363195540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: signature
38
- requirement: &70115752776600 !ruby/object:Gem::Requirement
38
+ requirement: &70337363193900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.1.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70115752776600
46
+ version_requirements: *70337363193900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70115752774560 !ruby/object:Gem::Requirement
49
+ requirement: &70337363191780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70115752774560
57
+ version_requirements: *70337363191780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &70115752772240 !ruby/object:Gem::Requirement
60
+ requirement: &70337363206020 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70115752772240
68
+ version_requirements: *70337363206020
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: em-http-request
71
- requirement: &70115752784600 !ruby/object:Gem::Requirement
71
+ requirement: &70337363201840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70115752784600
79
+ version_requirements: *70337363201840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &70115752779980 !ruby/object:Gem::Requirement
82
+ requirement: &70337363213540 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70115752779980
90
+ version_requirements: *70337363213540
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rack
93
- requirement: &70115752793240 !ruby/object:Gem::Requirement
93
+ requirement: &70337363210460 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70115752793240
101
+ version_requirements: *70337363210460
102
102
  description: Wrapper for pusher.com REST api
103
103
  email:
104
104
  - support@pusher.com