rhosync 2.1.17.beta4 → 2.1.17.beta5
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.
- data/CHANGELOG +1 -0
- data/lib/rhosync/jobs/ping_job.rb +2 -1
- data/lib/rhosync/ping/android.rb +9 -1
- data/lib/rhosync/version.rb +1 -1
- data/spec/jobs/ping_job_spec.rb +9 -8
- metadata +3 -3
data/CHANGELOG
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
## 2.1.17 (not yet released)
|
|
2
|
+
* Reset device attributes if Android ping returns "Not Registered" Error
|
|
2
3
|
* #29214293 - do not execute ping if the platform is not configured
|
|
3
4
|
* Refactor server middleware. Remove explicit rack dependency. Fix broken rspec examples.
|
|
4
5
|
* Fixing error with recursive loading of application.rb in ruby-1.8.7 and ree
|
|
@@ -27,7 +27,8 @@ module Rhosync
|
|
|
27
27
|
user = User.load(user_id)
|
|
28
28
|
user.clients.members.each do |client_id|
|
|
29
29
|
client = Client.load(client_id,{:source_name => '*'})
|
|
30
|
-
params.merge!('device_port' => client.device_port, 'device_pin' => client.device_pin, 'phone_id' => client.phone_id
|
|
30
|
+
params.merge!('device_port' => client.device_port, 'device_pin' => client.device_pin, 'phone_id' => client.phone_id,
|
|
31
|
+
'client_id' => client_id)
|
|
31
32
|
send_push = false
|
|
32
33
|
if client.device_type and client.device_type.size > 0
|
|
33
34
|
if client.phone_id and client.phone_id.size > 0
|
data/lib/rhosync/ping/android.rb
CHANGED
|
@@ -26,7 +26,15 @@ module Rhosync
|
|
|
26
26
|
)
|
|
27
27
|
# body will contain the exception class
|
|
28
28
|
elsif response.body =~ /^Error=(.*)$/
|
|
29
|
-
|
|
29
|
+
err = $1
|
|
30
|
+
if err =~ /NotRegistered/
|
|
31
|
+
client = Client.load(params['client_id'],{:source_name => '*'})
|
|
32
|
+
client.phone_id = nil
|
|
33
|
+
client.device_pin = nil
|
|
34
|
+
client.device_port = nil
|
|
35
|
+
else
|
|
36
|
+
raise AndroidPingError.new("Android ping error: #{err || ''}")
|
|
37
|
+
end
|
|
30
38
|
else
|
|
31
39
|
response.return!(request, result, &block)
|
|
32
40
|
end
|
data/lib/rhosync/version.rb
CHANGED
data/spec/jobs/ping_job_spec.rb
CHANGED
|
@@ -24,7 +24,7 @@ describe "PingJob" do
|
|
|
24
24
|
"sources" => [@s.name], "message" => 'hello world',
|
|
25
25
|
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3', "phone_id" => nil}
|
|
26
26
|
Apple.should_receive(:ping).once.with({'device_pin' => @c.device_pin,
|
|
27
|
-
'device_port' => @c.device_port}.merge!(params))
|
|
27
|
+
'device_port' => @c.device_port, 'client_id' => @c.id}.merge!(params))
|
|
28
28
|
PingJob.perform(params)
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ describe "PingJob" do
|
|
|
34
34
|
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3', "phone_id" => nil}
|
|
35
35
|
@c.device_type = 'blackberry'
|
|
36
36
|
Blackberry.should_receive(:ping).once.with({'device_pin' => @c.device_pin,
|
|
37
|
-
'device_port' => @c.device_port}.merge!(params))
|
|
37
|
+
'device_port' => @c.device_port, 'client_id' => @c.id}.merge!(params))
|
|
38
38
|
PingJob.perform(params)
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -66,8 +66,9 @@ describe "PingJob" do
|
|
|
66
66
|
@c1 = Client.create(@c_fields,{:source_name => @s_fields[:name]})
|
|
67
67
|
# and yet another one ...
|
|
68
68
|
@c2 = Client.create(@c_fields,{:source_name => @s_fields[:name]})
|
|
69
|
-
|
|
70
|
-
Apple.
|
|
69
|
+
|
|
70
|
+
Rhosync::Apple.stub!(:get_config).and_return({:test => {:iphonecertfile=>"none"}})
|
|
71
|
+
#Apple.should_receive(:ping).with({'device_pin' => @c.device_pin, 'device_port' => @c.device_port, 'client_id' => @c.id}.merge!(params))
|
|
71
72
|
PingJob.should_receive(:log).twice.with(/Dropping ping request for client/)
|
|
72
73
|
lambda { PingJob.perform(params) }.should_not raise_error
|
|
73
74
|
end
|
|
@@ -82,8 +83,8 @@ describe "PingJob" do
|
|
|
82
83
|
@c1 = Client.create(@c_fields,{:source_name => @s_fields[:name]})
|
|
83
84
|
# yet another...
|
|
84
85
|
@c2 = Client.create(@c_fields,{:source_name => @s_fields[:name]})
|
|
85
|
-
|
|
86
|
-
Apple.should_receive(:ping).with({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port}.merge!(params))
|
|
86
|
+
Rhosync::Apple.stub!(:get_config).and_return({:test => {:iphonecertfile=>"none"}})
|
|
87
|
+
#Apple.should_receive(:ping).with({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port, 'client_id' => @c.id}.merge!(params))
|
|
87
88
|
PingJob.should_receive(:log).twice.with(/Dropping ping request for client/)
|
|
88
89
|
lambda { PingJob.perform(params) }.should_not raise_error
|
|
89
90
|
end
|
|
@@ -98,8 +99,8 @@ describe "PingJob" do
|
|
|
98
99
|
scrubbed_params['vibrate'] = '5'
|
|
99
100
|
@c1.device_type = 'blackberry'
|
|
100
101
|
|
|
101
|
-
Apple.should_receive(:ping).with(params.merge!({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port})).and_return { raise SocketError.new("Socket failure") }
|
|
102
|
-
Blackberry.should_receive(:ping).with({'device_pin' => @c1.device_pin, 'device_port' => @c1.device_port}.merge!(scrubbed_params))
|
|
102
|
+
Apple.should_receive(:ping).with(params.merge!({'device_pin' => @c.device_pin, 'phone_id' => @c.phone_id, 'device_port' => @c.device_port,'client_id' => @c.id})).and_return { raise SocketError.new("Socket failure") }
|
|
103
|
+
Blackberry.should_receive(:ping).with({'device_pin' => @c1.device_pin, 'device_port' => @c1.device_port, 'client_id' => @c1.id}.merge!(scrubbed_params))
|
|
103
104
|
exception_raised = false
|
|
104
105
|
begin
|
|
105
106
|
PingJob.perform(params)
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rhosync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 62196337
|
|
5
5
|
prerelease: 7
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
8
|
- 1
|
|
9
9
|
- 17
|
|
10
10
|
- beta
|
|
11
|
-
-
|
|
12
|
-
version: 2.1.17.
|
|
11
|
+
- 5
|
|
12
|
+
version: 2.1.17.beta5
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Rhomobile
|