ketra 0.5.0 → 0.6.0

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: f779511342b176754cdc8f6f13e68ed4b08ef041
4
- data.tar.gz: 32e2e7dc98b8cdf4fb24b613214daa8fffb54f5c
3
+ metadata.gz: 9c4e84f8ef249223bd38bcec056143970a08168e
4
+ data.tar.gz: 4806176781ccd27f36ea89f01f83d817a676e18b
5
5
  SHA512:
6
- metadata.gz: a86ceb7291d6892e8ae18721c9e38b445581f11c29f7cc56e17bbc99a663088e4521166c75fdb4b5f08498f5660cc5879c82944ccc1e0e07d7d8f27abcf2b371
7
- data.tar.gz: 42131932427c385e3de58addf5e204a2f11dbd41d795c7e4d17d4ce813ed8709e6cb7fffb206025ee6d43c460b0b12ae8b59440eeb555cbee5151d215277c511
6
+ metadata.gz: 1cc7ff93ed4a471c89b1b5664dd1b1efe46d6900a6266b939eb84d0a7dea5531b46a21c7a35f95b9976f80035c77dbf896faf910a172975ea7946525ba40ad72
7
+ data.tar.gz: 9094f6de501efccb0046e5678d793b7d0bfba3ff3db0bfe50ccba191b49f1ebad64f6a76972f94ef430e9e8421a2997f93e2eeeec8d18937484e385db7eff946
@@ -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
- url = "#{local_url}/#{endpoint}"
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])
@@ -1,4 +1,4 @@
1
1
  module Ketra
2
2
  # current RubyGem version
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
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.5.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: 2017-12-31 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2