Class: Nexmo::OAS::Renderer::Presenters::ResponseFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/nexmo/oas/renderer/presenters/response_format.rb

Constant Summary collapse

MAPPINGS =
{
  'application/json' => 'JSON',
  'application/xml' => 'XML',
  'text/xml' => 'XML',
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(responses) ⇒ ResponseFormat

Returns a new instance of ResponseFormat.



18
19
20
# File 'lib/nexmo/oas/renderer/presenters/response_format.rb', line 18

def initialize(responses)
  @responses = responses
end

Class Method Details

.to_dropdown(formats) ⇒ Object



14
15
16
# File 'lib/nexmo/oas/renderer/presenters/response_format.rb', line 14

def self.to_dropdown(formats)
  MAPPINGS.slice(*formats)
end

Instance Method Details

#extractObject



22
23
24
# File 'lib/nexmo/oas/renderer/presenters/response_format.rb', line 22

def extract
  @extract ||= @responses.flat_map(&:formats).uniq
end