Sha256: 2912cc0994da04c36a612b0d9cb2821d10cc498a4bc813e46e9b801dec5c21c8

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module InstaSwag
  class DocumentationFactory
  	class << self

	  	def create_for klass, settings
	  		new_documentation_class klass, settings
	  	end

	  	private 

	  	def new_documentation_class(klass, settings)
	  		docs_klass = Class.new(Grape::API)
	  		set_swag_values(docs_klass, klass, settings)
	  		docs_klass
	  	end

	  	def set_swag_values(docs_klass, klass, settings)
	  		docs_klass.mount klass
	  		docs_klass.add_swagger_documentation(
		      :api_version => klass.version,
		      :mount_path => "documentation/resources",
		      :hide_documentation_path => settings[:hide_documentation_path],
		      :base_path => settings[:prefix],
	  		)
	  	end
	  end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
insta_swag-0.1.1 lib/insta_swag/documentation_factory.rb