Class: OasParser::Parameter
- Inherits:
-
AbstractAttribute
- Object
- AbstractAttribute
- OasParser::Parameter
- Defined in:
- lib/oas_parser/parameter.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #convert_property_schema_to_properties(schema) ⇒ Object
- #default ⇒ Object
- #example ⇒ Object
- #format ⇒ Object
-
#initialize(owner, raw) ⇒ Parameter
constructor
A new instance of Parameter.
- #items ⇒ Object
- #type ⇒ Object
Methods inherited from AbstractAttribute
#allOf?, #array?, #collection?, #empty?, #enum, #has_xml_name?, #has_xml_options?, #is_xml_attribute?, #is_xml_text?, #name, #object?, #oneOf?, #properties, #subproperties_are_one_of_many?, #xml_name
Methods included from RawAccessor
included, #method_missing, #respond_to_missing?
Constructor Details
#initialize(owner, raw) ⇒ Parameter
Returns a new instance of Parameter.
8 9 10 11 12 |
# File 'lib/oas_parser/parameter.rb', line 8 def initialize(owner, raw) super(raw['name']) @owner = owner @raw = raw end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OasParser::RawAccessor
Instance Attribute Details
#owner ⇒ Object
Returns the value of attribute owner.
6 7 8 |
# File 'lib/oas_parser/parameter.rb', line 6 def owner @owner end |
#raw ⇒ Object
Returns the value of attribute raw.
6 7 8 |
# File 'lib/oas_parser/parameter.rb', line 6 def raw @raw end |
Instance Method Details
#convert_property_schema_to_properties(schema) ⇒ Object
34 35 36 37 38 |
# File 'lib/oas_parser/parameter.rb', line 34 def convert_property_schema_to_properties(schema) schema.map do |name, definition| OasParser::Property.new(self, raw, name, definition) end end |
#default ⇒ Object
30 31 32 |
# File 'lib/oas_parser/parameter.rb', line 30 def default raw['default'] || (schema ? schema['default'] : nil) end |
#example ⇒ Object
26 27 28 |
# File 'lib/oas_parser/parameter.rb', line 26 def example raw['example'] || (schema ? schema['example'] : nil) end |
#format ⇒ Object
18 19 20 |
# File 'lib/oas_parser/parameter.rb', line 18 def format raw['format'] || (schema ? schema['format'] : nil) end |
#items ⇒ Object
22 23 24 |
# File 'lib/oas_parser/parameter.rb', line 22 def items schema['items'] end |
#type ⇒ Object
14 15 16 |
# File 'lib/oas_parser/parameter.rb', line 14 def type raw['type'] || (schema ? schema['type'] : nil) end |