Sha256: ee9d79da72794ebc1bdc58fec24cca72f0ed6fd86b01079725142b9e0d5f337c

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

module StorageRoom
  # A collection is used to define the structure of a data set. 
  class Collection < Model        
    class << self                  
      def index_path # :nodoc:
        '/collections'
      end
      
      def show_path(collection_id) # :nodoc:
        "#{index_path}/#{collection_id}"
      end
      
      def entries_path(collection_id) # :nodoc:
        "#{show_path(collection_id)}/entries"
      end
      
      def json_name # :nodoc:
        'collection'
      end
    end
    
    # Load all the entries of a collection
    def entries
      Array.load(self[:@entries_url])
    end
    
    # The class of the collection's objects
    def entry_class
      StorageRoom.class_for_name(self[:identifier].classify)
    end

    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storage_room-0.1.4 lib/storage_room/models/collection.rb
storage_room-0.1.3 lib/storage_room/models/collection.rb
storage_room-0.1.2 lib/storage_room/models/collection.rb