Class: DynApiGen::Parameter
- Inherits:
-
Object
- Object
- DynApiGen::Parameter
- Defined in:
- lib/dyn_api_gen/parameter.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#in ⇒ Object
readonly
Returns the value of attribute in.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
- #header? ⇒ Boolean
-
#initialize(openapi_definition) ⇒ Parameter
constructor
A new instance of Parameter.
- #to_method_name ⇒ Object
Constructor Details
#initialize(openapi_definition) ⇒ Parameter
Returns a new instance of Parameter.
7 8 9 10 |
# File 'lib/dyn_api_gen/parameter.rb', line 7 def initialize(openapi_definition) @name, @in, @required = openapi_definition.fetch_values('name', 'in', 'required') @default = openapi_definition['default'] end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
5 6 7 |
# File 'lib/dyn_api_gen/parameter.rb', line 5 def default @default end |
#in ⇒ Object (readonly)
Returns the value of attribute in.
5 6 7 |
# File 'lib/dyn_api_gen/parameter.rb', line 5 def in @in end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dyn_api_gen/parameter.rb', line 5 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
5 6 7 |
# File 'lib/dyn_api_gen/parameter.rb', line 5 def required @required end |
Instance Method Details
#header? ⇒ Boolean
12 13 14 |
# File 'lib/dyn_api_gen/parameter.rb', line 12 def header? @in == 'header' end |
#to_method_name ⇒ Object
16 17 18 |
# File 'lib/dyn_api_gen/parameter.rb', line 16 def to_method_name @name.gsub(/(\[|\])/, '[' => '_', ']' => '').downcase end |