Module: Swagger
- Defined in:
- lib/swagger.rb,
lib/swagger/api.rb,
lib/swagger/uri.rb,
lib/swagger/schema.rb,
lib/swagger/v2/api.rb,
lib/swagger/v2/tag.rb,
lib/swagger/boolean.rb,
lib/swagger/builder.rb,
lib/swagger/parsers.rb,
lib/swagger/v2/info.rb,
lib/swagger/v2/path.rb,
lib/swagger/version.rb,
lib/swagger/mime_type.rb,
lib/swagger/v2/header.rb,
lib/swagger/attachable.rb,
lib/swagger/v2/example.rb,
lib/swagger/v2/response.rb,
lib/swagger/uri_template.rb,
lib/swagger/v2/operation.rb,
lib/swagger/v2/parameter.rb,
lib/swagger/swagger_object.rb,
lib/swagger/v2/security_scheme.rb,
lib/swagger/v2/security_requirement.rb,
lib/swagger/v2/deterministic_json_schema.rb
Overview
Provides loading and building capabilities for Swagger.
Defined Under Namespace
Modules: Attachable, Bash, Builder, Parsers, V2 Classes: API, Boolean, InvalidDefinition, MimeType, Schema, SwaggerObject, URI, URITemplate
Constant Summary collapse
- RESOURCES_DIR =
File. '../../resources/', __FILE__
- VERSION =
'0.3.0'.freeze
Class Method Summary collapse
-
.build(content, opts = {}) ⇒ Object
Instantiates a Swagger::API from the content.
-
.builder(opts = {}) ⇒ Object
Creates a Swagger::Builder that can be used to create a Swagger document.
-
.load(file, opts = {}) ⇒ Object
Load a Swagger document from a file.
Class Method Details
.build(content, opts = {}) ⇒ Object
Instantiates a Swagger::API from the content.
22 23 24 25 26 |
# File 'lib/swagger.rb', line 22 def self.build(content, opts = {}) parser ||= Swagger::Parsers.parser_for(opts[:format]) content = parser.parse(content) unless parser.nil? Swagger::API.build_api(content) end |
.builder(opts = {}) ⇒ Object
Creates a Swagger::Builder that can be used to create a Swagger document.
43 44 45 |
# File 'lib/swagger.rb', line 43 def self.builder(opts = {}) Swagger::Builder.builder(opts) end |
.load(file, opts = {}) ⇒ Object
Load a Swagger document from a file.
32 33 34 35 36 37 |
# File 'lib/swagger.rb', line 32 def self.load(file, opts = {}) ext = File.extname file opts[:format] = ext content = File.read(file) build(content, opts) end |