class Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::InfoFormatter
Attributes
output[RW]
version[RW]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
Brainstem::ApiDocs::Formatters::AbstractFormatter::new
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 22 def initialize(options = {}) self.output = ActiveSupport::HashWithIndifferentAccess.new super options end
Public Instance Methods
call()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 28 def call format_swagger_object! format_info_object! output end
valid_options()
click to toggle source
Declares the options that are permissable to set on this instance.
Calls superclass method
Brainstem::Concerns::Optional#valid_options
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 13 def valid_options super | [ :version ] end
Private Instance Methods
consumes()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 80 def consumes %w(application/json) end
contact_object()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 104 def contact_object { 'name' => 'Pet Store Support', 'url' => 'https://swagger.io/support/', 'email' => 'apiteam@swagger.io', } end
description()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 92 def description <<-DESC.strip_heredoc This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. DESC end
format_info_object!()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 42 def format_info_object! output.merge!( 'info' => info_object ) end
format_swagger_object!()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 38 def format_swagger_object! output.merge!( swagger_object ) end
host()
click to toggle source
Override with custom values #
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 72 def host 'petstore.swagger.io' end
info_object()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 57 def info_object { 'version' => version.presence || '1.0', 'title' => title, 'description' => description, 'termsOfService' => terms_of_service, 'contact' => contact_object, 'license' => license_object }.with_indifferent_access.reject { |_, v| v.blank? } end
license_object()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 112 def license_object { 'name' => 'MIT', 'url' => 'https://opensource.org/licenses/MIT', } end
produces()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 84 def produces %w(application/json) end
schemes()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 76 def schemes %w(https) end
swagger_object()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 46 def swagger_object { 'swagger' => '2.0', 'host' => host, 'basePath' => Brainstem::ApiDocs.base_path, 'schemes' => schemes, 'consumes' => consumes, 'produces' => produces }.with_indifferent_access.reject { |_, v| v.blank? } end
terms_of_service()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 100 def terms_of_service 'http://swagger.io/terms/' end
title()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/info_formatter.rb, line 88 def title 'Petstore' end