pusher-platform 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ca349821245fb8e48f6850ee355ba340cb6a50e
4
- data.tar.gz: c38eb23d05d86c36dbfb5c4b5c87ffd404496567
3
+ metadata.gz: b90cf99d8d3d1e3adff8b2d2f8e1fdbfeb2ec8d9
4
+ data.tar.gz: 1990850aafa0f6306e9ecc3237333a6a68fbe9d8
5
5
  SHA512:
6
- metadata.gz: 1b5f0b3d832c5a58e74d1b345a702b064f3cc6b3314bc6934aa9de34debdb846e06e3eb82339c29ebdd625e21dbc37d30245290313f080ff75eef7854324c096
7
- data.tar.gz: e851d610572f75421222e683821f1bd32ade3222ee1c7f67056d9c22cbd2f01e6d36e97cdd8f6c414ab442139d143a5e69bbc8ad92fa6d231c4acaa4988ff0a5
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: "services/#{@service_name}/#{@service_version}/#{@instance_id}/#{options[:path]}",
36
+ path: sanitise_path(path),
34
37
  headers: headers,
35
- body: options[: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.1
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-18 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon