Class: Apipony::Documentation
- Inherits:
-
Object
- Object
- Apipony::Documentation
- Defined in:
- lib/apipony/documentation.rb
Overview
Top-level class for the DSL
Class Attribute Summary collapse
-
.base_url ⇒ Object
Returns the value of attribute base_url.
-
.sections ⇒ Object
Returns the value of attribute sections.
-
.title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.config(&block) ⇒ Object
Configure API pony with the DSL.
- .define(&block) ⇒ Object
-
.section(title, &block) ⇒ Object
Start a new section.
-
.subtype(name, **params, &block) ⇒ Object
Define a new subtype.
-
.subtypes ⇒ Hash<String, ApiPony::ResponseAttribute] a hash of each subype. keys are the names of the subtype, values are the attribute object that defines it
Hash<String, ApiPony::ResponseAttribute] a hash of each subype.
Class Attribute Details
.base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/apipony/documentation.rb', line 5 def base_url @base_url end |
.sections ⇒ Object
Returns the value of attribute sections.
5 6 7 |
# File 'lib/apipony/documentation.rb', line 5 def sections @sections end |
.title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/apipony/documentation.rb', line 5 def title @title end |
Class Method Details
.config(&block) ⇒ Object
Configure API pony with the DSL
41 42 43 |
# File 'lib/apipony/documentation.rb', line 41 def config(&block) instance_eval(&block) end |
.define(&block) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/apipony/documentation.rb', line 7 def define(&block) @sections = [] @title = 'API Documentation' @base_url = '' instance_eval(&block) end |
.section(title, &block) ⇒ Object
Start a new section. Sections are logically separated on the display page.
25 26 27 |
# File 'lib/apipony/documentation.rb', line 25 def section(title, &block) @sections << Apipony::Section.new(title, &block) end |
.subtype(name, **params, &block) ⇒ Object
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.
35 36 37 |
# File 'lib/apipony/documentation.rb', line 35 def subtype(name, **params, &block) Apipony.define_attribute_type(name, **params, &block) end |
.subtypes ⇒ Hash<String, ApiPony::ResponseAttribute] a hash of each subype. keys are the names of the subtype, values are the attribute object that defines it
Returns Hash<String, ApiPony::ResponseAttribute] a hash of each subype. keys are the names of the subtype, values are the attribute object that defines it.
18 19 20 |
# File 'lib/apipony/documentation.rb', line 18 def subtypes Apipony::ResponseAttribute.defined_subtypes end |