clowder-common-ruby 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaad1ec25f009d5c0f4d3bbefd6d0bf86df648bf4ac720c5950818c9ac5b6f8c
4
- data.tar.gz: a22c70b356e1bd289501792b627ddf6de8be1f32e0d7b3bfc670f2349d1a2dd2
3
+ metadata.gz: 5f5724ba3decfd80d5680e28006c976a72bd03868586b0afd0d16415f2d30ca7
4
+ data.tar.gz: 14e7f2f3882001c06ee7391dad86f73269b2ad315691612827120bef7f228e02
5
5
  SHA512:
6
- metadata.gz: 242ff896a7cec23fb9396868e950f4a3796e9f9fc6b63df41f0aaeaf19aa4c940fcf34e6bf8cfee3c9c5e1caf24bf4b224f1981462b04138edb6081dbd28f506
7
- data.tar.gz: b1a121df03523947b412c161e374de1ef48abf2858dbdf77c38c2c0d3138d5ec79db9eb77c9ccbbff1d4b8153b8091e99d3c667b619c07bcefe2670f8db26350
6
+ metadata.gz: 7fcf609b925a9d9de2fd8654e9effd592a6476bced6395acb745b7179bed5235e9b41ab7ca969f5538f57ac5c83369410f1b6a30753417127b4f75455c2c916b
7
+ data.tar.gz: d9dae30e257647850eadff44027175855ca17c9a65775422285726b373fc4dc315ca3d94271d3f74fbe2b71123df850246402844e69b3a0d49a1a6eab28a8c5d
@@ -82,11 +82,18 @@ class RubyClassConverter
82
82
  init_function << "\n"
83
83
  value.properties.each_pair do |k, v|
84
84
  if v.send(:type) == "array"
85
- klass = v.items.send("$ref").rpartition('/').last
86
- init_function << " @#{k} = []\n"
87
- init_function << " attributes.fetch(:#{k.to_sym}, []).each do |attr|\n"
88
- init_function << " @#{k} << #{klass}.new(attr)\n"
89
- init_function << " end\n"
85
+ if v.items.send("$ref")
86
+ klass = v.items.send("$ref").rpartition('/').last
87
+ init_function << " @#{k} = []\n"
88
+ init_function << " attributes.fetch(:#{k.to_sym}, []).each do |attr|\n"
89
+ init_function << " @#{k} << #{klass}.new(attr)\n"
90
+ init_function << " end\n"
91
+ else
92
+ init_function << " @#{k} = []\n"
93
+ init_function << " attributes.fetch(:#{k.to_sym}, []).each do |attr|\n"
94
+ init_function << " @#{k} << attr\n"
95
+ init_function << " end\n"
96
+ end
90
97
  elsif v.send('$ref')
91
98
  klass = v.send('$ref').rpartition('/').last
92
99
  init_function << " @#{k} = #{klass}.new(attributes.fetch(:#{k.to_sym}, {}))\n"
data/bin/schema.json CHANGED
@@ -482,7 +482,15 @@
482
482
  "type": "integer"
483
483
  },
484
484
  "apiPath": {
485
- "description": "The top level api path that the app should serve from /api/<apiPath>"
485
+ "description": "The top level api path that the app should serve from /api/<apiPath> (deprecated, use apiPaths)",
486
+ "type": "string"
487
+ },
488
+ "apiPaths": {
489
+ "description": "The list of API paths (each matching format: '/api/some-path/') that this app will serve requests from",
490
+ "type": "array",
491
+ "items": {
492
+ "type": "string"
493
+ }
486
494
  }
487
495
  },
488
496
  "required": [
@@ -16,6 +16,7 @@ module ClowderCommonRuby
16
16
  database: configure_database(config),
17
17
  prometheus_exporter_port: config&.metricsPort,
18
18
  tls_ca_path: config.tlsCAPath,
19
+ unleash: configure_unleash(config),
19
20
  web_port: config.webPort
20
21
  }
21
22
  end
@@ -155,6 +156,21 @@ module ClowderCommonRuby
155
156
  }
156
157
  end
157
158
 
159
+ # Unleash configuration hash
160
+ def configure_unleash(config)
161
+ return {} unless config.featureFlags
162
+
163
+ {
164
+ url: URI::HTTP.build(
165
+ host: config.featureFlags.hostname,
166
+ port: config.featureFlags.port,
167
+ protocol: config.featureFlags.scheme,
168
+ path: '/api'
169
+ ).to_s,
170
+ token: config.featureFlags.clientAccessToken
171
+ }
172
+ end
173
+
158
174
  # Gives location of database ssl certificate and makes sure it exists
159
175
  def build_database_certificate(rdsca)
160
176
  return unless rdsca.present?
@@ -390,6 +390,7 @@ module ClowderCommonRuby
390
390
  end
391
391
 
392
392
  class DependencyEndpoint < OpenStruct
393
+ attr_accessor :apiPaths
393
394
 
394
395
  def initialize(attributes)
395
396
  super
@@ -400,6 +401,10 @@ module ClowderCommonRuby
400
401
  h[k.to_sym] = v
401
402
  end
402
403
 
404
+ @apiPaths = []
405
+ attributes.fetch(:apiPaths, []).each do |attr|
406
+ @apiPaths << attr
407
+ end
403
408
  end
404
409
 
405
410
  def valid_keys
@@ -410,6 +415,7 @@ module ClowderCommonRuby
410
415
  keys << :app
411
416
  keys << :tlsPort
412
417
  keys << :apiPath
418
+ keys << :apiPaths
413
419
  end
414
420
  end
415
421
  end
@@ -1,3 +1,3 @@
1
1
  module ClowderCommonRuby
2
- VERSION = '0.5.0'.freeze # Patch version is being automatically bumped
2
+ VERSION = '0.5.2'.freeze # Patch version is being automatically bumped
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clowder-common-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Red Hat Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-05 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a ruby interface for preparing Clowder variables.
14
14
  email: