push_to_devices 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/push_to_devices.rb +3 -3
- data/push_to_devices.gemspec +1 -1
- data/spec/push_to_device/push_to_device_spec.rb +6 -6
- data/spec/spec_helper.rb +1 -1
- metadata +1 -1
data/lib/push_to_devices.rb
CHANGED
@@ -29,7 +29,7 @@ module PushToDevices
|
|
29
29
|
@@client_secret = ""
|
30
30
|
|
31
31
|
mattr_accessor :user_agent
|
32
|
-
@@user_agent = "
|
32
|
+
@@user_agent = "PushToDevices RB #{PushToDevices::Config::VERSION}"
|
33
33
|
|
34
34
|
mattr_accessor :use_ssl
|
35
35
|
@@use_ssl = true
|
@@ -41,7 +41,7 @@ module PushToDevices
|
|
41
41
|
@@api_host = ""
|
42
42
|
|
43
43
|
mattr_accessor :client_info
|
44
|
-
@@client_info = {version:
|
44
|
+
@@client_info = {version: PushToDevices::Config::VERSION}
|
45
45
|
|
46
46
|
def self.configure
|
47
47
|
yield self if block_given?
|
@@ -131,7 +131,7 @@ module PushToDevices
|
|
131
131
|
|
132
132
|
def self.handle_response(response)
|
133
133
|
if response.code.to_i != 200
|
134
|
-
raise
|
134
|
+
raise PushToDevices::Exception.new(response.code, response.body)
|
135
135
|
else
|
136
136
|
response.body
|
137
137
|
end
|
data/push_to_devices.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe PushToDevices do
|
4
4
|
|
5
5
|
before(:all) do
|
6
|
-
|
6
|
+
PushToDevices::API.configure do |config|
|
7
7
|
config.api_host = "nowhere.com"
|
8
8
|
config.client_id = "fakeclientid"
|
9
9
|
config.client_secret = "fakeclientsecret"
|
@@ -14,7 +14,7 @@ describe PushToDevice do
|
|
14
14
|
describe ".get_service_info" do
|
15
15
|
|
16
16
|
it "should make a request to the proper endpoint" do
|
17
|
-
|
17
|
+
PushToDevices::API.get_service_info
|
18
18
|
a_request(:get, "http://nowhere.com/services/me").should have_been_made
|
19
19
|
end
|
20
20
|
|
@@ -28,7 +28,7 @@ describe PushToDevice do
|
|
28
28
|
ios_specific_fields: {text: "ios"},
|
29
29
|
android_specific_fields: {text: "android"}
|
30
30
|
}
|
31
|
-
|
31
|
+
PushToDevices::API.post_notification_to_user(unique_hash: unique_hash, notification_data: notification_data)
|
32
32
|
a_request(:post, "http://nowhere.com/users/#{unique_hash}/notifications").with(body: notification_data.to_json).should have_been_made
|
33
33
|
end
|
34
34
|
end
|
@@ -41,7 +41,7 @@ describe PushToDevice do
|
|
41
41
|
ios_specific_fields: {text: "ios"},
|
42
42
|
android_specific_fields: {text: "android"}
|
43
43
|
}
|
44
|
-
|
44
|
+
PushToDevices::API.post_notification_to_users(unique_hashes: unique_hashes, notification_data: notification_data)
|
45
45
|
a_request(:post, "http://nowhere.com/users/notifications").with(body: {unique_hashes: unique_hashes, notification_data: notification_data}.to_json).should have_been_made
|
46
46
|
end
|
47
47
|
end
|
@@ -54,7 +54,7 @@ describe PushToDevice do
|
|
54
54
|
apn_device_token: "an apple ios device token",
|
55
55
|
gcm_registration_id: "gcm_registration_id"
|
56
56
|
}
|
57
|
-
|
57
|
+
PushToDevices::API.register_user_for_push(data)
|
58
58
|
a_request(:post, "http://nowhere.com/users/").with(body: data.to_json).should have_been_made
|
59
59
|
end
|
60
60
|
end
|
data/spec/spec_helper.rb
CHANGED