Class: Mumuki::Domain::Store::Thesaurus

Inherits:
Mumukit::Sync::Store::Base
  • Object
show all
Defined in:
lib/mumuki/domain/store/thesaurus.rb

Overview

This Store enables importing languages from Thesaurus API

Defined Under Namespace

Classes: InfoConverter

Instance Method Summary collapse

Constructor Details

#initialize(thesaurus_bridge) ⇒ Thesaurus

Returns a new instance of Thesaurus.



6
7
8
# File 'lib/mumuki/domain/store/thesaurus.rb', line 6

def initialize(thesaurus_bridge)
  @thesaurus_bridge = thesaurus_bridge
end

Instance Method Details

#do_read(sync_key) ⇒ Object



14
15
16
17
# File 'lib/mumuki/domain/store/thesaurus.rb', line 14

def do_read(sync_key)
  return unless sync_key.kind.like? :language
  transform_after_read(sync_key.id, Mumukit::Bridge::Runner.new(sync_key.id).info)
end

#sync_keysObject



10
11
12
# File 'lib/mumuki/domain/store/thesaurus.rb', line 10

def sync_keys
  @thesaurus_bridge.runners.map { |it| Mumukit::Sync.key(:language, it) }
end

#transform_after_read(runner_url, info) ⇒ Object



19
20
21
# File 'lib/mumuki/domain/store/thesaurus.rb', line 19

def transform_after_read(runner_url, info)
  Mumuki::Domain::Store::Thesaurus::InfoConverter.new(runner_url, info).call
end

#write_resource!Object



23
24
25
# File 'lib/mumuki/domain/store/thesaurus.rb', line 23

def write_resource!(*)
  Mumukit::Sync::Store.read_only!
end