Sha256: dfff9c92040ba60ab98182ecd33b37a5af3573944aa4f5bb359908e9867f8adf

Contents?: true

Size: 777 Bytes

Versions: 5

Compression:

Stored size: 777 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    

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
storage_room-0.3.4 lib/storage_room/models/entry.rb
storage_room-0.3.3 lib/storage_room/models/entry.rb
storage_room-0.3.2 lib/storage_room/models/entry.rb
storage_room-0.3.1 lib/storage_room/models/entry.rb
storage_room-0.3.0 lib/storage_room/models/entry.rb