Class: Apipony::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/apipony/section.rb

Overview

A section is a way to logically separate your endpoints. All endpoints in a section should be related in some way.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, &block) ⇒ Section

Returns a new instance of Section.



13
14
15
16
17
18
# File 'lib/apipony/section.rb', line 13

def initialize(title, &block)
  @title = title
  @endpoints = []

  instance_eval(&block)
end

Instance Attribute Details

#endpointsObject

:nodoc: This contains an array of endpoints added with the ‘endpoint` method of the DSL



12
13
14
# File 'lib/apipony/section.rb', line 12

def endpoints
  @endpoints
end

#titleObject

What to call this endpoint. This will show up on the generated page.



7
8
9
# File 'lib/apipony/section.rb', line 7

def title
  @title
end

Instance Method Details

#endpoint(method, url, &block) ⇒ Object



20
21
22
# File 'lib/apipony/section.rb', line 20

def endpoint(method, url, &block)
  @endpoints << Apipony::Endpoint.new(method, url, &block)
end