fitting 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +7 -0
  4. data/lib/fitting.rb +1 -3
  5. data/lib/fitting/configuration.rb +41 -11
  6. data/lib/fitting/configuration/legacy.rb +41 -0
  7. data/lib/fitting/configuration/yaml.rb +60 -0
  8. data/lib/fitting/matchers/response_matcher.rb +33 -14
  9. data/lib/fitting/records/documented/request.rb +53 -0
  10. data/lib/fitting/records/tested/request.rb +30 -0
  11. data/lib/fitting/records/tested/response.rb +19 -0
  12. data/lib/fitting/records/unit/json_schema.rb +25 -0
  13. data/lib/fitting/records/unit/request.rb +36 -0
  14. data/lib/fitting/records/unit/response.rb +31 -0
  15. data/lib/fitting/statistics.rb +14 -19
  16. data/lib/fitting/statistics/analysis.rb +24 -0
  17. data/lib/fitting/statistics/great.rb +13 -0
  18. data/lib/fitting/statistics/list.rb +45 -0
  19. data/lib/fitting/statistics/lists.rb +52 -0
  20. data/lib/fitting/statistics/measurement.rb +94 -0
  21. data/lib/fitting/statistics/not_covered_responses.rb +13 -0
  22. data/lib/fitting/statistics/percent.rb +19 -0
  23. data/lib/fitting/statistics/requests_stats.rb +40 -0
  24. data/lib/fitting/statistics/responses_stats.rb +32 -0
  25. data/lib/fitting/statistics/template.rb +90 -0
  26. data/lib/fitting/storage/responses.rb +6 -28
  27. data/lib/fitting/version.rb +1 -1
  28. metadata +20 -11
  29. data/lib/fitting/route.rb +0 -28
  30. data/lib/fitting/route/coverage.rb +0 -45
  31. data/lib/fitting/route/requests.rb +0 -25
  32. data/lib/fitting/route/requests/combine.rb +0 -113
  33. data/lib/fitting/route/requests/coverage.rb +0 -58
  34. data/lib/fitting/route/requests/lists.rb +0 -92
  35. data/lib/fitting/route/requests/statistics.rb +0 -40
  36. data/lib/fitting/route/responses.rb +0 -24
  37. data/lib/fitting/storage/documentation.rb +0 -22
@@ -1,40 +0,0 @@
1
- module Fitting
2
- class Route
3
- class Requests
4
- class Statistics
5
- def initialize(combine)
6
- @full_count = combine.full_cover.size
7
- @part_count = combine.partial_cover.size
8
- @no_count = combine.no_cover.size
9
- end
10
-
11
- def to_s
12
- @to_s ||= [
13
- "API requests with fully implemented responses: #{@full_count} (#{full_percent}% of #{total_count}).",
14
- "API requests with partially implemented responses: #{@part_count} (#{part_percent}% of #{total_count}).",
15
- "API requests with no implemented responses: #{@no_count} (#{no_percent}% of #{total_count})."
16
- ].join("\n")
17
- end
18
-
19
- def total_count
20
- @total_count ||= @full_count + @part_count + @no_count
21
- end
22
-
23
- def full_percent
24
- @full_percentage ||= 0.0 if total_count.zero?
25
- @full_percentage ||= (@full_count.to_f / total_count.to_f * 100.0).round(2)
26
- end
27
-
28
- def part_percent
29
- @part_percentage ||= 0.0 if total_count.zero?
30
- @part_percentage ||= (@part_count.to_f / total_count.to_f * 100.0).round(2)
31
- end
32
-
33
- def no_percent
34
- @no_percentage ||= 0.0 if total_count.zero?
35
- @no_percentage ||= (@no_count.to_f / total_count.to_f * 100.0).round(2)
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,24 +0,0 @@
1
- module Fitting
2
- class Route
3
- class Responses
4
- def initialize(routes, coverage)
5
- @routes = routes
6
- @coverage = coverage
7
- end
8
-
9
- def statistics
10
- valid_count = @coverage.coverage.size
11
- valid_percentage = @coverage.cover_ratio
12
- total_count = @routes.size
13
- invalid_count = @coverage.not_coverage.size
14
- invalid_percentage = (100.0 - @coverage.cover_ratio).round(2)
15
-
16
- [
17
- "API responses conforming to the blueprint: #{valid_count} (#{valid_percentage}% of #{total_count}).",
18
- 'API responses with validation errors or untested: '\
19
- "#{invalid_count} (#{invalid_percentage}% of #{total_count})."
20
- ].join("\n")
21
- end
22
- end
23
- end
24
- end
@@ -1,22 +0,0 @@
1
- require 'fitting/configuration'
2
- require 'tomograph'
3
-
4
- module Fitting
5
- module Storage
6
- module Documentation
7
- class << self
8
- def tomogram
9
- @tomogram ||= craft
10
- end
11
-
12
- def craft
13
- Tomograph::Tomogram.new(
14
- prefix: Fitting.configuration.prefix,
15
- apib_path: Fitting.configuration.apib_path,
16
- drafter_yaml_path: Fitting.configuration.drafter_yaml_path
17
- )
18
- end
19
- end
20
- end
21
- end
22
- end