Class: ApiSchema::Configuration

Inherits:
Object
  • Object
show all
Includes:
Swagger::Blocks::ClassMethods
Defined in:
lib/api_schema/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
# File 'lib/api_schema/configuration.rb', line 12

def initialize
  @error_model = 'error_model'
  @consumes = 'application/json'
  @produces = 'application/json'
end

Instance Attribute Details

#authorizationObject

Returns the value of attribute authorization.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def authorization
  @authorization
end

#base_pathObject

Returns the value of attribute base_path.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def base_path
  @base_path
end

#consumesObject

Returns the value of attribute consumes.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def consumes
  @consumes
end

#contact_nameObject

Returns the value of attribute contact_name.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def contact_name
  @contact_name
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def description
  @description
end

#descriptions_pathObject

Returns the value of attribute descriptions_path.



10
11
12
# File 'lib/api_schema/configuration.rb', line 10

def descriptions_path
  @descriptions_path
end

#error_descObject

Returns the value of attribute error_desc.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def error_desc
  @error_desc
end

#error_modelObject

Returns the value of attribute error_model.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def error_model
  @error_model
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def host
  @host
end

#producesObject

Returns the value of attribute produces.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def produces
  @produces
end

#terms_of_serviceObject

Returns the value of attribute terms_of_service.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def terms_of_service
  @terms_of_service
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def title
  @title
end

#versionObject

Returns the value of attribute version.



5
6
7
# File 'lib/api_schema/configuration.rb', line 5

def version
  @version
end

Instance Method Details

#buildObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/api_schema/configuration.rb', line 22

def build
  configuration = self
  swagger_root do
    key :swagger, '2.0'
    info do
      key :version, configuration.version
      key :title, configuration.title
      key :description, configuration.description
      key :termsOfService, configuration.terms_of_service
      contact do
        key :name, configuration.contact_name
      end
    end
    security_definition :authorization do
      key :name, :Authorization
      key :type, :apiKey
      key :in, :header
    end if configuration.authorization
    key :host, configuration.host
    key :basePath, configuration.base_path
    key :consumes, configuration.consumes
    key :produces, configuration.produces
  end
end