ftr_ruby 0.1.0 → 0.1.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/ftr_ruby/version.rb +1 -1
- data/lib/openapi.rb +72 -70
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d62219e48ef4691b85401ac885542a5051dbccd7b1071839b8f0eb779ef131f
|
|
4
|
+
data.tar.gz: 2fb72b6cf2765a9f8b2dfe98f1815d1ab5f72482be8e562ac4222c1e02254860
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7508a2b075ecdb121212ec3a8eaf0d9662a1aad1a4cae79b12b98f547c84cf31e7748d5da1eb845ed13970a4f12897be59709114754dfc4a0cedffc289665445
|
|
7
|
+
data.tar.gz: 448496de2b06ef443823e142dfb0425a9ea65b32cf6f6cc079630f6ba64031948073afd52606164ea2d17566040c79bd3ed9509c1a4abdbaa5c461a84b3a3072
|
data/lib/ftr_ruby/version.rb
CHANGED
data/lib/openapi.rb
CHANGED
|
@@ -1,77 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
module FtrRuby
|
|
2
|
+
class OpenAPI
|
|
3
|
+
attr_accessor :title, :metric, :description, :indicator, :testid,
|
|
4
|
+
:organization, :org_url, :version, :creator,
|
|
5
|
+
:responsible_developer, :email, :developer_ORCiD, :protocol,
|
|
6
|
+
:host, :basePath, :path, :response_description, :schemas, :endpointpath
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
def initialize(meta:)
|
|
9
|
+
indics = [meta[:indicators]] unless meta[:indicators].is_a? Array
|
|
10
|
+
@testid = meta[:testid]
|
|
11
|
+
@title = meta[:testname]
|
|
12
|
+
@version = meta[:testversion]
|
|
13
|
+
@metric = meta[:metric]
|
|
14
|
+
@description = meta[:description]
|
|
15
|
+
@indicator = indics.first
|
|
16
|
+
@organization = meta[:organization]
|
|
17
|
+
@org_url = meta[:org_url]
|
|
18
|
+
@responsible_developer = meta[:responsible_developer]
|
|
19
|
+
@email = meta[:email]
|
|
20
|
+
@creator = meta[:creator]
|
|
21
|
+
@host = meta[:host]
|
|
22
|
+
@host = @host.gsub(%r{/$}, "") # remove trailing slash if present
|
|
23
|
+
@protocol = meta[:protocol].gsub(%r{[:/]}, "")
|
|
24
|
+
@basePath = meta[:basePath].gsub(%r{[:/]}, "")
|
|
25
|
+
@basePath = "/#{basePath}" unless basePath[0] == "/" # must start with a slash
|
|
26
|
+
@path = meta[:path]
|
|
27
|
+
@response_description = meta[:response_description]
|
|
28
|
+
@schemas = meta[:schemas]
|
|
29
|
+
@endpointpath = "assess/test"
|
|
30
|
+
@end_url = "#{protocol}://#{host}#{basePath}/#{endpointpath}/#{testid}" # basepath starts with /
|
|
31
|
+
end
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
def get_api
|
|
34
|
+
<<~"EOF_EOF"
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
schemas:
|
|
36
|
+
openapi: 3.0.0
|
|
37
|
+
info:
|
|
38
|
+
version: "#{version}"
|
|
39
|
+
title: "#{title}"
|
|
40
|
+
x-tests_metric: "#{metric}"
|
|
41
|
+
description: >-
|
|
42
|
+
"#{description}"
|
|
43
|
+
x-applies_to_principle: "#{indicator}"
|
|
44
|
+
contact:
|
|
45
|
+
x-organization: "#{organization}"
|
|
46
|
+
url: "#{org_url}"
|
|
47
|
+
name: "#{responsible_developer}"
|
|
48
|
+
x-role: responsible developer
|
|
49
|
+
email: "#{email}"
|
|
50
|
+
x-id: "#{creator}"
|
|
51
|
+
paths:
|
|
52
|
+
"/#{testid}":
|
|
53
|
+
post:
|
|
54
|
+
requestBody:
|
|
55
|
+
content:
|
|
56
|
+
application/json:
|
|
57
|
+
schema:
|
|
58
|
+
$ref: "#/components/schemas/schemas"
|
|
59
|
+
required: true
|
|
60
|
+
responses:
|
|
61
|
+
"200":
|
|
62
|
+
description: >-
|
|
63
|
+
#{response_description}
|
|
64
|
+
servers:
|
|
65
|
+
- url: "#{protocol}://#{host}/#{endpointpath}"
|
|
66
|
+
components:
|
|
67
67
|
schemas:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
schemas:
|
|
69
|
+
required:
|
|
70
|
+
- resource_identifier
|
|
71
|
+
properties:
|
|
72
|
+
- resource_identifier:
|
|
73
|
+
type: string
|
|
74
|
+
description: the GUID being tested
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
EOF_EOF
|
|
77
|
+
end
|
|
76
78
|
end
|
|
77
79
|
end
|