Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #17 from thrillcall/master

Support Urbanairship.unregister_device for Android with :provider => :android
  • Loading branch information...
commit a2d58453f973edf0aa99f5a0f62e6ba98d61d20b 2 parents 6e4456b + e3abb83
@joeyschoblaska joeyschoblaska authored
Showing with 19 additions and 2 deletions.
  1. +6 −2 lib/urbanairship.rb
  2. +13 −0 spec/urbanairship_spec.rb
View
8 lib/urbanairship.rb
@@ -26,8 +26,12 @@ def register_device(device_token, options = {})
end
end
- def unregister_device(device_token)
- do_request(:delete, "/api/device_tokens/#{device_token}", :authenticate_with => :application_secret)
+ def unregister_device(device_token, options = {})
+ if (options[:provider] || @provider) == :android
+ do_request(:delete, "/api/apids/#{device_token}", :authenticate_with => :application_secret)
+ else
+ do_request(:delete, "/api/device_tokens/#{device_token}", :authenticate_with => :application_secret)
+ end
end
def delete_scheduled_push(param)
View
13 spec/urbanairship_spec.rb
@@ -162,6 +162,19 @@
Urbanairship.application_key = "bad_key"
Urbanairship.unregister_device("key_to_delete").success?.should == false
end
+
+ it "uses the android interface if 'provider' configuration option is set to :android" do
+ Urbanairship.provider = :android
+ Urbanairship.unregister_device("new_device_token")
+ FakeWeb.last_request.path.should == "/api/apids/new_device_token"
+ Urbanairship.provider = nil
+ end
+
+ it "uses the android interface if 'provider' option is passed as :android" do
+ Urbanairship.unregister_device("new_device_token", :provider => :android)
+ FakeWeb.last_request.path.should == "/api/apids/new_device_token"
+ end
+
end
describe "::delete_scheduled_push" do
Please sign in to comment.
Something went wrong with that request. Please try again.