Module: Scorpio::OpenAPI::Server
Overview
An object representing a Server.
Instance Method Summary collapse
-
#expanded_url(given_server_variables) ⇒ Addressable::URI
expands this server's #url template using the given_server_variables.
Methods included from Document::Descendent
Instance Method Details
#expanded_url(given_server_variables) ⇒ Addressable::URI
expands this server's #url template using the given_server_variables. any variables that are in the url but not in the given server variables are filled in using the default value for the variable.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/scorpio/openapi/server.rb', line 15 def (given_server_variables) given_server_variables = JSI::Util.stringify_symbol_keys(given_server_variables) if variables server_variables = {} (given_server_variables.keys | variables.keys).each do |key| if given_server_variables.key?(key) server_variables[key] = given_server_variables[key] elsif variables[key].key?('default') server_variables[key] = variables[key].default end end else server_variables = given_server_variables end template = Addressable::Template.new(url) template.(server_variables).freeze end |