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



100
101
102
# File 'lib/swaggard/configuration.rb', line 100

def access_password
  @access_password ||= ''
end

#access_usernameObject



96
97
98
# File 'lib/swaggard/configuration.rb', line 96

def access_username
  @access_username ||= ''
end

#additional_parametersObject



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

def additional_parameters
  @additional_parameters ||= []
end

#api_base_pathObject



36
37
38
# File 'lib/swaggard/configuration.rb', line 36

def api_base_path
  @api_base_path ||= '/'
end

#api_formatsObject



40
41
42
# File 'lib/swaggard/configuration.rb', line 40

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

#api_versionObject



32
33
34
# File 'lib/swaggard/configuration.rb', line 32

def api_version
  @api_version ||= '0.1'
end

#authentication_keyObject



88
89
90
# File 'lib/swaggard/configuration.rb', line 88

def authentication_key
  @authentication_key ||= 'api_key'
end

#authentication_typeObject



84
85
86
# File 'lib/swaggard/configuration.rb', line 84

def authentication_type
  @authentication_type ||= 'query'
end

#authentication_valueObject



92
93
94
# File 'lib/swaggard/configuration.rb', line 92

def authentication_value
  @authentication_value ||= ''
end

#contact_emailObject



68
69
70
# File 'lib/swaggard/configuration.rb', line 68

def contact_email
  @contact_email ||= ''
end

#contact_nameObject



64
65
66
# File 'lib/swaggard/configuration.rb', line 64

def contact_name
  @contact_name ||= ''
end

#contact_urlObject



72
73
74
# File 'lib/swaggard/configuration.rb', line 72

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

#custom_typesObject (readonly)

Returns the value of attribute custom_types.



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

def custom_types
  @custom_types
end

#default_content_typeObject



104
105
106
# File 'lib/swaggard/configuration.rb', line 104

def default_content_type
  @default_content_type ||= ''
end

#default_response_descriptionObject



112
113
114
# File 'lib/swaggard/configuration.rb', line 112

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

#default_response_status_codeObject



108
109
110
# File 'lib/swaggard/configuration.rb', line 108

def default_response_status_code
  @default_response_status_code ||= 'default'
end

#descriptionObject



56
57
58
# File 'lib/swaggard/configuration.rb', line 56

def description
  @description ||= ''
end

#exclude_base_path_from_pathsObject



122
123
124
125
126
# File 'lib/swaggard/configuration.rb', line 122

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



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

def excluded_paths
  @excluded_paths ||= []
end

#hostObject



44
45
46
# File 'lib/swaggard/configuration.rb', line 44

def host
  @host ||= ''
end

#ignore_put_if_patch_existsObject



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

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



116
117
118
119
120
# File 'lib/swaggard/configuration.rb', line 116

def ignore_undocumented_paths
  return @ignore_undocumented_paths unless @ignore_undocumented_paths.nil?

  @ignore_undocumented_paths = false
end

#languageObject



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

def language
  @language ||= 'en'
end

#license_nameObject



76
77
78
# File 'lib/swaggard/configuration.rb', line 76

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



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

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



48
49
50
# File 'lib/swaggard/configuration.rb', line 48

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

#swagger_versionObject



28
29
30
# File 'lib/swaggard/configuration.rb', line 28

def swagger_version
  @swagger_version ||= '2.0'
end

#titleObject



52
53
54
# File 'lib/swaggard/configuration.rb', line 52

def title
  @title ||= ''
end

#tosObject



60
61
62
# File 'lib/swaggard/configuration.rb', line 60

def tos
  @tos ||= ''
end

#use_cacheObject



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

def use_cache
  @use_cache ||= false
end

Instance Method Details

#add_custom_type(name, definition) ⇒ Object



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

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

#license_urlObject



80
81
82
# File 'lib/swaggard/configuration.rb', line 80

def license_url
  @license_url ||= ''
end