urbanairship 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/urbanairship.rb CHANGED
@@ -26,8 +26,12 @@ module Urbanairship
26
26
  end
27
27
  end
28
28
 
29
- def unregister_device(device_token)
30
- do_request(:delete, "/api/device_tokens/#{device_token}", :authenticate_with => :application_secret)
29
+ def unregister_device(device_token, options = {})
30
+ if (options[:provider] || @provider) == :android
31
+ do_request(:delete, "/api/apids/#{device_token}", :authenticate_with => :application_secret)
32
+ else
33
+ do_request(:delete, "/api/device_tokens/#{device_token}", :authenticate_with => :application_secret)
34
+ end
31
35
  end
32
36
 
33
37
  def delete_scheduled_push(param)
@@ -162,6 +162,19 @@ describe Urbanairship do
162
162
  Urbanairship.application_key = "bad_key"
163
163
  Urbanairship.unregister_device("key_to_delete").success?.should == false
164
164
  end
165
+
166
+ it "uses the android interface if 'provider' configuration option is set to :android" do
167
+ Urbanairship.provider = :android
168
+ Urbanairship.unregister_device("new_device_token")
169
+ FakeWeb.last_request.path.should == "/api/apids/new_device_token"
170
+ Urbanairship.provider = nil
171
+ end
172
+
173
+ it "uses the android interface if 'provider' option is passed as :android" do
174
+ Urbanairship.unregister_device("new_device_token", :provider => :android)
175
+ FakeWeb.last_request.path.should == "/api/apids/new_device_token"
176
+ end
177
+
165
178
  end
166
179
 
167
180
  describe "::delete_scheduled_push" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanairship
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-24 00:00:00.000000000 Z
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70194940674580 !ruby/object:Gem::Requirement
16
+ requirement: &70132667901780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70194940674580
24
+ version_requirements: *70132667901780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70194940673940 !ruby/object:Gem::Requirement
27
+ requirement: &70132667901340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70194940673940
35
+ version_requirements: *70132667901340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fakeweb
38
- requirement: &70194940673400 !ruby/object:Gem::Requirement
38
+ requirement: &70132667900900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70194940673400
46
+ version_requirements: *70132667900900
47
47
  description: Urbanairship is a Ruby library for interacting with the Urban Airship
48
48
  (http://urbanairship.com) API.
49
49
  email: