Class: Nexmo::OAS::Renderer::Presenters::OpenApiSpecification
- Inherits:
-
Object
- Object
- Nexmo::OAS::Renderer::Presenters::OpenApiSpecification
- Extended by:
- Forwardable
- Defined in:
- lib/nexmo/oas/renderer/presenters/open_api_specification.rb
Instance Attribute Summary collapse
-
#definition_name ⇒ Object
readonly
Returns the value of attribute definition_name.
Instance Method Summary collapse
- #auto_expand_responses ⇒ Object
- #definition ⇒ Object
- #definition_errors ⇒ Object
- #errors? ⇒ Boolean
- #formats ⇒ Object
-
#initialize(definition_name:, expand_responses:) ⇒ OpenApiSpecification
constructor
A new instance of OpenApiSpecification.
Constructor Details
#initialize(definition_name:, expand_responses:) ⇒ OpenApiSpecification
Returns a new instance of OpenApiSpecification.
22 23 24 25 26 27 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 22 def initialize(definition_name:, expand_responses:) @definition_name = definition_name @expand_responses = @versions = Versions.new(definition_name) @groups = Groups.new(definition) end |
Instance Attribute Details
#definition_name ⇒ Object (readonly)
Returns the value of attribute definition_name.
17 18 19 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 17 def definition_name @definition_name end |
Instance Method Details
#auto_expand_responses ⇒ Object
45 46 47 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 45 def @expand_responses end |
#definition ⇒ Object
41 42 43 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 41 def definition @definition ||= OpenApiDefinitionResolver.find(@definition_name) end |
#definition_errors ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 33 def definition_errors return unless errors? @definition_errors ||= Nexmo::Markdown::Renderer.new.call( File.read("#{API.oas_path}/../../errors/#{@definition_name}.md") ) end |
#errors? ⇒ Boolean
29 30 31 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 29 def errors? File.exist?("#{API.oas_path}/../../errors/#{@definition_name}.md") end |
#formats ⇒ Object
49 50 51 |
# File 'lib/nexmo/oas/renderer/presenters/open_api_specification.rb', line 49 def formats @formats ||= ResponseFormat.to_dropdown(endpoints.flat_map(&:formats).uniq) end |