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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b42c680d9fc2051a178839597105346700c037f
4
- data.tar.gz: 994a3d4567585660665351aecfe66709cc360f00
3
+ metadata.gz: 4224f1668172f1b57b9af3d2b9b29e66f21794ec
4
+ data.tar.gz: 6483f605d2755c42c14566ce5333118ff3b1c246
5
5
  SHA512:
6
- metadata.gz: 39f3ec1ec24f29d83d0d5c5a88fa9ae10a596fdd9e03cc127dc07260fb399333b436413b9f24cfb569ca1055d443cecc768e7d62713a0b79f4510abb612024aa
7
- data.tar.gz: c34cbe354b65f8d428e00e26231b0f55b63034580ce8a9afd55357d4b1bb4f44abdba44f2b55af4e7f2d2d21e0cb96772c66fed215db61148f2a2064acc236f3
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
- config.cache_path = "#{Dir.home}/.heroics/example"
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
 
@@ -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..parameter_size).each do |i|
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)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Heroics
3
- VERSION = '0.0.21'
3
+ VERSION = '0.0.22'
4
4
  end
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.21
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-03-02 00:00:00.000000000 Z
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.5.1
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: