pusher-platform 0.4.1 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/pusher-platform/base_client.rb +11 -2
- data/lib/pusher-platform/instance.rb +0 -11
- 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: b90cf99d8d3d1e3adff8b2d2f8e1fdbfeb2ec8d9
|
4
|
+
data.tar.gz: 1990850aafa0f6306e9ecc3237333a6a68fbe9d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d12def58a19cd9c0e799f233217cb5dcbaab05a7242c2382e57625d00e8730c2e40f80903ef8ecf0e52cf99ed1c593a4267dc203997f5630b50ebcbaef2dfbc4
|
7
|
+
data.tar.gz: 6523d21ffbaeb34680828920b12c5e569da077bd2f759cf0444549c69f17f2267124b7ef97611edd2f80d1952ed88c7dc1ade95cc4778d567e911e6753773b2c
|
@@ -28,11 +28,14 @@ module Pusher
|
|
28
28
|
headers["Authorization"] = "Bearer #{options[:jwt]}"
|
29
29
|
end
|
30
30
|
|
31
|
+
path = "services/#{@service_name}/#{@service_version}/#{@instance_id}/#{options[:path]}"
|
32
|
+
body = options[:body].any? ? options[:body].to_json : nil
|
33
|
+
|
31
34
|
response = @connection.request(
|
32
35
|
method: options[:method],
|
33
|
-
path:
|
36
|
+
path: sanitise_path(path),
|
34
37
|
headers: headers,
|
35
|
-
body:
|
38
|
+
body: body,
|
36
39
|
)
|
37
40
|
|
38
41
|
if response.status >= 200 && response.status <= 299
|
@@ -50,5 +53,11 @@ module Pusher
|
|
50
53
|
raise "unsupported response code: #{response.status}"
|
51
54
|
end
|
52
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def sanitise_path(path)
|
60
|
+
path.gsub(/\/+/, "/").gsub(/\/+$/, "")
|
61
|
+
end
|
53
62
|
end
|
54
63
|
end
|
@@ -44,7 +44,6 @@ module Pusher
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def request(options)
|
47
|
-
options = scope_request_options(options)
|
48
47
|
if options[:jwt].nil?
|
49
48
|
options = options.merge(
|
50
49
|
{ jwt: @authenticator.generate_access_token({ su: true })[:token] }
|
@@ -60,15 +59,5 @@ module Pusher
|
|
60
59
|
def generate_access_token(options)
|
61
60
|
@authenticator.generate_access_token(options)
|
62
61
|
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def scope_request_options(options)
|
67
|
-
path = options[:path]
|
68
|
-
.gsub(/\/+/, "/")
|
69
|
-
.gsub(/\/+$/, "")
|
70
|
-
options.merge({ path: path })
|
71
|
-
end
|
72
|
-
|
73
62
|
end
|
74
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pusher-platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pusher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|