Class: OasParser::RequestBody

Inherits:
Payload
  • Object
show all
Includes:
RawAccessor
Defined in:
lib/oas_parser/request_body.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RawAccessor

included, #method_missing, #respond_to_missing?

Methods inherited from Payload

#exhibits_one_of_multiple_schemas?, #formats, #schema, #split_schemas

Constructor Details

#initialize(endpoint, raw) ⇒ RequestBody

Returns a new instance of RequestBody.



8
9
10
11
# File 'lib/oas_parser/request_body.rb', line 8

def initialize(endpoint, raw)
  @endpoint = endpoint
  @raw = raw
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OasParser::RawAccessor

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



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

def endpoint
  @endpoint
end

#rawObject

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

#properties_for_format(format) ⇒ Object



13
14
15
16
17
# File 'lib/oas_parser/request_body.rb', line 13

def properties_for_format(format)
  schema(format)['properties'].map do |name, definition|
    OasParser::Property.new(self, schema(format), name, definition)
  end
end

#split_properties_for_format(format) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/oas_parser/request_body.rb', line 19

def split_properties_for_format(format)
  split_schemas(format).map do |schema|
    schema['properties'].map do |name, definition|
      OasParser::Property.new(self, schema(format), name, definition)
    end
  end
end