urbanairship 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/urbanairship.rb +4 -2
- data/spec/urbanairship_spec.rb +7 -7
- metadata +2 -2
data/lib/urbanairship.rb
CHANGED
@@ -80,11 +80,13 @@ module Urbanairship
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def tag_device(params)
|
83
|
-
|
83
|
+
provider_field = ( (params[:provider] || @provider) == :android ) || ( (params[:provider] || @provider) == 'android' ) ? :apids : :device_tokens
|
84
|
+
do_request(:post, "/api/tags/#{params[:tag]}", :body => {provider_field => {:add => [params[:device_token]]}}.to_json, :authenticate_with => :master_secret)
|
84
85
|
end
|
85
86
|
|
86
87
|
def untag_device(params)
|
87
|
-
|
88
|
+
provider_field = ( (params[:provider] || @provider) == :android ) || ( (params[:provider] || @provider) == 'android' ) ? :apids : :device_tokens
|
89
|
+
do_request(:post, "/api/tags/#{params[:tag]}", :body => {provider_field => {:remove => [params[:device_token]]}}.to_json, :authenticate_with => :master_secret)
|
88
90
|
end
|
89
91
|
|
90
92
|
def device_tokens_count
|
data/spec/urbanairship_spec.rb
CHANGED
@@ -58,14 +58,14 @@ shared_examples_for "an Urbanairship client" do
|
|
58
58
|
FakeWeb.register_uri(:get, /my_app_key2\:my_master_secret2\@go\.urbanairship.com\/api\/device_tokens\/a_device_token\/tags/, :status => ["500", "Internal Server Error"])
|
59
59
|
|
60
60
|
##tag_device
|
61
|
-
FakeWeb.register_uri(:
|
62
|
-
FakeWeb.register_uri(:
|
63
|
-
FakeWeb.register_uri(:
|
61
|
+
FakeWeb.register_uri(:post, /my_app_key\:my_master_secret\@go\.urbanairship.com\/api\/tags\/new_tag/, :status => ["201", "OK"], :body => '{"device_tokens":{"add":["valid_device_token"]}')
|
62
|
+
FakeWeb.register_uri(:post, /my_app_key\:my_master_secret\@go\.urbanairship.com\/api\/tags\/existing_tag/, :status => ["200", "OK"], :body => '{"device_tokens":{"add":["valid_device_token"]}')
|
63
|
+
FakeWeb.register_uri(:post, /my_app_key2\:my_master_secret2\@go\.urbanairship.com\/api\/tags\/a_tag/, :status => ["500", "Internal Server Error"], :body => '{"device_tokens":{"add":["a_device_token"]}')
|
64
64
|
|
65
65
|
#untag_device
|
66
|
-
FakeWeb.register_uri(:
|
67
|
-
FakeWeb.register_uri(:
|
68
|
-
FakeWeb.register_uri(:
|
66
|
+
FakeWeb.register_uri(:post, /my_app_key\:my_master_secret\@go\.urbanairship.com\/api\/tags\/existing_tag/, :status => ["204", "OK"], :body => '{"device_tokens":{"remove":["valid_device_token"]}')
|
67
|
+
FakeWeb.register_uri(:post, /my_app_key\:my_master_secret\@go\.urbanairship.com\/api\/tags\/non_existant_tag/, :status => ["404", "OK"], :body => '{"device_tokens":{"remove":["valid_device_token"]}')
|
68
|
+
FakeWeb.register_uri(:post, /my_app_key2\:my_master_secret2\@go\.urbanairship.com\/api\/tags\/a_tag/, :status => ["500", "Internal Server Error"], :body => '{"device_tokens":{"remove":["a_device_token"]}')
|
69
69
|
|
70
70
|
#Get Segment
|
71
71
|
FakeWeb.register_uri(:get, /my_app_key\:my_master_secret\@go\.urbanairship.com\/api\/segments\/valid_id/, :status => ["200", "OK"], :body => '{"display_name":"Male in NY", "criteria":{"and":[{"tag":"male"}, {"tag":"in NY"}]}}')
|
@@ -302,7 +302,7 @@ shared_examples_for "an Urbanairship client" do
|
|
302
302
|
|
303
303
|
it "adds a valid device token to an existing tag" do
|
304
304
|
response = subject.tag_device({:device_token => 'valid_device_token', :tag => 'existing_tag'})
|
305
|
-
response.code.should == "
|
305
|
+
response.code.should == "204"
|
306
306
|
response.success?.should == true
|
307
307
|
end
|
308
308
|
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.3
|
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-06-
|
12
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|