Sha256: 681fa7e4f8ef6a54d4dc73f55be35cf8b5d9bcbb0e4637ecfe814456d378b466

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 Bytes

Contents

module MeducationSDK
  class ExternalResource < Loquor::Resource
    self.path = "/external_resources"

    def created_by
      @created_by ||= User.find(created_by_id)
    end

    def indexable_content
      @indexable_content ||= begin
        object = IndexableContent.where(item_id: id, item_type: "ExternalResource").first
        object ? object.content : ''
     end
    end

    def self.reimport_metadata(id)
      new Loquor.post("#{path}/#{id}/reimport_metadata", {})
    end

  end

  class ExternalResourceMock < ExternalResource
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      created_by_id: 1,
      site_name: 'FooTube',
      url: 'http://footube.example.com/foo/bar',
      title: 'Foo Bar Baz',
      description: 'The Foo Bar Baz mock external resource is a great FooTube video.',
      rating: 10
    }

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meducation_sdk-2.2.0 lib/meducation_sdk/resources/external_resource.rb