ketra 0.5.0 → 0.6.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 +4 -4
- data/lib/ketra/client.rb +23 -1
- data/lib/ketra/version.rb +1 -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: 9c4e84f8ef249223bd38bcec056143970a08168e
|
4
|
+
data.tar.gz: 4806176781ccd27f36ea89f01f83d817a676e18b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cc7ff93ed4a471c89b1b5664dd1b1efe46d6900a6266b939eb84d0a7dea5531b46a21c7a35f95b9976f80035c77dbf896faf910a172975ea7946525ba40ad72
|
7
|
+
data.tar.gz: 9094f6de501efccb0046e5678d793b7d0bfba3ff3db0bfe50ccba191b49f1ebad64f6a76972f94ef430e9e8421a2997f93e2eeeec8d18937484e385db7eff946
|
data/lib/ketra/client.rb
CHANGED
@@ -5,10 +5,13 @@ module Ketra
|
|
5
5
|
class Client
|
6
6
|
# Production Host base url
|
7
7
|
PRODUCTION_HOST = 'https://my.goketra.com'
|
8
|
+
REMOTE_PRODUCTION_HOST = 'https://api.goketra.com'
|
8
9
|
# Test Host base url
|
9
10
|
TEST_HOST = 'https://internal-my.goketra.com'
|
11
|
+
REMOTE_TEST_HOST = 'https://internal-api.goketra.com'
|
10
12
|
# Endpoint prefix to be attached to the base url before the rest of the endpoint
|
11
13
|
LOCAL_ENDPOINT_PREFIX = 'ketra.cgi/api/v1'
|
14
|
+
REMOTE_ENDPOINT_PREFIX = 'webAPI/api/v1'
|
12
15
|
|
13
16
|
attr_accessor :options
|
14
17
|
attr_reader :id, :secret, :access_token
|
@@ -107,16 +110,35 @@ module Ketra
|
|
107
110
|
PRODUCTION_HOST
|
108
111
|
end
|
109
112
|
end
|
113
|
+
|
114
|
+
def remote_host
|
115
|
+
case options[:server]
|
116
|
+
when :test
|
117
|
+
REMOTE_TEST_HOST
|
118
|
+
else
|
119
|
+
REMOTE_PRODUCTION_HOST
|
120
|
+
end
|
121
|
+
end
|
110
122
|
|
111
123
|
def url(endpoint)
|
112
124
|
#TODO implement additional api modes
|
113
|
-
|
125
|
+
case options[:api_mode]
|
126
|
+
when :remote
|
127
|
+
base = remote_url
|
128
|
+
else
|
129
|
+
base = local_url
|
130
|
+
end
|
131
|
+
url = "#{base}/#{endpoint}"
|
114
132
|
Addressable::URI.encode(url)
|
115
133
|
end
|
116
134
|
|
117
135
|
def local_url
|
118
136
|
"https://#{hub_ip}/#{LOCAL_ENDPOINT_PREFIX}"
|
119
137
|
end
|
138
|
+
|
139
|
+
def remote_url
|
140
|
+
"#{remote_host}/#{options[:installation_id]}/#{options[:hub_serial]}/#{REMOTE_ENDPOINT_PREFIX}"
|
141
|
+
end
|
120
142
|
|
121
143
|
def hub_ip
|
122
144
|
@hub_ip || discover_hub(options[:hub_serial])
|
data/lib/ketra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ketra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Priester
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|