Class: Swaggard::Configuration
- Inherits:
-
Object
- Object
- Swaggard::Configuration
- 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
- #access_password ⇒ Object
- #access_username ⇒ Object
- #additional_parameters ⇒ Object
- #api_base_path ⇒ Object
- #api_formats ⇒ Object
- #api_version ⇒ Object
- #authentication_key ⇒ Object
- #authentication_type ⇒ Object
- #authentication_value ⇒ Object
- #contact_email ⇒ Object
- #contact_name ⇒ Object
- #contact_url ⇒ Object
-
#controllers_path ⇒ Object
Returns the value of attribute controllers_path.
- #default_content_type ⇒ Object
- #default_response_description ⇒ Object
- #default_response_status_code ⇒ Object
- #description ⇒ Object
- #exclude_base_path_from_paths ⇒ Object
- #excluded_paths ⇒ Object
- #host ⇒ Object
- #ignore_put_if_patch_exists ⇒ Object
- #ignore_undocumented_paths ⇒ Object
- #ignore_untagged_controllers ⇒ Object
- #language ⇒ Object
- #license_name ⇒ Object
-
#models_paths ⇒ Object
Returns the value of attribute models_paths.
- #path_parameter_description ⇒ Object
-
#routes ⇒ Object
Returns the value of attribute routes.
- #schemes ⇒ Object
- #swagger_version ⇒ Object
- #title ⇒ Object
- #tos ⇒ Object
- #use_cache ⇒ Object
Instance Method Summary collapse
- #add_custom_type(name, definition) ⇒ Object
- #add_definition(definition) ⇒ Object
- #add_security(authentication_key, scopes = []) ⇒ Object
- #add_security_definition(authentication_key, definition) ⇒ Object
- #custom_types ⇒ Object
- #definitions ⇒ Object
- #license_url ⇒ Object
- #security ⇒ Object
- #security_definitions ⇒ Object
Instance Attribute Details
#access_password ⇒ Object
98 99 100 |
# File 'lib/swaggard/configuration.rb', line 98 def access_password @access_password ||= '' end |
#access_username ⇒ Object
94 95 96 |
# File 'lib/swaggard/configuration.rb', line 94 def access_username @access_username ||= '' end |
#additional_parameters ⇒ Object
136 137 138 |
# File 'lib/swaggard/configuration.rb', line 136 def additional_parameters @additional_parameters ||= [] end |
#api_base_path ⇒ Object
34 35 36 |
# File 'lib/swaggard/configuration.rb', line 34 def api_base_path @api_base_path ||= '/' end |
#api_formats ⇒ Object
38 39 40 |
# File 'lib/swaggard/configuration.rb', line 38 def api_formats @api_formats ||= [:xml, :json] end |
#api_version ⇒ Object
30 31 32 |
# File 'lib/swaggard/configuration.rb', line 30 def api_version @api_version ||= '0.1' end |
#authentication_key ⇒ Object
86 87 88 |
# File 'lib/swaggard/configuration.rb', line 86 def authentication_key @authentication_key ||= 'api_key' end |
#authentication_type ⇒ Object
82 83 84 |
# File 'lib/swaggard/configuration.rb', line 82 def authentication_type @authentication_type ||= 'query' end |
#authentication_value ⇒ Object
90 91 92 |
# File 'lib/swaggard/configuration.rb', line 90 def authentication_value @authentication_value ||= '' end |
#contact_email ⇒ Object
66 67 68 |
# File 'lib/swaggard/configuration.rb', line 66 def contact_email @contact_email ||= '' end |
#contact_name ⇒ Object
62 63 64 |
# File 'lib/swaggard/configuration.rb', line 62 def contact_name @contact_name ||= '' end |
#contact_url ⇒ Object
70 71 72 |
# File 'lib/swaggard/configuration.rb', line 70 def contact_url @contact_url ||= '' end |
#controllers_path ⇒ Object
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_type ⇒ Object
102 103 104 |
# File 'lib/swaggard/configuration.rb', line 102 def default_content_type @default_content_type ||= '' end |
#default_response_description ⇒ Object
110 111 112 |
# File 'lib/swaggard/configuration.rb', line 110 def default_response_description @default_response_description ||= 'successful operation' end |
#default_response_status_code ⇒ Object
106 107 108 |
# File 'lib/swaggard/configuration.rb', line 106 def default_response_status_code @default_response_status_code ||= 'default' end |
#description ⇒ Object
54 55 56 |
# File 'lib/swaggard/configuration.rb', line 54 def description @description ||= '' end |
#exclude_base_path_from_paths ⇒ Object
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_paths ⇒ Object
148 149 150 |
# File 'lib/swaggard/configuration.rb', line 148 def excluded_paths @excluded_paths ||= [] end |
#host ⇒ Object
42 43 44 |
# File 'lib/swaggard/configuration.rb', line 42 def host @host ||= '' end |
#ignore_put_if_patch_exists ⇒ Object
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_paths ⇒ Object
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_controllers ⇒ Object
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 |
#language ⇒ Object
132 133 134 |
# File 'lib/swaggard/configuration.rb', line 132 def language @language ||= 'en' end |
#license_name ⇒ Object
74 75 76 |
# File 'lib/swaggard/configuration.rb', line 74 def license_name @license_name ||= '' end |
#models_paths ⇒ Object
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_description ⇒ Object
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 |
#routes ⇒ Object
Returns the value of attribute routes.
15 16 17 |
# File 'lib/swaggard/configuration.rb', line 15 def routes @routes end |
#schemes ⇒ Object
46 47 48 |
# File 'lib/swaggard/configuration.rb', line 46 def schemes @schemes ||= [:https, :http] end |
#swagger_version ⇒ Object
26 27 28 |
# File 'lib/swaggard/configuration.rb', line 26 def swagger_version @swagger_version ||= '2.0' end |
#title ⇒ Object
50 51 52 |
# File 'lib/swaggard/configuration.rb', line 50 def title @title ||= '' end |
#tos ⇒ Object
58 59 60 |
# File 'lib/swaggard/configuration.rb', line 58 def tos @tos ||= '' end |
#use_cache ⇒ Object
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_types ⇒ Object
144 145 146 |
# File 'lib/swaggard/configuration.rb', line 144 def custom_types @custom_types ||= {} end |
#definitions ⇒ Object
156 157 158 |
# File 'lib/swaggard/configuration.rb', line 156 def definitions @definitions ||= {} end |
#license_url ⇒ Object
78 79 80 |
# File 'lib/swaggard/configuration.rb', line 78 def license_url @license_url ||= '' end |
#security ⇒ Object
178 179 180 |
# File 'lib/swaggard/configuration.rb', line 178 def security @security ||= [] end |
#security_definitions ⇒ Object
174 175 176 |
# File 'lib/swaggard/configuration.rb', line 174 def security_definitions @security_definitions ||= {} end |