sentofu 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/sentofu/api.rb +2 -5
- data/lib/sentofu.rb +24 -7
- 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: 438abd6ab431bafd2d9f9cd6ff66202cc311de0d16081b9bcbf62f040ab2dde7
|
4
|
+
data.tar.gz: b357331c8ffca74c00130a8965b95be86afbbd8e9300fd3db485b9a2ba5e5200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d9b1b89c83523e5f8ffdf956f6f7339fa6e42ced07be392609503300ebbe50ac9e68e380edd5125210f07f85488420296efd28c62160ad7d50f0543c20b5779
|
7
|
+
data.tar.gz: 39b988baecc334abec4fa15cd52b78a04feb92b1f34f9e5b1f11ecaeaeb0b42a3a0155cfcf3715fb3baca8865eba82637739fc9a5cd33468daeb6cc41d448abc
|
data/CHANGELOG.md
CHANGED
data/lib/sentofu/api.rb
CHANGED
@@ -186,15 +186,12 @@ module Sentofu
|
|
186
186
|
|
187
187
|
def modified
|
188
188
|
|
189
|
-
Time.parse(
|
190
|
-
@spec[:meta]['properties']
|
191
|
-
.find { |pr| pr['type'] == 'X-Modified' }['value'])
|
189
|
+
Time.parse(@spec[:meta][:modified])
|
192
190
|
end
|
193
191
|
|
194
192
|
def version
|
195
193
|
|
196
|
-
@spec[:meta][
|
197
|
-
.find { |pr| pr['type'] == 'X-Version' }['value']
|
194
|
+
@spec[:meta][:version]
|
198
195
|
end
|
199
196
|
|
200
197
|
protected
|
data/lib/sentofu.rb
CHANGED
@@ -14,7 +14,7 @@ require 'sentofu/explo'
|
|
14
14
|
|
15
15
|
module Sentofu
|
16
16
|
|
17
|
-
VERSION = '0.2.
|
17
|
+
VERSION = '0.2.1'
|
18
18
|
|
19
19
|
USER_AGENT =
|
20
20
|
"Sentofu #{Sentofu::VERSION} - " +
|
@@ -55,9 +55,20 @@ module Sentofu
|
|
55
55
|
|
56
56
|
paths.each do |path|
|
57
57
|
|
58
|
-
|
58
|
+
m = path.match(/api_([^_]+)_(\d+(?:\.\d+)*)\.yaml\z/)
|
59
|
+
next unless m
|
60
|
+
|
61
|
+
api_name = m[1]
|
62
|
+
api_version = m[2]
|
63
|
+
|
59
64
|
api_spec = YAML.load(File.read(path))
|
60
65
|
|
66
|
+
api_spec[:meta] = {
|
67
|
+
name: api_name,
|
68
|
+
version: api_version,
|
69
|
+
path: path,
|
70
|
+
modified: File.mtime(path).utc.strftime('%FT%RZ') }
|
71
|
+
|
61
72
|
init_api(api_name, api_spec)
|
62
73
|
end
|
63
74
|
end
|
@@ -78,20 +89,26 @@ module Sentofu
|
|
78
89
|
|
79
90
|
metas = Sentofu::Http.get_and_parse(doc_uri)
|
80
91
|
|
81
|
-
|
92
|
+
ver, mod, url, meta = metas['apis']
|
82
93
|
.collect { |m|
|
83
94
|
prs = m['properties']
|
84
95
|
[ prs.find { |pr| pr['type'] == 'X-Version' }['value'],
|
96
|
+
prs.find { |pr| pr['type'] == 'X-Modified' }['value'],
|
85
97
|
prs.find { |pr| pr['type'] == 'Swagger' }['url'],
|
86
98
|
m ] }
|
87
|
-
.select { |v, _, _| version_match(v, ver_pattern) }
|
99
|
+
.select { |v, _, _, _| version_match(v, ver_pattern) }
|
88
100
|
.sort_by(&:first)
|
89
101
|
.first
|
90
102
|
|
91
|
-
|
92
|
-
|
103
|
+
meta[:name] = api_name
|
104
|
+
meta[:version] = ver
|
105
|
+
meta[:url] = url
|
106
|
+
meta[:modified] = mod
|
93
107
|
|
94
|
-
|
108
|
+
api_spec = Sentofu::Http.get_and_parse(url)
|
109
|
+
api_spec[:meta] = meta
|
110
|
+
|
111
|
+
init_api(api_name, api_spec)
|
95
112
|
end
|
96
113
|
end
|
97
114
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentofu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|