Class: FlyIO::OperationRegistry::Operation
- Inherits:
-
Object
- Object
- FlyIO::OperationRegistry::Operation
- Defined in:
- lib/fly_io/operation_registry.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #http_method ⇒ Object
-
#initialize(data) ⇒ Operation
constructor
A new instance of Operation.
- #parameters ⇒ Object
- #request_body ⇒ Object
- #response_schema(status, content_type) ⇒ Object
- #responses ⇒ Object
Constructor Details
#initialize(data) ⇒ Operation
Returns a new instance of Operation.
41 42 43 44 |
# File 'lib/fly_io/operation_registry.rb', line 41 def initialize(data) @data = data.freeze freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
39 40 41 |
# File 'lib/fly_io/operation_registry.rb', line 39 def data @data end |
Instance Method Details
#http_method ⇒ Object
50 51 52 |
# File 'lib/fly_io/operation_registry.rb', line 50 def http_method data.fetch("method") end |
#parameters ⇒ Object
54 55 56 |
# File 'lib/fly_io/operation_registry.rb', line 54 def parameters data.fetch("parameters") end |
#request_body ⇒ Object
58 59 60 |
# File 'lib/fly_io/operation_registry.rb', line 58 def request_body data["request_body"] end |
#response_schema(status, content_type) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fly_io/operation_registry.rb', line 66 def response_schema(status, content_type) response = responses[status.to_s] || responses["default"] return unless response content = response.fetch("content", {}) return if content.empty? normalized_type = content_type.to_s.split(";", 2).first.to_s.downcase exact = content[normalized_type] exact&.fetch("schema", nil) || content.values.first&.fetch("schema", nil) end |
#responses ⇒ Object
62 63 64 |
# File 'lib/fly_io/operation_registry.rb', line 62 def responses data.fetch("responses") end |