Class: OasParser::RequestBody
- Includes:
- RawAccessor
- Defined in:
- lib/oas_parser/request_body.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #handle_all_of(schema) ⇒ Object
-
#initialize(endpoint, raw) ⇒ RequestBody
constructor
A new instance of RequestBody.
- #properties_for_format(format) ⇒ Object
- #split_properties_for_format(format) ⇒ Object
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
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/oas_parser/request_body.rb', line 6 def endpoint @endpoint end |
#raw ⇒ Object
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
#handle_all_of(schema) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/oas_parser/request_body.rb', line 30 def handle_all_of(schema) if schema['allOf'] schema['allOf'].each do |p| schema.deep_merge!(p) end schema.delete('allOf') end schema end |
#properties_for_format(format) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/oas_parser/request_body.rb', line 13 def properties_for_format(format) s = schema(format) s = handle_all_of(s) s['properties'].map do |name, definition| OasParser::Property.new(self, s, name, definition) end end |
#split_properties_for_format(format) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/oas_parser/request_body.rb', line 21 def split_properties_for_format(format) split_schemas(format).map do |schema| schema = handle_all_of(schema) schema['properties'].map do |name, definition| OasParser::Property.new(self, schema, name, definition) end end end |