Sha256: 3f209713dd1233a02ed0d9aa2a228d7a96ac3ec0c98753da2103608985d35f62

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

module Dropmark
  class Item
    include Her::Model
    uses_api Dropmark.api
    
    collection_path "collections/:collection_id/items"
    resource_path "items/:id"
    
    belongs_to :collection
    has_many :comments
    custom_get :count
    
    method_for :update, :post
    
    store_metadata :_metadata # conflicted with actual item metadata
    
    after_initialize do |i|
      i.metadata = i._metadata unless i.has_attribute?('metadata')
      begin
        i.created_at = Time.parse(i.created_at)
        i.updated_at = Time.parse(i.updated_at)
      rescue
      end
    end
    
    def self.sort(id, order)
      items = Dropmark::Collection.new(:id => id).sort_items(order)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dropmark-0.1.5 lib/dropmark/item.rb