Module: TpagaService::Swagger

Defined in:
lib/tpaga_service/swagger.rb,
lib/tpaga_service/swagger/request.rb,
lib/tpaga_service/swagger/response.rb,
lib/tpaga_service/swagger/configuration.rb

Defined Under Namespace

Classes: Configuration, Request, Response

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

A Swagger configuration object. Must act like a hash and return sensible values for all Swagger configuration options. See Swagger::Configuration.



11
12
13
# File 'lib/tpaga_service/swagger.rb', line 11

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Call this method to modify defaults in your initializers.

Examples:

Swagger.configure do |config|
  config.private_api_key = '1234567890abcdef'     # private api key authentication
  config.public_api_key  = '9876543210fedcba'     # public api key authentication
  config.format = 'json'                  # optional, defaults to 'json'
end

Yields:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tpaga_service/swagger.rb', line 22

def configure
  yield(configuration) if block_given?

  # Configure logger.  Default to use Rails
  # self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT))

  # remove :// from scheme
  # configuration.scheme.sub!(/:\/\//, '')

  # remove http(s):// and anything after a slash
  configuration.host.sub!(/https?:\/\//, '')
  configuration.host = configuration.host.split('/').first

  # Add leading and trailing slashes to base_path
  configuration.base_path = "/#{configuration.base_path}".gsub(/\/+/, '/')
  configuration.base_path = "" if configuration.base_path == "/"
end