Sha256: 6c960e7000a9260dd946650536b15849cdd36a4c97c8a24ba0cc8a14e7507cba

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

module StorageRoom
  class Entry < Model
    class_inheritable_accessor :collection
        
    class << self         
      def index_path # :nodoc:
        "#{collection[:@url]}/entries"
      end
            
      def show_path(entry_id) # :nodoc:
        "#{index_path}/#{entry_id}"
      end
            
      def json_name # :nodoc:
        'entry'
      end
      
      def search_path(parameters = {}) # :nodoc:
        parameters.present? ? "#{index_path}?#{parameters.to_query}" : index_path
      end
      
      # Search for objects with specific parameters
      def search(parameters = {})
        Array.load(search_path(parameters))
      end
    end
    
    # The collection of a entry
    def collection
      self.class.collection
    end    
    
    # Has this Entry been trashed?
    def trashed?
      self[:@trash]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storage_room-0.3.5 lib/storage_room/models/entry.rb