Sha256: 3654be7c13c164a84e1893222a9d476f768fd30eb5069b5135a1be8a30cdd91c

Contents?: true

Size: 681 Bytes

Versions: 7

Compression:

Stored size: 681 Bytes

Contents

module SwaggerYard
  class Info
    def to_h
      {
        "title"       => SwaggerYard.config.title,
        "description" => SwaggerYard.config.description,
        "version"     => SwaggerYard.config.api_version
      }
    end
  end

  class Swagger
    def to_h
      {
        "swagger"  => "2.0",
        "info"     => Info.new.to_h
      }.merge(uri_info).merge(ResourceListing.all.to_h)
    end

    private

    def uri_info
      uri = URI(SwaggerYard.config.api_base_path)
      host = uri.host
      host = "#{uri.host}:#{uri.port}" unless uri.port == uri.default_port

      {
        'host' => host,
        'basePath' => uri.request_uri
      }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
swagger_yard-0.4.4 lib/swagger_yard/swagger.rb
swagger_yard-0.4.3 lib/swagger_yard/swagger.rb
swagger_yard-0.4.2 lib/swagger_yard/swagger.rb
swagger_yard-0.4.1 lib/swagger_yard/swagger.rb
swagger_yard-0.4.0 lib/swagger_yard/swagger.rb
swagger_yard-0.3.7 lib/swagger_yard/swagger.rb
swagger_yard-0.3.6 lib/swagger_yard/swagger.rb