module Apipony

Public Class Methods

define_attribute_type(name, **params, &block) click to toggle source

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
# 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