Sha256: 3efd5ac960d391b2cd9b228c2a27df775121062eb7db49d0a86f18c0657183ab

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

module Videojuicer
  module Asset
    class Base
      
      def self.inherited(base)
        base.send(:include, Videojuicer::Resource)
        base.send(:extend, Videojuicer::Asset::Base::ClassMethods)
        base.send(:include, Videojuicer::Asset::Base::InstanceMethods)
        
        base.property :user_id,         Integer
        # - generic file handling
        base.property :file,            File
        base.property :file_name,       String
        base.property :file_size,       Integer, :writer=>:private
        # - common metadata
        base.property :duration,        Integer # milliseconds
        base.property :licensed_at,     Date
        base.property :licensed_by,     String
        base.property :licensed_under,  String
        base.property :published_at,    Date
        # - access control / workflow
        base.property :disclosure,      String
        base.property :state,           String, :writer => :private
        base.property :url,             String, :writer => :private
        
        base.property :created_at,      DateTime
        base.property :updated_at,      DateTime
      end
      
      module ClassMethods
        def singular_name
          "asset"
        end
        
        def base_path
          "/assets/#{self.to_s.downcase.split("::").last}"
        end
      end
      
      module InstanceMethods
        def returnable_attributes
          attrs = super
          attrs.delete(:file) unless new_record?
          attrs
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
videojuicer-vj-sdk-0.1.0 lib/videojuicer/asset/base.rb