one_signal 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/one_signal/one_signal.rb +1 -1
- data/lib/one_signal/player.rb +17 -0
- data/lib/one_signal/version.rb +1 -1
- data/test/player_test.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d306861e939ddadfc481255bf7b6b0a48e5609d9
|
4
|
+
data.tar.gz: fa4d15b44f8d10852301f9c343945424bed53bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 217aa88bdb6f379ac51135eee076f315f95f969db2857a788723bac0239c2ab858186877a0189b14f6325d333c5f3a0040d439266243445dd92bd2aa673724a6
|
7
|
+
data.tar.gz: 2bc98fb95a36c8ce46b88039a01e7b8baf98ed6a080b796661dee9789474ec0f41c6402ddfc434258b552d09d70e4ce7b4193d7c8518b267cdf613f62ea4e97b
|
@@ -69,7 +69,7 @@ module OneSignal
|
|
69
69
|
def self.send_get_request(uri:, params: {})
|
70
70
|
ensure_api_key
|
71
71
|
|
72
|
-
uri.query = URI.encode_www_form(params)
|
72
|
+
uri.query = URI.encode_www_form(params) unless params.nil?
|
73
73
|
request = Net::HTTP::Get.new(uri.request_uri)
|
74
74
|
request = request_with_headers(request: request)
|
75
75
|
|
data/lib/one_signal/player.rb
CHANGED
@@ -34,6 +34,23 @@ module OneSignal
|
|
34
34
|
return response
|
35
35
|
end
|
36
36
|
|
37
|
+
def self.get(id:)
|
38
|
+
uri_string = @@base_uri
|
39
|
+
uri_string += "/players"
|
40
|
+
uri_string += "/#{id}"
|
41
|
+
uri = URI.parse(uri_string)
|
42
|
+
|
43
|
+
response = send_get_request(uri: uri, params: nil)
|
44
|
+
|
45
|
+
ensure_http_status(response: response,
|
46
|
+
status: '200',
|
47
|
+
method_name: 'Get',
|
48
|
+
uri: uri,
|
49
|
+
params: nil)
|
50
|
+
|
51
|
+
return response
|
52
|
+
end
|
53
|
+
|
37
54
|
def self.create(params: {})
|
38
55
|
uri_string = @@base_uri
|
39
56
|
uri_string += "/players"
|
data/lib/one_signal/version.rb
CHANGED
data/test/player_test.rb
CHANGED
@@ -7,8 +7,9 @@ class PlayerTest < MiniTest::Test
|
|
7
7
|
@create_uri = URI.parse(base_url)
|
8
8
|
@csv_export_uri = URI.parse(base_url + "/csv_export")
|
9
9
|
@all_uri = URI.parse(base_url)
|
10
|
-
|
11
10
|
@player_id = "fake-id-123"
|
11
|
+
@get_uri = URI.parse(base_url + "/#{@player_id}")
|
12
|
+
|
12
13
|
@update_uri = URI.parse(base_url + "/#{@player_id}")
|
13
14
|
|
14
15
|
@params = {
|
@@ -46,6 +47,14 @@ class PlayerTest < MiniTest::Test
|
|
46
47
|
assert_equal response, OneSignal::Player.all(params: @params)
|
47
48
|
end
|
48
49
|
|
50
|
+
def test_get
|
51
|
+
response = mock_response_ok
|
52
|
+
OneSignal::OneSignal.expects(:send_get_request)
|
53
|
+
.with(uri: @get_uri, params: nil)
|
54
|
+
.returns(response)
|
55
|
+
assert_equal response, OneSignal::Player.get(id: @player_id)
|
56
|
+
end
|
57
|
+
|
49
58
|
def test_create
|
50
59
|
response = mock_response_ok
|
51
60
|
OneSignal::OneSignal.expects(:send_post_request)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_signal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Balthazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|