module Scorpio::OpenAPI::V2::Document::Configurables

Attributes

base_url[W]
request_media_type[W]
scheme[W]

Public Instance Methods

base_url(scheme: self.scheme, server: nil, server_variables: nil) click to toggle source

the base url to which paths are appended. by default this looks at the openapi document's schemes, picking https or http first. it looks at the openapi_document's host and basePath.

# File lib/scorpio/openapi/document.rb, line 153
def base_url(scheme: self.scheme, server: nil, server_variables: nil)
  return @base_url if instance_variable_defined?(:@base_url)
  if host && scheme
    Addressable::URI.new(
      scheme: scheme,
      host: host,
      path: basePath,
    ).to_s
  end
end
request_media_type() click to toggle source
# File lib/scorpio/openapi/document.rb, line 165
def request_media_type
  return @request_media_type if instance_variable_defined?(:@request_media_type)
  if consumes.respond_to?(:to_ary)
    Request.best_media_type(consumes)
  else
    nil
  end
end
scheme() click to toggle source
# File lib/scorpio/openapi/document.rb, line 132
def scheme
  return @scheme if instance_variable_defined?(:@scheme)
  if schemes.nil?
    'https'
  elsif schemes.respond_to?(:to_ary)
    # prefer https, then http, then anything else since we probably don't support.
    schemes.sort_by { |s| ['https', 'http'].index(s) || (1.0 / 0) }.first
  end
end
server() click to toggle source
# File lib/scorpio/openapi/document.rb, line 142
def server
  nil
end
server_variables() click to toggle source
# File lib/scorpio/openapi/document.rb, line 145
def server_variables
  nil
end