module Subledger::Store::Api::Update

Public Instance Methods

update(updatable) click to toggle source
# File lib/subledger/store/api/roles/update.rb, line 5
def update updatable
  path = Path.for_entity :anchor => updatable

  begin
    json_body = http.patch do |req|
                  req.url    path
                  req.body = updatable.patch_hash
                end.body
  rescue UpdateConflictError => e
    raise e
  rescue Exception => e
    raise UpdateError, "Cannot update #{updatable}: #{e}"
  end

  new_or_initialize json_body, updatable
end