Class: Jsapi::Meta::Path

Inherits:
Jsapi::Model::Base show all
Defined in:
lib/jsapi/meta/path.rb

Overview

Specifies a path.

Instance Method Summary collapse

Methods inherited from Jsapi::Model::Base

#==, #errors, model_name, #respond_to_missing?

Constructor Details

#initialize(name, owner, keywords = {}) ⇒ Path

Creates a new path with the given name and owner.



77
78
79
80
81
# File 'lib/jsapi/meta/path.rb', line 77

def initialize(name, owner, keywords = {})
  @name = Pathname.from(name)
  @owner = owner
  super(keywords)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jsapi::Model::Base

Instance Method Details

#add_parameter(name, keywords = {}) ⇒ Object

:nodoc:



83
84
85
86
87
88
# File 'lib/jsapi/meta/path.rb', line 83

def add_parameter(name, keywords = {}) # :nodoc:
  try_modify_attribute!(:parameters) do
    name = name.to_s
    (@parameters ||= {})[name] = Parameter.new(name, keywords)
  end
end

#descriptionObject

:attr: description The common description for all operations in this path.

Applies to OpenAPI 3.0 and higher.



12
# File 'lib/jsapi/meta/path.rb', line 12

attribute :description, String

#inspect(*attributes) ⇒ Object

:nodoc:



90
91
92
# File 'lib/jsapi/meta/path.rb', line 90

def inspect(*attributes) # :nodoc:
  super(*(attributes.presence || self.class.attribute_names).without(:owner))
end

#modelObject

:attr: model The model class used by default for all operations in this path.



17
# File 'lib/jsapi/meta/path.rb', line 17

attribute :model, Class

#nameObject

:attr_reader: name The relative path as a Pathname.



22
# File 'lib/jsapi/meta/path.rb', line 22

attribute :name, Pathname, accessors: i[reader]

#ownerObject

:attr_reader: owner



26
# File 'lib/jsapi/meta/path.rb', line 26

attribute :owner, accessors: i[reader]

#parametersObject

:attr: parameters The parameters that apply to all operations in this path. Maps parameter names to Parameter objects or references.



32
# File 'lib/jsapi/meta/path.rb', line 32

attribute :parameters, { String => Parameter }, accessors: i[reader writer]

#request_bodyObject

:attr: request_body The RequestBody object or reference used by default by all operations in this path.



38
# File 'lib/jsapi/meta/path.rb', line 38

attribute :request_body, RequestBody

#responsesObject

:attr: responses The responses that can be produced by all operations in this path. Maps instances of Status::Base to Response objects or references.



44
# File 'lib/jsapi/meta/path.rb', line 44

attribute :responses, { Status => Response }, default_key: Status::DEFAULT

#security_requirementsObject

:attr: security_requirements The security requirements that apply to all operations in this path.

See SecurityRequirement for further information.



51
# File 'lib/jsapi/meta/path.rb', line 51

attribute :security_requirements, [SecurityRequirement], default: :nil

#summaryObject

:attr: summary The summary that applies to all operations in this path.

Applies to OpenAPI 3.0 and higher.



69
# File 'lib/jsapi/meta/path.rb', line 69

attribute :summary, String

#tagsObject

:attr: tags The tags that apply to all operations in this path.



74
# File 'lib/jsapi/meta/path.rb', line 74

attribute :tags, [String]