Sha256: 939e8e31a7f4b3f60687f4d28c0db0b410f6e0029cf5f5b9e7f8fc4b2ddb30c8

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

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

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

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

    def indexable_content
      @indexable_content ||= begin
        object = IndexableContent.where(item_id: id, item_type: "MediaFile").first
        object ? object.content : ''
     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,
      media_type: "video",
      title: "Abdominal Ultrasound Tutorial",
      preview_image_url: "http://www.example.com/1.jpg",
      mesh_headings: [{id: 1, name: "cardiology"}], 
      rating: 10,
      views_in_last_30_days: 30,
      views_in_last_60_days: 60,
      usefulness: 1
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
meducation_sdk-2.1.4 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.1.3 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.1.2 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.1.1 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.1.0 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.0.5 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.0.4 lib/meducation_sdk/resources/media_file.rb
meducation_sdk-2.0.3 lib/meducation_sdk/resources/media_file.rb