Module: Locomotive::Misc::ApiDocumentation
- Defined in:
- lib/locomotive/misc/api_documentation.rb
Overview
Class to generate the documentation about the LocomotiveCMS Rest API
Defined Under Namespace
Classes: BootstrapRenderer, Parser
Class Method Summary collapse
-
.embedded_resources ⇒ Array
Return the list of embedded resources.
-
.generate(renderer = nil) ⇒ Object
Generate the documentation depending on the renderer which is by default the BoostrapRenderer.
Class Method Details
.embedded_resources ⇒ Array
Return the list of embedded resources
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/locomotive/misc/api_documentation.rb', line 31 def self. %w(editable_element editable_short_text editable_long_text editable_file editable_control content_field).map do |name| klass = "Locomotive::#{name.camelize}Presenter".constantize { name: name, getters: klass.getters_to_hash, setters: klass.setters_to_hash, } end end |
.generate(renderer = nil) ⇒ Object
Generate the documentation depending on the renderer which is by default the BoostrapRenderer.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/locomotive/misc/api_documentation.rb', line 16 def self.generate(renderer = nil) renderer ||= BootstrapRenderer.new raise 'You must provide a renderer' if renderer.nil? parser = Parser.new parser.parse renderer.render(parser.resources, self.) end |