Class: MeducationSDK::ExternalResource

Inherits:
Loquor::Resource
  • Object
show all
Defined in:
lib/meducation_sdk/resources/external_resource.rb

Direct Known Subclasses

ExternalResourceMock

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.reimport_metadata(id) ⇒ Object



16
17
18
# File 'lib/meducation_sdk/resources/external_resource.rb', line 16

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

Instance Method Details

#created_byObject



5
6
7
# File 'lib/meducation_sdk/resources/external_resource.rb', line 5

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

#indexable_contentObject



9
10
11
12
13
14
# File 'lib/meducation_sdk/resources/external_resource.rb', line 9

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

#item_mesh_headingsObject



20
21
22
23
24
25
26
# File 'lib/meducation_sdk/resources/external_resource.rb', line 20

def item_mesh_headings
  @item_mesh_headings ||= begin
    @data['item_mesh_headings'].map do |imh|
      ItemMeshHeading.new(item_id: imh['item_id'], item_type: imh['item_type'], mesh_root: imh['mesh_root'], mesh_heading: imh['mesh_heading'], relevance: imh['relevance'])
    end
  end
end