Class: Mumuki::Domain::Store::Bibliotheca
- Inherits:
-
Mumukit::Sync::Store::Base
- Object
- Mumukit::Sync::Store::Base
- Mumuki::Domain::Store::Bibliotheca
- Includes:
- Mumukit::Sync::Store::WithFilteredId, Mumukit::Sync::Store::WithWrappedLanguage
- Defined in:
- lib/mumuki/domain/store/bibliotheca.rb
Overview
This Store enables importing content from Bibliotheca API
Instance Method Summary collapse
- #do_read(sync_key) ⇒ Object
-
#initialize(bibliotheca_bridge) ⇒ Bibliotheca
constructor
A new instance of Bibliotheca.
- #sync_keys ⇒ Object
- #write_resource! ⇒ Object
Constructor Details
#initialize(bibliotheca_bridge) ⇒ Bibliotheca
Returns a new instance of Bibliotheca.
9 10 11 |
# File 'lib/mumuki/domain/store/bibliotheca.rb', line 9 def initialize(bibliotheca_bridge) @bibliotheca_bridge = bibliotheca_bridge end |
Instance Method Details
#do_read(sync_key) ⇒ Object
21 22 23 |
# File 'lib/mumuki/domain/store/bibliotheca.rb', line 21 def do_read(sync_key) @bibliotheca_bridge.send(sync_key.kind.as_variable_name, sync_key.id) end |
#sync_keys ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mumuki/domain/store/bibliotheca.rb', line 13 def sync_keys %w(guide topic book).flat_map do |kind| @bibliotheca_bridge .send(kind.as_variable_name.pluralize) .map { |it| Mumukit::Sync.key kind, it['slug'] } end end |
#write_resource! ⇒ Object
25 26 27 |
# File 'lib/mumuki/domain/store/bibliotheca.rb', line 25 def write_resource!(*) Mumukit::Sync::Store.read_only! end |