Sha256: b561fbc1a58fa8645e714fb6d35de83e0879bde1698d3cb6c32b8a7f5a54a0a0

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

module MeducationSDK
  class MediaFile < Loquor::Resource
    self.path = "/media_files"

    def user
      @user ||= User.find(user_id)
    end

    def comments
      @comments ||= ItemComment.where(item_id: id, item_type: "MediaFile")
    end

    def media_type
      case media_type_id
      when 1; 'slideshow'
      when 2;   'video'
      when 3;  'podcast'
      when 4; 'other'
      when 5; 'image'
      when 6; 'document'
      when 7; 'application'
      end
    end

    module State
      def self.uploaded; 1 end
      def self.processing; 2 end
      def self.available; 3 end
      def self.redacted; 4 end
    end
  end

  class MediaFileMock < MediaFile
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      user_id: 1,
      media_type_id: 2,
      title: "Abdominal Ultrasound Tutorial"
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
meducation_sdk-0.4.1 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-0.4.0 lib/meducation_sdk/resources/media_file.rb