Method: Reedb::Vault.access_file

Defined in:
lib/reedb.rb

.access_file(uuid, token, file_name, history = false) ⇒ Object

Access file contents with a file ID in a vault that a token has already been authenticated on.

Depending on the history flag (false by default) the history or only current dataset will be returned.

Parameters:

  • uuid (String)

    UUID of a vault (as an ID)

  • token (String)

    Authentication token for access

  • file_name (String)

    File identifier

  • history (Boolean) (defaults to: false)

    history idenfitier

Raises:



746
747
748
749
750
751
752
753
754
755
756
# File 'lib/reedb.rb', line 746

def access_file(uuid, token, file_name, history = false)
	token.delete!("\n")

	raise VaultNotAvailableError.new, 'The vault you have requested data from is not currently active on this system.' unless @@active_vaults[uuid]
	raise UnknownTokenError.new, 'The token you provided is unknown to this system. Access denied!' unless @@tokens[token]
	raise UnautherisedTokenError.new, 'The token you provided currently has no access to the desired vault. Access denied!' unless @@tokens[token].include?(uuid)

	debouncer.debounce_vault(uuid)

	return @@active_vaults[uuid].read_file(file_name, history)
end