Module: Subledger::Store::Api::Read

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

Instance Method Summary collapse

Instance Method Details

#read(readable) ⇒ Object



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

def read readable
  path = Path.for_entity :anchor => readable

  begin
    json_body = http.get( path ).body
  rescue Exception => e
    raise ReadError, "Cannot read #{readable}: #{e}"
  end

  new_or_initialize json_body, readable
end