class Scalingo::Endpoint::Collection

Public Instance Methods

all() click to toggle source
# File lib/scalingo/endpoint.rb, line 72
def all
  get[collection_name].map { |r| resource_class.new(self, r[find_by], {}, r) }
end
Also aliased as: to_a
collection_name() click to toggle source
# File lib/scalingo/endpoint.rb, line 85
def collection_name
  @collection_name ||= self.class.name.underscore.split('/').last
end
each() click to toggle source
# File lib/scalingo/endpoint.rb, line 77
def each
  block_given? ? all.each(&Proc.new) : all.each
end
find(id) click to toggle source
# File lib/scalingo/endpoint.rb, line 81
def find(id)
  detect { |r| r[find_by] == id }
end
find_by() click to toggle source
# File lib/scalingo/endpoint.rb, line 97
def find_by
  'id'
end
resource_class() click to toggle source
# File lib/scalingo/endpoint.rb, line 89
def resource_class
  @resource_class ||= begin
                        Scalingo::Endpoint.const_get(self.class.name.singularize.split('::').last)
                      rescue
                        Resource
                      end
end
to_a()
Alias for: all