Module: Subledger::Store::Api::Archive

Included in:
Store
Defined in:
lib/subledger/store/api/roles/archive.rb

Instance Method Summary collapse

Instance Method Details

#archive(archivable) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/subledger/store/api/roles/archive.rb', line 5

def archive archivable
  path = Path.for_entity( :anchor => archivable ) + '/archive'

  begin
    json_body = http.post do |req|
                  req.url path
                end.body
  rescue Exception => e
    raise ArchiveError, "Cannot archive #{archivable}: #{e}"
  end

  new_or_initialize json_body, archivable
end