pling 0.3.0 → 0.3.1

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.
@@ -1,8 +1,15 @@
1
+ before_install:
2
+ - gem update --system
3
+ - gem --version
4
+ language: ruby
1
5
  rvm:
2
6
  - ruby-head
3
- - 1.9.2
7
+ - 1.9.3
4
8
  - 1.8.7
5
9
  - ree
6
10
  - jruby
7
- - rbx
8
- - rbx-2.0.0pre
11
+ - jruby-19mode
12
+ - rbx-19mode
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: ruby-head
@@ -25,14 +25,14 @@ module Pling
25
25
 
26
26
  ##
27
27
  # Creates a new instance of this class and establishes a connection to
28
- # Apple's Push Notification Service.
28
+ # Apple's Push Notification Service, retrieves a list of invalid device
29
+ # identifiers and then closes the connection, since Apple closes it on
30
+ # their side.
29
31
  #
30
- # The connection is only established once since Apple will ban you if
31
- # you reconnect each time you want to retrieve the list of invalid
32
- # device identifiers. For testing purposes, you should use Apple's
33
- # sandbox feedback service +feedback.sandbox.push.apple.com+. In order
34
- # to do this, you have to specify the optional +:host+ parameter when
35
- # creating instances of this class.
32
+ # For testing purposes, you should use Apple's sandbox feedback service
33
+ # +feedback.sandbox.push.apple.com+. In order to do this, you have to
34
+ # specify the optional +:host+ parameter when creating instances of this
35
+ # class.
36
36
  #
37
37
  # @param [Hash] configuration Parameters to control the connection configuration
38
38
  # @option configuration [#to_s] :certificate Path to PEM certificate file (Required)
@@ -63,6 +63,7 @@ module Pling
63
63
  time, length = line.unpack("Nn")
64
64
  tokens << line.unpack("x6H#{length << 1}").first
65
65
  end
66
+ connection.close
66
67
  tokens
67
68
  end
68
69
 
@@ -1,3 +1,3 @@
1
1
  module Pling
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -38,6 +38,12 @@ describe Pling::APN::Feedback do
38
38
 
39
39
  tokens.should be == [token_0, token_1]
40
40
  end
41
+
42
+ it "closes the connection after receiving all tokens" do
43
+ connection.should_receive(:close)
44
+
45
+ subject.get
46
+ end
41
47
 
42
48
  end
43
49
 
@@ -164,14 +164,16 @@ describe Pling::C2DM::Gateway do
164
164
  end
165
165
 
166
166
  it 'should raise a Pling::DeliveryFailed exception if the delivery was not successful' do
167
- connection_mock.should_receive(:post).and_return(push_response_mock)
167
+ connection_mock.should_receive(:post).with('https://android.apis.google.com/c2dm/send', anything, anything).
168
+ and_return(push_response_mock)
168
169
  push_response_mock.stub(:status => 401, :success? => false, :body => "Something went wrong")
169
170
 
170
171
  expect { subject.deliver(message, device) }.to raise_error Pling::DeliveryFailed, /Something went wrong/
171
172
  end
172
173
 
173
174
  it 'should raise a Pling::DeliveryFailed exception if the response body contained an error' do
174
- connection_mock.should_receive(:post).and_return(push_response_mock)
175
+ connection_mock.should_receive(:post).with('https://android.apis.google.com/c2dm/send', anything, anything).
176
+ and_return(push_response_mock)
175
177
  push_response_mock.stub(:status => 200, :success? => true, :body => "Error=SomeError")
176
178
 
177
179
  expect { subject.deliver(message, device) }.to raise_error Pling::DeliveryFailed, /Error=SomeError/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-10 00:00:00.000000000 Z
14
+ date: 2013-07-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  requirements: []
182
182
  rubyforge_project:
183
- rubygems_version: 1.8.24
183
+ rubygems_version: 1.8.25
184
184
  signing_key:
185
185
  specification_version: 3
186
186
  summary: Pling is a notification framework that supports multiple gateways