urbanairship 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/urbanairship.rb +9 -2
- data/spec/urbanairship_spec.rb +2 -2
- metadata +10 -24
data/lib/urbanairship.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'net/https'
|
3
3
|
require 'time'
|
4
|
-
require 'system_timer'
|
5
4
|
|
6
5
|
module Urbanairship
|
6
|
+
begin
|
7
|
+
require 'system_timer'
|
8
|
+
Timer = SystemTimer
|
9
|
+
rescue LoadError
|
10
|
+
require 'timeout'
|
11
|
+
Timer = Timeout
|
12
|
+
end
|
13
|
+
|
7
14
|
VALID_PUSH_PARAMS = %w(device_tokens aliases tags schedule_for exclude_tokens aps)
|
8
15
|
|
9
16
|
class << self
|
@@ -54,7 +61,7 @@ module Urbanairship
|
|
54
61
|
|
55
62
|
yield(request) if block_given?
|
56
63
|
|
57
|
-
|
64
|
+
Timer.timeout(request_timeout) do
|
58
65
|
start_time = Time.now
|
59
66
|
response = http_client.request(request)
|
60
67
|
log_request_and_response(request, response, Time.now - start_time)
|
data/spec/urbanairship_spec.rb
CHANGED
@@ -418,14 +418,14 @@ describe Urbanairship do
|
|
418
418
|
end
|
419
419
|
|
420
420
|
it "uses a default request_timeout value of five seconds" do
|
421
|
-
|
421
|
+
Urbanairship::Timer.should_receive(:timeout).with(5.0).and_raise(Timeout::Error)
|
422
422
|
@logger.should_receive(:error).with(/Urbanairship request timed out/)
|
423
423
|
|
424
424
|
Urbanairship.register_device('new_device_token')
|
425
425
|
end
|
426
426
|
|
427
427
|
it "accepts a configured request_timeout value" do
|
428
|
-
|
428
|
+
Urbanairship::Timer.should_receive(:timeout).with(1.23).and_raise(Timeout::Error)
|
429
429
|
@logger.should_receive(:error).with(/Urbanairship request timed out/)
|
430
430
|
|
431
431
|
Urbanairship.request_timeout = 1.23
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanairship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Groupon, Inc.
|
@@ -19,7 +19,7 @@ date: 2011-06-04 00:00:00 -05:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: json
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: rspec
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
version: "0"
|
47
|
-
type: :
|
47
|
+
type: :development
|
48
48
|
version_requirements: *id002
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: fakeweb
|
51
51
|
prerelease: false
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
@@ -60,20 +60,6 @@ dependencies:
|
|
60
60
|
version: "0"
|
61
61
|
type: :development
|
62
62
|
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: fakeweb
|
65
|
-
prerelease: false
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
type: :development
|
76
|
-
version_requirements: *id004
|
77
63
|
description: Urbanairship is a Ruby library for interacting with the Urbanairship (http://urbanairship.com) API.
|
78
64
|
email:
|
79
65
|
- rubygems@groupon.com
|
@@ -102,7 +88,7 @@ require_paths:
|
|
102
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
89
|
none: false
|
104
90
|
requirements:
|
105
|
-
- -
|
91
|
+
- - ">="
|
106
92
|
- !ruby/object:Gem::Version
|
107
93
|
hash: 59
|
108
94
|
segments:
|
@@ -122,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
108
|
requirements: []
|
123
109
|
|
124
110
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.6.0
|
126
112
|
signing_key:
|
127
113
|
specification_version: 3
|
128
114
|
summary: A Ruby wrapper for the Urbanairship API
|