pusher-platform 0.9.0 → 0.10.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc62681eb9e885dac40f75a5a461cacf237575c3f04933818d1172e1016866a
|
4
|
+
data.tar.gz: 8f3772d45bfece5711842230e3061b2d726b94688685ad283eb28215d0fa22df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d297f244c8709f56adb979818e63c8b07ea70f8baddbb2e8e19fad7ae1f068ae3d45068e801a255662fd69020c67f1ccd44c5a7aa94cba2250684c12021f935
|
7
|
+
data.tar.gz: d15e3e5be0a907a210e66eb1617b45fcd7fbcf8da82bcc11894f9e61d6d909817b786a8624e625954441eb7ae5490c162b14eabab9402333abec9e1d2d90eca0
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'excon'
|
2
2
|
require 'json'
|
3
3
|
require_relative './error_response'
|
4
|
+
require_relative './error'
|
4
5
|
|
5
6
|
module PusherPlatform
|
6
7
|
class BaseClient
|
7
8
|
def initialize(options)
|
8
|
-
raise "Unspecified host" if options[:host].nil?
|
9
|
+
raise PusherPlatform::Error.new("Unspecified host") if options[:host].nil?
|
9
10
|
port_string = options[:port] || ''
|
10
11
|
host_string = "https://#{options[:host]}#{port_string}"
|
11
12
|
@connection = Excon.new(host_string)
|
@@ -16,8 +17,8 @@ module PusherPlatform
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def request(options)
|
19
|
-
raise "Unspecified request method" if options[:method].nil?
|
20
|
-
raise "Unspecified request path" if options[:path].nil?
|
20
|
+
raise PusherPlatform::Error.new("Unspecified request method") if options[:method].nil?
|
21
|
+
raise PusherPlatform::Error.new("Unspecified request path") if options[:path].nil?
|
21
22
|
|
22
23
|
headers = if options[:headers]
|
23
24
|
options[:headers].dup
|
@@ -45,7 +46,7 @@ module PusherPlatform
|
|
45
46
|
if response.status >= 200 && response.status <= 299
|
46
47
|
return response
|
47
48
|
elsif response.status >= 300 && response.status <= 399
|
48
|
-
raise "
|
49
|
+
raise PusherPlatform::Error.new("Unsupported redirect response: #{response.status}")
|
49
50
|
elsif response.status >= 400 && response.status <= 599
|
50
51
|
error = begin
|
51
52
|
JSON.parse(response.body)
|
@@ -61,7 +62,7 @@ module PusherPlatform
|
|
61
62
|
}
|
62
63
|
raise ErrorResponse.new(error_res_opts)
|
63
64
|
else
|
64
|
-
raise "
|
65
|
+
raise PusherPlatform::Error.new("Unsupported response code: #{response.status}")
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
@@ -2,6 +2,7 @@ require_relative './authenticator'
|
|
2
2
|
require_relative './base_client'
|
3
3
|
require_relative './common'
|
4
4
|
require_relative './error_response'
|
5
|
+
require_relative './error'
|
5
6
|
|
6
7
|
module PusherPlatform
|
7
8
|
|
@@ -9,15 +10,16 @@ module PusherPlatform
|
|
9
10
|
|
10
11
|
class Instance
|
11
12
|
def initialize(options)
|
12
|
-
raise "No instance locator provided" if options[:locator].nil?
|
13
|
-
raise "No
|
14
|
-
raise "No service
|
13
|
+
raise PusherPlatform::Error.new("No instance locator provided") if options[:locator].nil?
|
14
|
+
raise PusherPlatform::Error.new("No key provided") if options[:key].nil?
|
15
|
+
raise PusherPlatform::Error.new("No service name provided") if options[:service_name].nil?
|
16
|
+
raise PusherPlatform::Error.new("No service version provided") if options[:service_version].nil?
|
15
17
|
locator = options[:locator]
|
16
18
|
@service_name = options[:service_name]
|
17
19
|
@service_version = options[:service_version]
|
18
20
|
|
19
21
|
key_parts = options[:key].match(/^([^:]+):(.+)$/)
|
20
|
-
raise "Invalid key" if key_parts.nil?
|
22
|
+
raise PusherPlatform::Error.new("Invalid key") if key_parts.nil?
|
21
23
|
|
22
24
|
@key_id = key_parts[1]
|
23
25
|
@key_secret = key_parts[2]
|
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
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pusher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/pusher-platform/authenticator.rb
|
50
50
|
- lib/pusher-platform/base_client.rb
|
51
51
|
- lib/pusher-platform/common.rb
|
52
|
+
- lib/pusher-platform/error.rb
|
52
53
|
- lib/pusher-platform/error_response.rb
|
53
54
|
- lib/pusher-platform/instance.rb
|
54
55
|
homepage:
|