Class: Jsapi::Meta::Operation::Wrapper
- Inherits:
-
Model::Wrapper
- Object
- Model::Wrapper
- Jsapi::Meta::Operation::Wrapper
- Defined in:
- lib/jsapi/meta/operation.rb
Instance Method Summary collapse
-
#find_response(status_code) ⇒ Object
Returns the most appropriate response for
status_code. -
#full_path ⇒ Object
:nodoc:.
-
#model ⇒ Object
-.
-
#parameters ⇒ Object
-.
-
#request_body ⇒ Object
-.
-
#responses ⇒ Object
-.
-
#security_requirements ⇒ Object
-.
Instance Method Details
#find_response(status_code) ⇒ Object
Returns the most appropriate response for status_code.
11 12 13 14 15 16 17 |
# File 'lib/jsapi/meta/operation.rb', line 11 def find_response(status_code) status_code = Status::Code.from(status_code) responses.find do |status, _response| status.match?(status_code) end&.second end |
#full_path ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/jsapi/meta/operation.rb', line 19 def full_path # :nodoc: @full_path ||= super end |
#model ⇒ Object
-
29 30 31 32 33 |
# File 'lib/jsapi/meta/operation.rb', line 29 def model return @model if defined? @model @model = super || definitions.common_model(full_path) end |
#parameters ⇒ Object
-
41 42 43 44 45 |
# File 'lib/jsapi/meta/operation.rb', line 41 def parameters @parameters ||= (definitions.common_parameters(full_path)&.merge(super) || super) .transform_values { |parameter| Parameter.wrap(parameter, definitions) } end |
#request_body ⇒ Object
-
53 54 55 56 57 58 59 60 |
# File 'lib/jsapi/meta/operation.rb', line 53 def request_body return @request_body if defined? @request_body @request_body = RequestBody.wrap( (super || definitions.common_request_body(full_path)), definitions ) end |
#responses ⇒ Object
-
68 69 70 71 72 73 74 |
# File 'lib/jsapi/meta/operation.rb', line 68 def responses @responses ||= (definitions.common_responses(full_path)&.merge(super) || super) .transform_values { |response| Response.wrap(response, definitions) } .sort_by { |status, _response| status } .to_h end |
#security_requirements ⇒ Object
-
83 84 85 86 87 88 89 90 |
# File 'lib/jsapi/meta/operation.rb', line 83 def security_requirements return @security_requirements if defined? @security_requirements @security_requirements = [definitions.common_security_requirements(full_path), super] .compact.presence&.flatten || definitions.default_security_requirements end |