Class: OasParser::Parameter

Inherits:
AbstractAttribute show all
Defined in:
lib/oas_parser/parameter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ownerObject

Returns the value of attribute owner.



6
7
8
# File 'lib/oas_parser/parameter.rb', line 6

def owner
  @owner
end

#rawObject

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

#defaultObject



30
31
32
# File 'lib/oas_parser/parameter.rb', line 30

def default
  raw['default'] || (schema ? schema['default'] : nil)
end

#exampleObject



26
27
28
# File 'lib/oas_parser/parameter.rb', line 26

def example
  raw['example'] || (schema ? schema['example'] : nil)
end

#formatObject



18
19
20
# File 'lib/oas_parser/parameter.rb', line 18

def format
  raw['format'] || (schema ? schema['format'] : nil)
end

#itemsObject



22
23
24
# File 'lib/oas_parser/parameter.rb', line 22

def items
  schema['items']
end

#typeObject



14
15
16
# File 'lib/oas_parser/parameter.rb', line 14

def type
  raw['type'] || (schema ? schema['type'] : nil)
end