zero_push 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zero_push (2.2.0)
4
+ zero_push (2.3.0)
5
5
  faraday (~> 0.8.5)
6
6
  faraday_middleware (~> 0.9.0)
7
7
 
@@ -66,8 +66,10 @@ module ZeroPush
66
66
  #
67
67
  # Ex.
68
68
  # {"message":"ok"}
69
- def register(device_token)
70
- client.post('/register', device_token: device_token)
69
+ def register(device_token, channel=nil)
70
+ params = {device_token: device_token}
71
+ params.merge!(channel: channel) unless channel.nil?
72
+ client.post('/register', params)
71
73
  end
72
74
 
73
75
  # Sets the badge for a particular device
@@ -1,3 +1,3 @@
1
1
  module ZeroPush
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
data/lib/zero_push.rb CHANGED
@@ -26,8 +26,8 @@ module ZeroPush
26
26
  client.unsubscribe(device_token, channel)
27
27
  end
28
28
 
29
- def register(device_token)
30
- client.register(device_token)
29
+ def register(device_token, channel=nil)
30
+ client.register(device_token, channel)
31
31
  end
32
32
 
33
33
  def set_badge(device_token, badge)
@@ -54,4 +54,53 @@ http_interactions:
54
54
  string: ! '{"message":"ok"}'
55
55
  http_version:
56
56
  recorded_at: Thu, 08 Aug 2013 23:50:39 GMT
57
+ - request:
58
+ method: post
59
+ uri: https://api.zeropush.com/register
60
+ body:
61
+ encoding: US-ASCII
62
+ string: device_token=abc&channel=foo
63
+ headers:
64
+ Authorization:
65
+ - Token token="test_token"
66
+ User-Agent:
67
+ - Faraday v0.8.9
68
+ Content-Type:
69
+ - application/x-www-form-urlencoded
70
+ response:
71
+ status:
72
+ code: 200
73
+ message:
74
+ headers:
75
+ server:
76
+ - nginx
77
+ date:
78
+ - Fri, 21 Mar 2014 04:38:14 GMT
79
+ content-type:
80
+ - application/json; charset=utf-8
81
+ transfer-encoding:
82
+ - chunked
83
+ connection:
84
+ - close
85
+ status:
86
+ - 200 OK
87
+ strict-transport-security:
88
+ - max-age=31536000
89
+ x-frame-options:
90
+ - SAMEORIGIN
91
+ x-xss-protection:
92
+ - 1; mode=block
93
+ x-content-type-options:
94
+ - nosniff
95
+ x-ua-compatible:
96
+ - chrome=1
97
+ cache-control:
98
+ - no-cache
99
+ x-request-id:
100
+ - 1eb2b29a-00f7-4554-80f3-63aaafbd04ee
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ! '{"message":"ok"}'
104
+ http_version:
105
+ recorded_at: Fri, 21 Mar 2014 04:38:18 GMT
57
106
  recorded_with: VCR 2.4.0
@@ -54,14 +54,24 @@ describe ZeroPush::Client do
54
54
  VCR.eject_cassette
55
55
  end
56
56
 
57
- let(:response){client.register('abc')}
57
+ describe 'without a channel parameter' do
58
+ it 'should return a hash' do
59
+ client.register('abc').body.class.must_equal Hash
60
+ end
58
61
 
59
- it 'should return a hash' do
60
- response.body.class.must_equal Hash
62
+ it 'should register the device' do
63
+ client.register('abc').body['message'].must_equal 'ok'
64
+ end
61
65
  end
62
66
 
63
- it 'should register the device' do
64
- response.body['message'].must_equal 'ok'
67
+ describe 'with a channel parameter' do
68
+ it 'should return a hash' do
69
+ client.register('abc', 'foo').body.class.must_equal Hash
70
+ end
71
+
72
+ it 'should register the device' do
73
+ client.register('abc', 'foo').body['message'].must_equal 'ok'
74
+ end
65
75
  end
66
76
  end
67
77
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zero_push
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: