scorpio 0.6.4 → 0.7.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -1
  3. data/CHANGELOG.md +10 -2
  4. data/LICENSE.md +2 -4
  5. data/README.md +81 -67
  6. data/documents/{github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0 → spec.openapis.org/oas/3.0}/schema.yaml +164 -628
  7. data/documents/spec.openapis.org/oas/3.1/dialect/base.schema.yaml +22 -0
  8. data/documents/spec.openapis.org/oas/3.1/meta/base.schema.yaml +71 -0
  9. data/documents/spec.openapis.org/oas/3.1/schema-base.yaml +21 -0
  10. data/documents/spec.openapis.org/oas/3.1/schema.yaml +980 -0
  11. data/documents/swagger.io/v2/schema.json +1 -1
  12. data/documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest.yml +44 -4
  13. data/lib/scorpio/google_api_document.rb +121 -193
  14. data/lib/scorpio/openapi/document.rb +63 -31
  15. data/lib/scorpio/openapi/operation.rb +114 -96
  16. data/lib/scorpio/openapi/operations_scope.rb +35 -19
  17. data/lib/scorpio/openapi/reference.rb +88 -23
  18. data/lib/scorpio/openapi/schema_elements/type_nullable.rb +38 -0
  19. data/lib/scorpio/openapi/schema_elements.rb +7 -0
  20. data/lib/scorpio/openapi/server.rb +34 -0
  21. data/lib/scorpio/openapi/tag.rb +19 -3
  22. data/lib/scorpio/openapi/v2/dialect.rb +66 -0
  23. data/lib/scorpio/openapi/v2.rb +124 -0
  24. data/lib/scorpio/openapi/v3_0/dialect.rb +76 -0
  25. data/lib/scorpio/openapi/v3_0.rb +130 -0
  26. data/lib/scorpio/openapi/v3_1.rb +243 -0
  27. data/lib/scorpio/openapi.rb +23 -203
  28. data/lib/scorpio/request.rb +67 -61
  29. data/lib/scorpio/resource_base.rb +57 -49
  30. data/lib/scorpio/response.rb +28 -10
  31. data/lib/scorpio/ur.rb +7 -3
  32. data/lib/scorpio/version.rb +1 -1
  33. data/lib/scorpio.rb +12 -6
  34. data/pages/Request_Configuration.md +69 -0
  35. data/pages/Security.md +50 -0
  36. data/scorpio.gemspec +6 -5
  37. metadata +28 -15
  38. data/documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest +0 -684
  39. data/lib/scorpio/openapi/v3/server.rb +0 -44
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Scorpio
4
- module OpenAPI
5
- module V3
6
- raise(Bug, 'const_defined? Scorpio::OpenAPI::V3::Server') unless const_defined?(:Server)
7
-
8
- # An object representing a Server.
9
- #
10
- # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#serverObject
11
- module Server
12
- # expands this server's #url using the given_server_variables. any variables
13
- # that are in the url but not in the given server variables are filled in
14
- # using the default value for the variable.
15
- #
16
- # @param given_server_variables [Hash<String, String>]
17
- # @return [Addressable::URI] the expanded url
18
- def expanded_url(given_server_variables)
19
- if variables
20
- server_variables = (given_server_variables.keys | variables.keys).map do |key|
21
- server_variable = variables[key]
22
- if server_variable && server_variable.enum
23
- unless server_variable.enum.include?(given_server_variables[key])
24
- warn # TODO BLAME
25
- end
26
- end
27
- if given_server_variables.key?(key)
28
- {key => given_server_variables[key]}
29
- elsif server_variable.key?('default')
30
- {key => server_variable.default}
31
- else
32
- {}
33
- end
34
- end.inject({}, &:update)
35
- else
36
- server_variables = given_server_variables
37
- end
38
- template = Addressable::Template.new(url)
39
- template.expand(server_variables).freeze
40
- end
41
- end
42
- end
43
- end
44
- end