Class: Swaggard::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/swaggard/configuration.rb

Overview

Configuration for Swagger Yard, use like:

Swaggard.configure do |config|
  config.api_version            = '0.1'
  config.api_base_path          = '/api'
  config.authentication_type    = 'header'
  config.authentication_key     = 'X-AUTHORIZATION'
  config.authentication_value   = 'you-secret-key'
  config.additional_parameters  = [{ key: 'STORE-CODE', type: 'header', value: '1' }]
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_passwordObject



98
99
100
# File 'lib/swaggard/configuration.rb', line 98

def access_password
  @access_password ||= ''
end

#access_usernameObject



94
95
96
# File 'lib/swaggard/configuration.rb', line 94

def access_username
  @access_username ||= ''
end

#additional_parametersObject



136
137
138
# File 'lib/swaggard/configuration.rb', line 136

def additional_parameters
  @additional_parameters ||= []
end

#api_base_pathObject



34
35
36
# File 'lib/swaggard/configuration.rb', line 34

def api_base_path
  @api_base_path ||= '/'
end

#api_formatsObject



38
39
40
# File 'lib/swaggard/configuration.rb', line 38

def api_formats
  @api_formats ||= [:xml, :json]
end

#api_versionObject



30
31
32
# File 'lib/swaggard/configuration.rb', line 30

def api_version
  @api_version ||= '0.1'
end

#authentication_keyObject



86
87
88
# File 'lib/swaggard/configuration.rb', line 86

def authentication_key
  @authentication_key ||= 'api_key'
end

#authentication_typeObject



82
83
84
# File 'lib/swaggard/configuration.rb', line 82

def authentication_type
  @authentication_type ||= 'query'
end

#authentication_valueObject



90
91
92
# File 'lib/swaggard/configuration.rb', line 90

def authentication_value
  @authentication_value ||= ''
end

#contact_emailObject



66
67
68
# File 'lib/swaggard/configuration.rb', line 66

def contact_email
  @contact_email ||= ''
end

#contact_nameObject



62
63
64
# File 'lib/swaggard/configuration.rb', line 62

def contact_name
  @contact_name ||= ''
end

#contact_urlObject



70
71
72
# File 'lib/swaggard/configuration.rb', line 70

def contact_url
  @contact_url ||= ''
end

#controllers_pathObject

Returns the value of attribute controllers_path.



15
16
17
# File 'lib/swaggard/configuration.rb', line 15

def controllers_path
  @controllers_path
end

#default_content_typeObject



102
103
104
# File 'lib/swaggard/configuration.rb', line 102

def default_content_type
  @default_content_type ||= ''
end

#default_response_descriptionObject



110
111
112
# File 'lib/swaggard/configuration.rb', line 110

def default_response_description
  @default_response_description ||= 'successful operation'
end

#default_response_status_codeObject



106
107
108
# File 'lib/swaggard/configuration.rb', line 106

def default_response_status_code
  @default_response_status_code ||= 'default'
end

#descriptionObject



54
55
56
# File 'lib/swaggard/configuration.rb', line 54

def description
  @description ||= ''
end

#exclude_base_path_from_pathsObject



126
127
128
129
130
# File 'lib/swaggard/configuration.rb', line 126

def exclude_base_path_from_paths
  return @exclude_base_path_from_paths unless @exclude_base_path_from_paths.nil?

  @exclude_base_path_from_paths = false
end

#excluded_pathsObject



148
149
150
# File 'lib/swaggard/configuration.rb', line 148

def excluded_paths
  @excluded_paths ||= []
end

#hostObject



42
43
44
# File 'lib/swaggard/configuration.rb', line 42

def host
  @host ||= ''
end

#ignore_put_if_patch_existsObject



168
169
170
171
172
# File 'lib/swaggard/configuration.rb', line 168

def ignore_put_if_patch_exists
  return @ignore_put_if_patch_exists unless @ignore_put_if_patch_exists.nil?

  @ignore_put_if_patch_exists = false
end

#ignore_undocumented_pathsObject



114
115
116
117
118
# File 'lib/swaggard/configuration.rb', line 114

def ignore_undocumented_paths
  return @ignore_undocumented_paths unless @ignore_undocumented_paths.nil?

  @ignore_undocumented_paths = false
end

#ignore_untagged_controllersObject



120
121
122
123
124
# File 'lib/swaggard/configuration.rb', line 120

def ignore_untagged_controllers
  return @ignore_untagged_controllers unless @ignore_untagged_controllers.nil?

  @ignore_untagged_controllers = true
end

#languageObject



132
133
134
# File 'lib/swaggard/configuration.rb', line 132

def language
  @language ||= 'en'
end

#license_nameObject



74
75
76
# File 'lib/swaggard/configuration.rb', line 74

def license_name
  @license_name ||= ''
end

#models_pathsObject

Returns the value of attribute models_paths.



15
16
17
# File 'lib/swaggard/configuration.rb', line 15

def models_paths
  @models_paths
end

#path_parameter_descriptionObject



164
165
166
# File 'lib/swaggard/configuration.rb', line 164

def path_parameter_description
  @path_parameter_description ||= ->(path_parameter) { "Scope response to #{path_parameter.name}" }
end

#routesObject

Returns the value of attribute routes.



15
16
17
# File 'lib/swaggard/configuration.rb', line 15

def routes
  @routes
end

#schemesObject



46
47
48
# File 'lib/swaggard/configuration.rb', line 46

def schemes
  @schemes ||= [:https, :http]
end

#swagger_versionObject



26
27
28
# File 'lib/swaggard/configuration.rb', line 26

def swagger_version
  @swagger_version ||= '2.0'
end

#titleObject



50
51
52
# File 'lib/swaggard/configuration.rb', line 50

def title
  @title ||= ''
end

#tosObject



58
59
60
# File 'lib/swaggard/configuration.rb', line 58

def tos
  @tos ||= ''
end

#use_cacheObject



140
141
142
# File 'lib/swaggard/configuration.rb', line 140

def use_cache
  @use_cache ||= false
end

Instance Method Details

#add_custom_type(name, definition) ⇒ Object



152
153
154
# File 'lib/swaggard/configuration.rb', line 152

def add_custom_type(name, definition)
  custom_types[name] = definition
end

#add_definition(definition) ⇒ Object



160
161
162
# File 'lib/swaggard/configuration.rb', line 160

def add_definition(definition)
  definitions[definition.id] = definition
end

#add_security(authentication_key, scopes = []) ⇒ Object



186
187
188
# File 'lib/swaggard/configuration.rb', line 186

def add_security(authentication_key, scopes = [])
  security << { authentication_key => scopes }
end

#add_security_definition(authentication_key, definition) ⇒ Object



182
183
184
# File 'lib/swaggard/configuration.rb', line 182

def add_security_definition(authentication_key, definition)
  security_definitions[authentication_key] = definition
end

#custom_typesObject



144
145
146
# File 'lib/swaggard/configuration.rb', line 144

def custom_types
  @custom_types ||= {}
end

#definitionsObject



156
157
158
# File 'lib/swaggard/configuration.rb', line 156

def definitions
  @definitions ||= {}
end

#license_urlObject



78
79
80
# File 'lib/swaggard/configuration.rb', line 78

def license_url
  @license_url ||= ''
end

#securityObject



178
179
180
# File 'lib/swaggard/configuration.rb', line 178

def security
  @security ||= []
end

#security_definitionsObject



174
175
176
# File 'lib/swaggard/configuration.rb', line 174

def security_definitions
  @security_definitions ||= {}
end