heroics 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/heroics/schema.rb +10 -1
- data/lib/heroics/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4224f1668172f1b57b9af3d2b9b29e66f21794ec
|
4
|
+
data.tar.gz: 6483f605d2755c42c14566ce5333118ff3b1c246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cfb07d93f16d80c752af314f38fe5034e759905a4018d92bd42e6e1ba1eeb3b1a836f5f622c6c2589f8f077f93289ea4b28425981059e36d4a7433e7918bbb9
|
7
|
+
data.tar.gz: '0887d237a5b4edad720942aaea0c5ac80d176f60e08aa5838e6976ad7277db4a46a15805f57aad119e51e1e42e1cf3fda771d83e2a7dc434c41fdc11e50699fd'
|
data/README.md
CHANGED
@@ -34,7 +34,10 @@ Heroics.default_configuration do |config|
|
|
34
34
|
config.schema_filepath = 'schema.json'
|
35
35
|
|
36
36
|
config.headers = { 'Accept' => 'application/vnd.example+json; version=1' }
|
37
|
-
|
37
|
+
|
38
|
+
# Note: Don't use doublequotes below -- we want to interpolate at runtime,
|
39
|
+
# not when the client is generated
|
40
|
+
config.cache_path = '#{Dir.home}/.heroics/example'
|
38
41
|
end
|
39
42
|
```
|
40
43
|
|
data/lib/heroics/schema.rb
CHANGED
@@ -60,6 +60,15 @@ module Heroics
|
|
60
60
|
@name = name
|
61
61
|
link_schema = schema['definitions'][name]['links'] || []
|
62
62
|
|
63
|
+
duplicate_names = link_schema
|
64
|
+
.group_by { |link| Heroics.ruby_name(link['title']) }
|
65
|
+
.select { |k, v| v.size > 1 }
|
66
|
+
.map(&:first)
|
67
|
+
if !duplicate_names.empty?
|
68
|
+
raise SchemaError.new("Duplicate link names " +
|
69
|
+
"'#{duplicate_names.join("', '")}'.")
|
70
|
+
end
|
71
|
+
|
63
72
|
@links = Hash[link_schema.each_with_index.map do |link, link_index|
|
64
73
|
link_name = Heroics.ruby_name(link['title'])
|
65
74
|
[link_name, LinkSchema.new(schema, name, link_index)]
|
@@ -204,7 +213,7 @@ module Heroics
|
|
204
213
|
"(#{parameters.size} for #{parameter_size})")
|
205
214
|
end
|
206
215
|
|
207
|
-
(0
|
216
|
+
(0...parameter_size).each do |i|
|
208
217
|
path = path.sub(PARAMETER_REGEX, format_parameter(parameters[i]))
|
209
218
|
end
|
210
219
|
body = parameters.slice(parameter_size)
|
data/lib/heroics/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -221,9 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.
|
224
|
+
rubygems_version: 2.6.8
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: A Ruby client generator for HTTP APIs described with a JSON schema
|
228
228
|
test_files: []
|
229
|
-
has_rdoc:
|