mini-apivore 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: cd4021c1b59f97da6c130712948c65a271135cc50ebc8b38e438c9a39ea834b7
4
- data.tar.gz: 96056ed390b669092813bd6bd7b5f9fa44485719ed1d7135234d690440848c13
3
+ metadata.gz: 55d58253430c43d1c28701361502f0b394e142bb80a4fde28c297b75ca3fc6bf
4
+ data.tar.gz: 51f6e1590917fb7877956b31a5eb70f334ef433e9e8555720bc2d4fe5749ad72
5
5
  SHA512:
6
- metadata.gz: 7f9d82a99a608ea35f4e78791dd1356536e9ca05f63c7698a79e509794a8b1eb313cbb93f4a96691bee4478d6d6e846a541bf5379ff0a65dbb73df8c0733f223
7
- data.tar.gz: 77e2b25f473550b9d4ea775191ccc7ecaf7fe3cb2da7e16ae7c774d67de1181c85b98786ebe87375fd361e891dec7f06931026636375a8288b402381f1ecbb9d
6
+ metadata.gz: 2c494d9d0be4b7632f4a8f4254777e98e57c6d0dc0e3b54e788b8c03ecc251f7956e9b61a918cb246c17b18feef79bc8625fcea4640a397c982f7ef6b7a94401
7
+ data.tar.gz: cd92cf48901af09e5000793cbce9016453cb8b1e633857039693bac1461c6659c0ad96765cf0c92a37bb8ce0976fdae1b2f8d37b0e6f7621ebedbd07f0f19047
@@ -6,6 +6,7 @@ require "hashie"
6
6
  module MiniApivore
7
7
  class Swagger < Hash
8
8
  include Hashie::Extensions::MergeInitializer
9
+ include Hashie::Extensions::IndifferentAccess
9
10
 
10
11
  NONVERB_PATH_ITEMS = "parameters"
11
12
 
@@ -20,7 +21,7 @@ module MiniApivore
20
21
  end
21
22
 
22
23
  def version
23
- self['swagger']
24
+ self["swagger"]
24
25
  end
25
26
 
26
27
  def base_path
@@ -28,21 +29,23 @@ module MiniApivore
28
29
  end
29
30
 
30
31
  def each_response(&block)
31
- self['paths'].each do |path, path_data|
32
- next if vendor_specific_tag? path
32
+ self["paths"].each do |path, path_data|
33
+ next if vendor_specific_tag?(path)
34
+
33
35
  path_data.each do |verb, method_data|
34
36
  next if NONVERB_PATH_ITEMS.include?(verb)
35
- next if vendor_specific_tag? verb
36
- if method_data['responses'].nil?
37
+ next if vendor_specific_tag?(verb)
38
+
39
+ if method_data["responses"].nil?
37
40
  raise "No responses found in swagger for path '#{path}', " \
38
41
  "verb #{verb}: #{method_data.inspect}"
39
42
  end
40
- method_data['responses'].each do |response_code, response_data|
43
+ method_data["responses"].each do |response_code, response_data|
41
44
  schema_location = nil
42
- if response_data['$ref']
43
- schema_location = response_data['$ref']
44
- elsif response_data['schema']
45
- schema_location = Fragment.new ['#', 'paths', path, verb, 'responses', response_code, 'schema']
45
+ if response_data["$ref"]
46
+ schema_location = response_data["$ref"]
47
+ elsif response_data["schema"]
48
+ schema_location = Fragment.new(["#", "paths", path, verb, "responses", response_code, "schema"])
46
49
  end
47
50
  block.call(path, verb, response_code, schema_location)
48
51
  end
@@ -7,7 +7,7 @@ module MiniApivore
7
7
  class SwaggerChecker
8
8
  PATH_TO_CHECKER_MAP = {}
9
9
 
10
- def self.instance_for(path, schema = "")
10
+ def self.instance_for(path, schema = {})
11
11
  PATH_TO_CHECKER_MAP[path] ||= new(path, schema)
12
12
  end
13
13
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mini
4
4
  module Apivore
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini-apivore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - alekseyl