class Apipony::Documentation
Top-level class for the DSL
Attributes
base_url[RW]
sections[RW]
title[RW]
Public Class Methods
config(&block)
click to toggle source
Configure API pony with the DSL
# File lib/apipony/documentation.rb, line 41 def config(&block) instance_eval(&block) end
define(&block)
click to toggle source
# File lib/apipony/documentation.rb, line 7 def define(&block) @sections = [] @title = 'API Documentation' @base_url = '' instance_eval(&block) end
section(title, &block)
click to toggle source
Start a new section. Sections are logically separated on the display page.
# File lib/apipony/documentation.rb, line 25 def section(title, &block) @sections << Apipony::Section.new(title, &block) end
subtype(name, **params, &block)
click to toggle source
Define a new subtype. A subtype describes a common object used in various places in your Api. Once defined, setting the ‘type` of an attribute to this given name will cause it to reference this subtype in a common location. @param [String] name what to call this subtype
# File lib/apipony/documentation.rb, line 35 def subtype(name, **params, &block) Apipony.define_attribute_type(name, **params, &block) end
subtypes()
click to toggle source
@return [Hash<String, ApiPony::ResponseAttribute] a hash of each subype.
keys are the names of the subtype, values are the attribute object that defines it
# File lib/apipony/documentation.rb, line 18 def subtypes Apipony::ResponseAttribute.defined_subtypes end