Method: ICFS::Api#action_read

Defined in:
lib/icfs/api.rb

#action_read(cid, anum, lnum = 0) ⇒ Action

Read an action

Parameters:

  • cid (String)

    caseid

  • anum (Integer)

    the action number

  • lnum (Integer) (defaults to: 0)

    the log number or 0 for current

Returns:

  • (Action)

    requested action

Raises:



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/icfs/api.rb', line 412

def action_read(cid, anum, lnum=0)

  # get current action
  ac = _action_read(cid, anum)

  # see if we can read the action
  unless _can_read?(cid, anum)
    raise(Error::Perms, 'missing perms: %s' % ICFS::PermRead )
  end

  # return the requested version
  if( lnum == 0 || ac['log'] == lnum )
    return ac
  else
    json = @store.action_read( cid, anum, lnum)
    return Items.parse(json, 'action', Items::ItemAction)
  end
end