smplkit 1.0.12 → 1.0.13

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: 33719678260c3b3cd9ae01b3a7d58226363cc292d93130600622df9ba4d259ec
4
- data.tar.gz: 6c5a7f1f074f2b3f87266929598722da16cf44209057ccb147cff4bb84cb2e90
3
+ metadata.gz: 0f74b529f57291b182d674d166e138a61b95bb01c1bdf01a71261405f75a6879
4
+ data.tar.gz: 7e08e3ec63e892ae13bec37446afcd38c7b5d16008a0396d7046efd362598ed9
5
5
  SHA512:
6
- metadata.gz: a0f1c4f3b2e0100c229f9e64d78410289891024b97ffc3b7ff2af3daf7e94f60d58677d75f08ddc3b009d1543cc39d19612fe5d3a0cc20852498423d9f03f095
7
- data.tar.gz: a6b6c420674b9f983e925134b12cea12ef97edf8d992113845bf458042af29ff44492a7391a968d23d0aa14d00131757f4a61cb99ff3005c1fa8ce790a0d3e85
6
+ metadata.gz: 28aa21a7b049e824c613ab8d53df09a0993abd938cb275ee7a330735623b9e6de99b986f6930bc6bab472a26533abf472d5a6f41301e54d833856fdb6708c882
7
+ data.tar.gz: 738683d247b8a2c557731deaae62c93120899da054dcfb91991d7ee114dd5a40c7f945456916713aa4500aa2a6e1fefe5ea0916f682804c63a4eea2af3ad1afc
@@ -157,11 +157,21 @@ module Smplkit
157
157
 
158
158
  def typed_get(item_key, default, config_key)
159
159
  snapshot = config_key ? resolve(config_key) : merged_snapshot
160
- keys = item_key.to_s.split(".")
161
- value = keys.reduce(snapshot) do |scope, k|
162
- break default unless scope.is_a?(Hash)
163
-
164
- scope[k]
160
+ key = item_key.to_s
161
+ # Items live under flat dotted keys (e.g. +"api.host"+ not nested
162
+ # +api host+). Match Python's +current_values.get(key)+ behavior.
163
+ value = snapshot[key]
164
+ if value.nil? && snapshot.is_a?(Hash)
165
+ # Fallback: support callers that constructed an explicitly-nested
166
+ # snapshot (rare — typed model bindings only).
167
+ parts = key.split(".")
168
+ if parts.length > 1
169
+ value = parts.reduce(snapshot) do |scope, k|
170
+ break nil unless scope.is_a?(Hash)
171
+
172
+ scope[k]
173
+ end
174
+ end
165
175
  end
166
176
  return default if value.nil?
167
177
 
@@ -32,7 +32,7 @@ module Smplkit
32
32
  key: attrs["key"] || resource["id"],
33
33
  name: attrs["name"],
34
34
  description: attrs["description"],
35
- parent_id: attrs["parent_id"],
35
+ parent_id: attrs["parent"] || attrs["parent_id"],
36
36
  items: items,
37
37
  environments: environments,
38
38
  created_at: attrs["created_at"],
@@ -54,11 +54,12 @@ module Smplkit
54
54
  out[env] = { "values" => env_obj.values_raw }
55
55
  end
56
56
 
57
+ # The Config schema (per the OpenAPI spec) does not include +key+ in
58
+ # attributes — the resource +id+ carries the customer-facing key.
57
59
  attributes = {
58
- "key" => config.key,
59
60
  "name" => config.name,
60
61
  "description" => config.description,
61
- "parent_id" => config.parent_id,
62
+ "parent" => config.parent_id,
62
63
  "items" => items,
63
64
  "environments" => environments
64
65
  }.compact
@@ -400,8 +400,11 @@ module Smplkit
400
400
 
401
401
  def new_config(key, name: nil, description: nil, parent: nil)
402
402
  Smplkit::Config::Config.new(
403
- self, key: key, name: name, description: description,
404
- parent_id: parent.is_a?(Smplkit::Config::Config) ? parent.key : parent
403
+ self,
404
+ key: key,
405
+ name: name || Smplkit::Helpers.key_to_display_name(key),
406
+ description: description,
407
+ parent_id: parent.is_a?(Smplkit::Config::Config) ? parent.key : parent
405
408
  )
406
409
  end
407
410
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC