oas_request 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oas_request.rb +12 -2
- metadata +1 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eff936a836194070a533df223dc68808666c5f1c66c9ae69458c14258c6ac942
|
4
|
+
data.tar.gz: 29dbfff1f8cb35541db4c35db807a5578abe525f6f7859c154a74b23fa0906fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d848a527152d9459ca08ea149fe9f8fac19722ae3fceac6c50f3b0bf87e2fb21f257e2b074ebcd9c0f9fb242addd2fe82fdace3db2a60eaadbf39d8ab6513d5
|
7
|
+
data.tar.gz: 9b26f5dbf3140b62dda6da1160188374a81542221e349646bdb1ec999be9ed01ab095fa1203c1a47e0edaca36e8228ba0fde2c9fca8e791f688c3cc2e2e3c23f
|
data/lib/oas_request.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rack"
|
2
|
+
require "string"
|
2
3
|
|
3
4
|
class OASRequest
|
4
5
|
def self.spec(oas)
|
@@ -44,13 +45,16 @@ class OASRequest
|
|
44
45
|
)
|
45
46
|
end
|
46
47
|
|
48
|
+
|
47
49
|
oas["paths"].each do |url, methods|
|
48
50
|
methods.each do |method, definition|
|
49
51
|
# filter to paths that contain an operationId
|
50
52
|
next unless definition.is_a?(Hash) && definition["operationId"]
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
+
operation_id = definition["operationId"]
|
55
|
+
underscored_operation_id = operation_id.underscore
|
56
|
+
|
57
|
+
request_method = Proc.new do |headers: {}, params: {}, query: {}, body: nil|
|
54
58
|
__request(
|
55
59
|
method: method,
|
56
60
|
url: url,
|
@@ -62,6 +66,12 @@ class OASRequest
|
|
62
66
|
}
|
63
67
|
)
|
64
68
|
end
|
69
|
+
|
70
|
+
# process each method
|
71
|
+
define_method(operation_id, &request_method)
|
72
|
+
|
73
|
+
# Rubyify it getFooByBar -> get_foo_by_bar
|
74
|
+
define_method(underscored_operation_id, &request_method) if operation_id != underscored_operation_id
|
65
75
|
end
|
66
76
|
end
|
67
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oas_request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -30,26 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.2.3
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: jwt
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.5'
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.5.4
|
43
|
-
type: :runtime
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.5'
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 1.5.4
|
53
33
|
- !ruby/object:Gem::Dependency
|
54
34
|
name: webmock
|
55
35
|
requirement: !ruby/object:Gem::Requirement
|