Module: Apipony

Defined in:
lib/apipony.rb,
lib/apipony/engine.rb,
lib/apipony/version.rb,
lib/generators/apipony/install_generator.rb,
app/controllers/apipony/application_controller.rb

Defined Under Namespace

Modules: Generators Classes: ApplicationController, Base, Documentation, Endpoint, Engine, ExampleResponse, Parameter, Request, Response, ResponseAttribute, Section

Constant Summary collapse

VERSION =

:nodoc:

'0.0.9'

Class Method Summary collapse

Class Method Details

.define_attribute_type(name, **params, &block) ⇒ Object

This allows you to define a common sub-type of attributes. A typical example is something like a list of users. If you want to display all users who created an image, who subscribe to a channel, or who are in a group, it may be useful if the information on those users is in a common format. This lets you define one common format, which you can then merge in to other attributes.

Example

Apipony.define_attribute_type :user_stub do
  attribute :name
  attribute :id
end


27
28
29
30
# File 'lib/apipony.rb', line 27

def self.define_attribute_type(name, **params, &block)
  a = Apipony::ResponseAttribute.new("", **params, &block)
  Apipony::ResponseAttribute.define_type(name, a)
end