fitting 2.1.1 → 2.1.2

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: 9cc4437b3b4fc45b1f632831bdf6dc008669d8bf
4
- data.tar.gz: e4a3c0047faf12ed24bced0dad110a462675eb4e
3
+ metadata.gz: 62ddfc06500d352a19cef63869803d96acbd3a83
4
+ data.tar.gz: 683e48bcf26e0d24205e6392b894ffc161055d79
5
5
  SHA512:
6
- metadata.gz: 6eed1f926a0cdf013cf813f7e41ceeb0da60704e124790655ab82aa713b2c65f6beeced0bd8f6033adcce1812c4f385e32955bc8bd274730d93aa5f872ae2485
7
- data.tar.gz: 56eacd58ecd9edb51a9a8c62175e17cf191b657e80c156d64ccd1e60c7d669d26c65cb473ba3b051ce1d29dc52ba463820a2e4b369a3306eca030d972b6b8759
6
+ metadata.gz: c8c51d7fa1ae6fe147c00e042127cb4a2be013d7d045bc99cac28d0016474e33a31ee3f2db716ceaca9eb10ac0511e7a43b02913bf7cd275e301cc2735b6f667
7
+ data.tar.gz: fc314f02bfbd6b67c4d4fa6c266c3fad22b01cea82bc5302f8b6ddd54edc2e7be9e94bb15ce3bf96398389280ba758c1a329aff45e58cf34419de0f6eff4051d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ### 2.1.2 - 2017-07-04
4
+
5
+ * bug fixes
6
+ * one response may match with more than one scheme
7
+ * inform non-existent resources in the white list of resources
8
+
3
9
  ### 2.1.1 - 2017-06-22
4
10
 
5
11
  * bug fixes
@@ -29,11 +29,15 @@ module Fitting
29
29
  end
30
30
 
31
31
  def route
32
- "#{@request.route} #{@status} #{index}"
32
+ index.map do |i|
33
+ "#{@request.route} #{@status} #{i}"
34
+ end
33
35
  end
34
36
 
35
37
  def strict_route
36
- "#{@request.route} #{@status} #{strict_index}"
38
+ strict_index.map do |i|
39
+ "#{@request.route} #{@status} #{i}"
40
+ end
37
41
  end
38
42
 
39
43
  def real_request_with_status
@@ -53,15 +57,21 @@ module Fitting
53
57
  private
54
58
 
55
59
  def index
60
+ return @index_res if @index_res
61
+ @index_res = []
56
62
  @schemas.size.times do |i|
57
- return i if fully_validates[i] == []
63
+ @index_res.push(i) if fully_validates[i] == []
58
64
  end
65
+ @index_res
59
66
  end
60
67
 
61
68
  def strict_index
69
+ return @strict_index_res if @strict_index_res
70
+ @strict_index_res = []
62
71
  @schemas.size.times do |i|
63
- return i if strict_fully_validates[i] == []
72
+ @strict_index_res.push(i) if strict_fully_validates[i] == []
64
73
  end
74
+ @strict_index_res
65
75
  end
66
76
  end
67
77
  end
@@ -33,11 +33,11 @@ module Fitting
33
33
  if @strict
34
34
  @coverage_responses.map do |response|
35
35
  response.strict_route if response.documented? && response.strict_fully_validates.valid?
36
- end.compact.uniq
36
+ end.flatten.compact.uniq
37
37
  else
38
38
  @coverage_responses.map do |response|
39
39
  response.route if response.documented? && response.fully_validates.valid?
40
- end.compact.uniq
40
+ end.flatten.compact.uniq
41
41
  end
42
42
  end
43
43
  end
@@ -7,6 +7,7 @@ module Fitting
7
7
  @white_list = white_list
8
8
  @resource_white_list = resource_white_list
9
9
  @resources = resources
10
+ @warnings = []
10
11
  end
11
12
 
12
13
  def to_a
@@ -15,13 +16,34 @@ module Fitting
15
16
  end
16
17
 
17
18
  def without_group
18
- @resource_white_list.inject([]) do |all_requests, asd|
19
- if asd[1] == []
20
- requests(@resources[asd[0]], all_requests)
21
- else
22
- requests(asd[1], all_requests)
23
- end
19
+ return @without_group_list if @without_group_list
20
+ @without_group_list = @resource_white_list.inject([]) do |all_requests, resource|
21
+ resource_selection(resource, all_requests)
24
22
  end.flatten.uniq
23
+ puts_warnings
24
+ @without_group_list
25
+ end
26
+
27
+ def resource_selection(resource, all_requests)
28
+ if resource[1] == []
29
+ find_warnings(resource[0])
30
+ requests(@resources[resource[0]], all_requests)
31
+ else
32
+ requests(resource[1], all_requests)
33
+ end
34
+ end
35
+
36
+ def find_warnings(resource)
37
+ return nil if @resources[resource]
38
+ @warnings.push(
39
+ "FITTING WARNING: In the documentation there isn't resource from the resource_white_list #{resource}"
40
+ )
41
+ end
42
+
43
+ def puts_warnings
44
+ return nil if @warnings == []
45
+ warnings_string = @warnings.join("\n")
46
+ puts "\n#{warnings_string}"
25
47
  end
26
48
 
27
49
  def requests(resource, all_requests)
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitting
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.efimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema