reynard 0.5.0 → 0.5.1
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/reynard/object_builder.rb +2 -0
- data/lib/reynard/specification.rb +23 -7
- data/lib/reynard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 891b142e2ca908078c960db4b36040b407974da43395d02b7ee3f768a1c758b4
|
4
|
+
data.tar.gz: 5deefbad34c0364cfd3c3a04910b882499c3b96d7c4d642fdb10fbdcc3e9898f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 393b2cab7867c45c53b761f42b03e609e653600981aa1283cf3f7c0213379adb9a1eeb1530b3a0f826e07d1ceb5c3fab0d8afc114a2001ec773f71d2484bc109
|
7
|
+
data.tar.gz: c14ebcc55481c202c0c3c7b7dd36e68eb5b72f0297c0339867e6c298d4a3605284dff2e041d33b074c8c9e3b8064f450fdf481fa686e56c1e764af59a1050593
|
@@ -112,6 +112,14 @@ class Reynard
|
|
112
112
|
.gsub(/\A(.)/) { Regexp.last_match(1).upcase }
|
113
113
|
end
|
114
114
|
|
115
|
+
def self.normalize_model_title(title)
|
116
|
+
title
|
117
|
+
.gsub(/[^[:alpha:]]/, ' ')
|
118
|
+
.gsub(/\s{2,}/, ' ')
|
119
|
+
.gsub(/(\s+)([[:alpha:]])/) { Regexp.last_match(2).upcase }
|
120
|
+
.strip
|
121
|
+
end
|
122
|
+
|
115
123
|
private
|
116
124
|
|
117
125
|
def read
|
@@ -150,17 +158,25 @@ class Reynard
|
|
150
158
|
# rubocop:enable Metrics/MethodLength
|
151
159
|
|
152
160
|
def schema_name(response)
|
153
|
-
|
154
|
-
return unless ref
|
155
|
-
|
156
|
-
self.class.normalize_model_name(ref&.split('/')&.last)
|
161
|
+
extract_schema_name(response['schema'])
|
157
162
|
end
|
158
163
|
|
159
164
|
def item_schema_name(schema)
|
160
|
-
|
161
|
-
|
165
|
+
if schema['type'] == 'array'
|
166
|
+
extract_schema_name(schema['items'])
|
167
|
+
else
|
168
|
+
extract_schema_name(schema)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def extract_schema_name(definition)
|
173
|
+
ref = definition['$ref']
|
174
|
+
return self.class.normalize_model_name(ref&.split('/')&.last) if ref
|
175
|
+
|
176
|
+
title = definition['title']
|
177
|
+
return unless title
|
162
178
|
|
163
|
-
self.class.
|
179
|
+
self.class.normalize_model_title(title)
|
164
180
|
end
|
165
181
|
end
|
166
182
|
end
|
data/lib/reynard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reynard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manfred Stienstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|