Class: OpenApi::Link
- Inherits:
-
Object
- Object
- OpenApi::Link
- Includes:
- EquatableAsContent
- Defined in:
- lib/open_api/link.rb
Overview
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#operation_id ⇒ Object
Returns the value of attribute operation_id.
-
#operation_ref ⇒ Object
Returns the value of attribute operation_ref.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#request_body ⇒ Object
Returns the value of attribute request_body.
-
#server ⇒ Object
Returns the value of attribute server.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(operation_ref: nil, operation_id: nil, parameters: nil, request_body: nil, description: nil, server: nil, **other_fields_hash) ⇒ Link
constructor
A new instance of Link.
Methods included from EquatableAsContent
Constructor Details
#initialize(operation_ref: nil, operation_id: nil, parameters: nil, request_body: nil, description: nil, server: nil, **other_fields_hash) ⇒ Link
Returns a new instance of Link.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/open_api/link.rb', line 8 def initialize(operation_ref: nil, operation_id: nil, parameters: nil, request_body: nil, description: nil, server: nil, **other_fields_hash) self.operation_ref = operation_ref self.operation_id = operation_id self.parameters = parameters self.request_body = request_body self.description = description self.server = server self.other_fields_hash = other_fields_hash.with_indifferent_access other_fields_hash.keys.each do |field_name| define_singleton_method(field_name) do other_fields_hash[field_name] end define_singleton_method("#{field_name}=") do |value| other_fields_hash[field_name] = value end end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def description @description end |
#operation_id ⇒ Object
Returns the value of attribute operation_id.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def operation_id @operation_id end |
#operation_ref ⇒ Object
Returns the value of attribute operation_ref.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def operation_ref @operation_ref end |
#parameters ⇒ Object
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def parameters @parameters end |
#request_body ⇒ Object
Returns the value of attribute request_body.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def request_body @request_body end |
#server ⇒ Object
Returns the value of attribute server.
6 7 8 |
# File 'lib/open_api/link.rb', line 6 def server @server end |
Class Method Details
.load(hash) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/open_api/link.rb', line 27 def self.load(hash) return unless hash fixed_field_names = [:operationRef, :operationId, :parameters, :requestBody, :description, :server] other_fields_hash = hash.reject { |key| key.to_sym.in?(fixed_field_names) }.symbolize_keys new( operation_ref: hash["operationRef"]&.to_s, operation_id: hash["operationId"]&.to_s, parameters: hash["parameters"], request_body: RequestBody.load(hash["requestBody"]), description: hash["description"]&.to_s, server: Server.load(hash["server"]), **other_fields_hash, ) end |