Class: Jsapi::Meta::Response::Reference

Inherits:
Base::Reference show all
Defined in:
lib/jsapi/meta/response/reference.rb

Overview

Specifies a response reference.

Constant Summary

Constants included from Base::Attributes

Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods inherited from Base::Reference

component_type, #ref, #reference?, #resolve

Methods inherited from Base::Model

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Base::Attributes

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base::Model

Instance Method Details

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI reference object.



9
10
11
12
13
14
# File 'lib/jsapi/meta/response/reference.rb', line 9

def to_openapi(version, *)
  version = OpenAPI::Version.from(version)
  path = version.major == 2 ? 'responses' : 'components/responses'

  { '$ref': "#/#{path}/#{ref}" }
end