Module: Scorpio::OpenAPI::Document::V2Methods::Configurables
- Included in:
- Scorpio::OpenAPI::Document::V2Methods
- Defined in:
- lib/scorpio/openapi/document.rb
Instance Attribute Summary collapse
-
#base_url(scheme: self.scheme, server: nil, server_variables: nil) ⇒ Object
the base url to which paths are appended.
- #request_media_type ⇒ Object
- #scheme ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#base_url(scheme: self.scheme, server: nil, server_variables: nil) ⇒ Object
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.
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/scorpio/openapi/document.rb', line 186 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, ).freeze end end |
#request_media_type ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'lib/scorpio/openapi/document.rb', line 198 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 ⇒ Object
165 166 167 168 169 170 171 172 173 |
# File 'lib/scorpio/openapi/document.rb', line 165 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 |
Instance Method Details
#server ⇒ Object
175 176 177 |
# File 'lib/scorpio/openapi/document.rb', line 175 def server nil end |
#server_variables ⇒ Object
178 179 180 |
# File 'lib/scorpio/openapi/document.rb', line 178 def server_variables nil end |