Class: OasRails::Spec::Parameter
- Inherits:
-
Object
- Object
- OasRails::Spec::Parameter
- Defined in:
- lib/oas_rails/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.
12 13 14 15 16 17 18 19 20 |
# File 'lib/oas_rails/spec/parameter.rb', line 12 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.
9 10 11 |
# File 'lib/oas_rails/spec/parameter.rb', line 9 def description @description end |
#in ⇒ Object
Returns the value of attribute in.
10 11 12 |
# File 'lib/oas_rails/spec/parameter.rb', line 10 def in @in end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/oas_rails/spec/parameter.rb', line 9 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
9 10 11 |
# File 'lib/oas_rails/spec/parameter.rb', line 9 def required @required end |
#schema ⇒ Object
Returns the value of attribute schema.
9 10 11 |
# File 'lib/oas_rails/spec/parameter.rb', line 9 def schema @schema end |
#style ⇒ Object
Returns the value of attribute style.
9 10 11 |
# File 'lib/oas_rails/spec/parameter.rb', line 9 def style @style end |
Instance Method Details
#oas_fields ⇒ Object
32 33 34 |
# File 'lib/oas_rails/spec/parameter.rb', line 32 def oas_fields [:name, :in, :description, :required, :schema, :style] end |
#required? ⇒ Boolean
28 29 30 |
# File 'lib/oas_rails/spec/parameter.rb', line 28 def required? @in == 'path' end |