Class: Mumukit::Sync::Store::Bibliotheca

Inherits:
Object
  • Object
show all
Defined in:
lib/mumukit/sync/store/bibliotheca.rb

Instance Method Summary collapse

Constructor Details

#initialize(bibliotheca_bridge) ⇒ Bibliotheca

Returns a new instance of Bibliotheca.



3
4
5
# File 'lib/mumukit/sync/store/bibliotheca.rb', line 3

def initialize(bibliotheca_bridge)
  @bibliotheca_bridge = bibliotheca_bridge
end

Instance Method Details

#read_resource(sync_key) ⇒ Object



15
16
17
# File 'lib/mumukit/sync/store/bibliotheca.rb', line 15

def read_resource(sync_key)
  @bibliotheca_bridge.send(sync_key.kind, sync_key.id)
end

#sync_keysObject



7
8
9
10
11
12
13
# File 'lib/mumukit/sync/store/bibliotheca.rb', line 7

def sync_keys
  %w(guide topic book).flat_map do |kind|
    @bibliotheca_bridge
      .send(kind.to_s.pluralize)
      .map { |it| Mumukit::Sync.key kind, it['slug']  }
  end
end

#write_resource!Object



19
20
21
# File 'lib/mumukit/sync/store/bibliotheca.rb', line 19

def write_resource!(*)
  raise 'Read-only store'
end