Class: OasCore::Spec::Parameter
- Inherits:
-
Object
- Object
- OasCore::Spec::Parameter
- Defined in:
- lib/oas_core/spec/parameter.rb
Constant Summary collapse
- STYLE_DEFAULTS =
{ query: 'form', path: 'simple', header: 'simple', cookie: 'form' }.freeze
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#in ⇒ Object
Returns the value of attribute in.
-
#name ⇒ Object
Returns the value of attribute name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(specification) ⇒ Parameter
constructor
A new instance of Parameter.
- #oas_fields ⇒ Object
- #required? ⇒ Boolean
Methods included from Hashable
generate_hash, #hash_key, #hash_representation, hash_representation_recursive, #public_instance_variables
Methods included from Specable
Constructor Details
#initialize(specification) ⇒ Parameter
Returns a new instance of Parameter.
14 15 16 17 18 19 20 21 22 |
# File 'lib/oas_core/spec/parameter.rb', line 14 def initialize(specification) @specification = specification @name = '' @in = '' @description = '' @required = false @style = '' @schema = { type: 'string' } end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/oas_core/spec/parameter.rb', line 11 def description @description end |
#in ⇒ Object
Returns the value of attribute in.
12 13 14 |
# File 'lib/oas_core/spec/parameter.rb', line 12 def in @in end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/oas_core/spec/parameter.rb', line 11 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
11 12 13 |
# File 'lib/oas_core/spec/parameter.rb', line 11 def required @required end |
#schema ⇒ Object
Returns the value of attribute schema.
11 12 13 |
# File 'lib/oas_core/spec/parameter.rb', line 11 def schema @schema end |
#style ⇒ Object
Returns the value of attribute style.
11 12 13 |
# File 'lib/oas_core/spec/parameter.rb', line 11 def style @style end |
Instance Method Details
#oas_fields ⇒ Object
34 35 36 |
# File 'lib/oas_core/spec/parameter.rb', line 34 def oas_fields %i[name in description required schema style] end |
#required? ⇒ Boolean
30 31 32 |
# File 'lib/oas_core/spec/parameter.rb', line 30 def required? @in == 'path' end |