Class: Jsapi::Meta::Callback::Base::Operations
- Inherits:
-
Model::Base
- Object
- Model::Base
- Jsapi::Meta::Callback::Base::Operations
- Defined in:
- lib/jsapi/meta/callback/base.rb
Overview
The set of operations that can be called backed.
Instance Method Summary collapse
-
#add_operation(method = nil, keywords = {}) ⇒ Object
:nodoc:.
-
#add_parameter(name, keywords = {}) ⇒ Object
:nodoc:.
-
#description ⇒ Object
:attr: description The description that applies to all operations.
-
#operations ⇒ Object
:attr: operations The operations.
-
#parameters ⇒ Object
:attr: parameters The parameters that apply for all operations.
-
#summary ⇒ Object
:attr: summary The short summary that applies to all operations.
-
#to_openapi(version, definitions) ⇒ Object
Returns a hash representing the OpenAPI path item object that describes the operations.
Methods inherited from Model::Base
#initialize, #inspect, #merge!, #reference?, #resolve
Methods included from Model::Attributes
#attributes_frozen?, #freeze_attributes, included
Constructor Details
This class inherits a constructor from Jsapi::Meta::Model::Base
Instance Method Details
#add_operation(method = nil, keywords = {}) ⇒ Object
:nodoc:
34 35 36 37 38 39 40 41 |
# File 'lib/jsapi/meta/callback/base.rb', line 34 def add_operation(method = nil, keywords = {}) # :nodoc: try_modify_attribute!(:operations) do method, keywords = nil, method if method.is_a?(Hash) method = 'get' if method.nil? (@operations ||= {})[method] = Operation.new(nil, keywords.merge(method: method)) end end |
#add_parameter(name, keywords = {}) ⇒ Object
:nodoc:
43 44 45 46 47 48 49 |
# File 'lib/jsapi/meta/callback/base.rb', line 43 def add_parameter(name, keywords = {}) # :nodoc: try_modify_attribute!(:parameters) do name = name.to_s (@parameters ||= {})[name] = Parameter.new(name, keywords) end end |
#description ⇒ Object
:attr: description The description that applies to all operations.
16 |
# File 'lib/jsapi/meta/callback/base.rb', line 16 attribute :description, String |
#operations ⇒ Object
:attr: operations The operations. Maps strings to Operation objects.
21 |
# File 'lib/jsapi/meta/callback/base.rb', line 21 attribute :operations, { String => Operation }, accessors: %i[reader writer] |
#parameters ⇒ Object
:attr: parameters The parameters that apply for all operations. Maps parameter names to Parameter objects or references.
27 |
# File 'lib/jsapi/meta/callback/base.rb', line 27 attribute :parameters, { String => Parameter }, accessors: %i[reader writer] |
#summary ⇒ Object
:attr: summary The short summary that applies to all operations.
32 |
# File 'lib/jsapi/meta/callback/base.rb', line 32 attribute :summary, String |
#to_openapi(version, definitions) ⇒ Object
Returns a hash representing the OpenAPI path item object that describes the operations.
53 54 55 56 57 58 59 60 |
# File 'lib/jsapi/meta/callback/base.rb', line 53 def to_openapi(version, definitions) OpenAPI::PathItem.new( operations.values, description: description, summary: summary, parameters: parameters ).to_openapi(version, definitions) end |