heroics 0.0.10 → 0.0.11

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: 2734bdfc3a71cf8a17dda56a62a0d3cc654144b3
4
- data.tar.gz: e2f742945f8a266894b00bc72c718c64451608bd
3
+ metadata.gz: 0c15b2dbfd69a0a90de845e61c2bcf8d6fbca977
4
+ data.tar.gz: c1ae596e31f13f0c675aa7a2f4415b4aab0113d7
5
5
  SHA512:
6
- metadata.gz: 5005fa03e9b90eac6ac3f697739b2863ad61672b64987975fe77a2bd8762342166bd387367ada7d3730332ec628bb37e17fd86d5424dec082f5060c937f44ace
7
- data.tar.gz: 51917065d5f6efa822bff0b735dc629a7bad970ff9c7e870089b484b2bfb4e96d28fcc4baac694035890797877ef18dcd7742a7aaeef06c9de35a427fdd72460
6
+ metadata.gz: 07f65432fcdb7b39850de5ec236757934c11cc1b38531301792bd7fd7abb67c4c28f174dbe57bd61e860b5a07c61f0dd3e94c4abbd136bdf1bf7d07c385a6eca
7
+ data.tar.gz: 0334b0aba420505450b8f5843028512729c5ba6ead454b5d3256d2472832bed16c96e5965eccc3dd4c84934b57ed6d008d119685bf9e7dd312924b36fc0db9fe
data/README.md CHANGED
@@ -92,7 +92,7 @@ end
92
92
 
93
93
  ## Contributing
94
94
 
95
- 1. [Fork the repository](https://github.com/heroku/heroics/fork)
95
+ 1. [Fork the repository](https://github.com/interagent/heroics/fork)
96
96
  2. Create your feature branch (`git checkout -b my-new-feature`)
97
97
  3. Commit your changes (`git commit -am 'Add some feature'`)
98
98
  4. Push to the branch (`git push origin my-new-feature`)
@@ -245,11 +245,10 @@ module Heroics
245
245
  # @return [Array<Parameter|ParameterChoice>] A list of parameter instances
246
246
  # that represent parameters to be injected into the link URL.
247
247
  def resolve_parameter_details(parameters)
248
- properties = @schema['definitions'][@resource_name]['properties']
249
-
250
- # URI decode parameters and strip the leading '{(' and trailing ')}'.
251
- parameters = parameters.map { |parameter| URI.unescape(parameter[2..-3]) }
252
248
  parameters.map do |parameter|
249
+ # URI decode parameters and strip the leading '{(' and trailing ')}'.
250
+ parameter = URI.unescape(parameter[2..-3])
251
+
253
252
  # Split the path into components and discard the leading '#' that
254
253
  # represents the root of the schema.
255
254
  path = parameter.split('/')[1..-1]
@@ -280,7 +279,7 @@ module Heroics
280
279
  parameter = info['$ref']
281
280
  path = parameter.split('/')[1..-1]
282
281
  info = lookup_parameter(path, @schema)
283
- resource_name = path[1].gsub('-', '_')
282
+ resource_name = path.size > 2 ? path[1].gsub('-', '_') : nil
284
283
  name = path[-1]
285
284
  Parameter.new(resource_name, name, info['description'])
286
285
  end
@@ -346,7 +345,7 @@ module Heroics
346
345
  # The name of the parameter, with the resource included, suitable for use
347
346
  # in a function signature.
348
347
  def name
349
- "#{@resource_name}_#{@name}"
348
+ [@resource_name, @name].compact.join("_")
350
349
  end
351
350
 
352
351
  # A pretty representation of this instance.
@@ -367,7 +366,13 @@ module Heroics
367
366
  # A name created by merging individual parameter descriptions, suitable
368
367
  # for use in a function signature.
369
368
  def name
370
- @parameters.map { |parameter| parameter.name }.join('_or_')
369
+ @parameters.map do |parameter|
370
+ if parameter.resource_name
371
+ parameter.name
372
+ else
373
+ "#{@resource_name}_#{parameter.name}"
374
+ end
375
+ end.join('_or_')
371
376
  end
372
377
 
373
378
  # A description created by merging individual parameter descriptions.
@@ -1,3 +1,3 @@
1
1
  module Heroics
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -3,9 +3,10 @@
3
3
  #
4
4
  # WARNING: Do not edit by hand, this file was generated by Heroics:
5
5
  #
6
- # https://github.com/heroku/heroics
6
+ # https://github.com/interagent/heroics
7
7
  #
8
8
 
9
+ require 'heroics'
9
10
  require 'uri'
10
11
 
11
12
  module <%= @module_name %>
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.10
4
+ version: 0.0.11
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: 2014-05-23 00:00:00.000000000 Z
12
+ date: 2014-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler