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, #inspect, model_name, #respond_to_missing?

Constructor Details

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

Creates a new path with the given name and owner.



40
41
42
43
44
# File 'lib/jsapi/meta/path.rb', line 40

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:



46
47
48
49
50
51
52
53
# File 'lib/jsapi/meta/path.rb', line 46

def add_parameter(name, keywords = {}) # :nodoc:
  name = name.to_s

  Parameter.new(name, keywords).tap do |parameter|
    (@parameters ||= {})[name] = parameter
    @owner.try(:invalidate_path_parameters, self.name)
  end
end

#descriptionObject

:attr: description The description that applies to all operations in this path. Applies to OpenAPI 3.0 and higher.



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

attribute :description, String

#nameObject

:attr_reader: name The relative path as a Pathname.



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

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

#ownerObject

:attr_reader: owner



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

attribute :owner, accessors: i[reader]

#parametersObject

:attr: parameters The Parameter objects applicable for all operations in this path.



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

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

#serversObject

:attr: servers The Server objects that applies to all operations in this path. Applies to OpenAPI 3.0 and higher.



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

attribute :servers, [Server]

#summaryObject

:attr: summary The summary that applies to all operations in this path. Applies to OpenAPI 3.0 and higher.



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

attribute :summary, String