urbanairship 2.3.1 → 2.3.2
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/lib/urbanairship.rb +2 -2
- data/spec/urbanairship_spec.rb +30 -5
- metadata +2 -2
data/lib/urbanairship.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Urbanairship
|
|
|
19
19
|
def register_device(device_token, options = {})
|
|
20
20
|
body = parse_register_options(options).to_json
|
|
21
21
|
|
|
22
|
-
if (options[:provider] || @provider) == :android
|
|
22
|
+
if ( (options[:provider] || @provider) == :android ) || ( (options[:provider] || @provider) == 'android' )
|
|
23
23
|
do_request(:put, "/api/apids/#{device_token}", :body => body, :authenticate_with => :application_secret)
|
|
24
24
|
else
|
|
25
25
|
do_request(:put, "/api/device_tokens/#{device_token}", :body => body, :authenticate_with => :application_secret)
|
|
@@ -27,7 +27,7 @@ module Urbanairship
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def unregister_device(device_token, options = {})
|
|
30
|
-
if (options[:provider] || @provider) == :android
|
|
30
|
+
if ( (options[:provider] || @provider) == :android ) || ( (options[:provider] || @provider) == 'android' )
|
|
31
31
|
do_request(:delete, "/api/apids/#{device_token}", :authenticate_with => :application_secret)
|
|
32
32
|
else
|
|
33
33
|
do_request(:delete, "/api/device_tokens/#{device_token}", :authenticate_with => :application_secret)
|
data/spec/urbanairship_spec.rb
CHANGED
|
@@ -398,17 +398,30 @@ shared_examples_for "an Urbanairship client" do
|
|
|
398
398
|
FakeWeb.last_request.path.should == "/api/device_tokens/new_device_token"
|
|
399
399
|
end
|
|
400
400
|
|
|
401
|
-
it "uses the android interface if 'provider' configuration option is set to :android" do
|
|
401
|
+
it "uses the android interface if 'provider' configuration option is set to :android Symbol" do
|
|
402
402
|
subject.provider = :android
|
|
403
403
|
subject.register_device("new_device_token")
|
|
404
404
|
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
405
405
|
subject.provider = nil
|
|
406
406
|
end
|
|
407
407
|
|
|
408
|
-
it "uses the android interface if 'provider' option is
|
|
408
|
+
it "uses the android interface if 'provider' configuration option is set to 'android' String" do
|
|
409
|
+
subject.provider = 'android'
|
|
410
|
+
subject.register_device("new_device_token")
|
|
411
|
+
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
412
|
+
subject.provider = nil
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
it "uses the android interface if :provider Symbol key is passed an :android Symbol value" do
|
|
409
416
|
subject.register_device("new_device_token", :provider => :android)
|
|
410
417
|
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
411
418
|
end
|
|
419
|
+
|
|
420
|
+
it "uses the android interface if 'provider' Symbol key is passed an 'android' String value" do
|
|
421
|
+
subject.register_device("new_device_token", :provider => "android")
|
|
422
|
+
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
423
|
+
end
|
|
424
|
+
|
|
412
425
|
end
|
|
413
426
|
|
|
414
427
|
describe "::unregister_device" do
|
|
@@ -446,18 +459,30 @@ shared_examples_for "an Urbanairship client" do
|
|
|
446
459
|
subject.unregister_device("key_to_delete").success?.should == false
|
|
447
460
|
end
|
|
448
461
|
|
|
449
|
-
it "uses the android interface if 'provider' configuration option is set to :android" do
|
|
462
|
+
it "uses the android interface if 'provider' configuration option is set to :android Symbol" do
|
|
450
463
|
subject.provider = :android
|
|
451
464
|
subject.unregister_device("new_device_token")
|
|
452
465
|
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
453
466
|
subject.provider = nil
|
|
454
467
|
end
|
|
455
468
|
|
|
456
|
-
it "uses the android interface if 'provider' option is
|
|
469
|
+
it "uses the android interface if 'provider' configuration option is set to 'android' String" do
|
|
470
|
+
subject.provider = 'android'
|
|
471
|
+
subject.unregister_device("new_device_token")
|
|
472
|
+
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
473
|
+
subject.provider = nil
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
it "uses the android interface if :provider Symbol key is passed with an :android Symbol value" do
|
|
457
477
|
subject.unregister_device("new_device_token", :provider => :android)
|
|
458
478
|
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
459
479
|
end
|
|
460
480
|
|
|
481
|
+
it "uses the android interface if :provider Symbol key is passed with an 'android' String value" do
|
|
482
|
+
subject.unregister_device("new_device_token", :provider => "android")
|
|
483
|
+
FakeWeb.last_request.path.should == "/api/apids/new_device_token"
|
|
484
|
+
end
|
|
485
|
+
|
|
461
486
|
end
|
|
462
487
|
|
|
463
488
|
describe "::delete_scheduled_push" do
|
|
@@ -553,7 +578,7 @@ shared_examples_for "an Urbanairship client" do
|
|
|
553
578
|
subject.push.success?.should == false
|
|
554
579
|
end
|
|
555
580
|
|
|
556
|
-
it "converts aliases to
|
|
581
|
+
it "converts aliases to strings" do
|
|
557
582
|
subject.push(@valid_params.merge(:aliases => [:one, 2]))
|
|
558
583
|
request_json['aliases'].should == ['one', '2']
|
|
559
584
|
end
|
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.3.
|
|
4
|
+
version: 2.3.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: json
|