reynard 0.2.0 → 0.3.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/reynard/http/response.rb +1 -1
- data/lib/reynard/object_builder.rb +2 -2
- data/lib/reynard/specification.rb +12 -2
- 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: bb3f70f5fd68cbe19747d08687715165595d29a6b81da3329a975cac30bd3cbe
|
4
|
+
data.tar.gz: 73020e57c19507af7ac13b9bc509d3a4b7ac3ae9b74866d7f783cc816436039f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5289ec587b945a0a858537569a4543e9bbfb3daa6dcb8e11cc409d620b89c1d85406d4a1fa0d20dcccc4c00eddcc6ff4b03f5ae24feff865f4cb62661f09638
|
7
|
+
data.tar.gz: af30bf905849a2589e091b0b9655e52375db08ea00f0b28365029900b4101c5d4b94822b30a17b3a1b8e35329886b61cf857fa6d8de1ff6a16fd56ca0dc2a904
|
@@ -46,7 +46,7 @@ class Reynard
|
|
46
46
|
|
47
47
|
def build_object_without_media_type
|
48
48
|
# Try to parse the response as JSON and give up otherwise.
|
49
|
-
|
49
|
+
Reynard::Model.new(MultiJson.load(@http_response.body))
|
50
50
|
rescue StandardError
|
51
51
|
@http_response.body
|
52
52
|
end
|
@@ -15,7 +15,7 @@ class Reynard
|
|
15
15
|
if @media_type.schema_name
|
16
16
|
self.class.model_class(@media_type.schema_name, @schema.object_type)
|
17
17
|
else
|
18
|
-
|
18
|
+
Reynard::Model
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -23,7 +23,7 @@ class Reynard
|
|
23
23
|
if @schema.item_schema_name
|
24
24
|
self.class.model_class(@schema.item_schema_name, 'object')
|
25
25
|
else
|
26
|
-
|
26
|
+
Reynard::Model
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -5,6 +5,8 @@ require 'rack'
|
|
5
5
|
class Reynard
|
6
6
|
# Wraps the YAML representation of an OpenAPI specification.
|
7
7
|
class Specification
|
8
|
+
VERBS = %w[get put post delete options head patch trace].freeze
|
9
|
+
|
8
10
|
def initialize(filename:)
|
9
11
|
@filename = filename
|
10
12
|
@data = read
|
@@ -32,7 +34,15 @@ class Reynard
|
|
32
34
|
def build_grouped_params(operation_node, params)
|
33
35
|
return {} unless params
|
34
36
|
|
35
|
-
GroupedParameters.new(
|
37
|
+
GroupedParameters.new(
|
38
|
+
[
|
39
|
+
# Parameters can be shared between methods on a path or be specific to an operation. The
|
40
|
+
# parameters on the operation level override those at the path level.
|
41
|
+
dig(*operation_node, 'parameters'),
|
42
|
+
dig(*operation_node[..-2], 'parameters')
|
43
|
+
].compact.flatten,
|
44
|
+
params
|
45
|
+
).to_h
|
36
46
|
end
|
37
47
|
|
38
48
|
# Returns a serialized body instance to serialize a request body and figure out the request
|
@@ -43,7 +53,7 @@ class Reynard
|
|
43
53
|
|
44
54
|
def operation(operation_name)
|
45
55
|
dig('paths').each do |path, operations|
|
46
|
-
operations.each do |verb, operation|
|
56
|
+
operations.slice(*VERBS).each do |verb, operation|
|
47
57
|
return Operation.new(node: ['paths', path, verb]) if operation_name == operation['operationId']
|
48
58
|
end
|
49
59
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manfred Stienstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|