GoogleSheets v2.0.10 GoogleSheets
Main starting point of the application and public API for library. For introduction on how to configure and use the library, see README.
Summary
Functions
Fetches previously loaded spreadsheet data from ETS matching the given version and returns it as a {:ok, data} tuple
Fetches previously loaded spreadsheet data from ETS matching the given version. KeyError is raised if no spreadsheet data is found with the given version
Returns true, if there is a version stored for the spreadsheet identified by spreadsheet_id argument
Returns {:ok, version, data} tuple for the latest stored version for the spreadsheet identified by spreadsheet_id argument. If there is no version available, :not_found is returned
Returns {version, data} tuple for the latest stored version for the spreadsheet identified by spreadsheet_id argument. If no version is found, KeyError exception is raised
Returns {:ok, data} tuple for the latest stored entry for the spreadsheet identified by spreadsheet_id argument. If no entry is found, :not_found is returned
Returns the latest stored entry for the spreadsheet identified by spreadsheet_id argument. If no entry is found, KeyError exception is raised
Returns {:ok, version} tuple or the latest stored version for the spreadsheet identified by spreadsheet_id argument. If no version is found, :not_found is returned
Returns the latest version stored for the spreadsheet identified by spreadsheet_id argument. If no version is found, KeyError exception is raised
Manually triggers an update for fetching new data for the given spreadsheet_id argument
To support storing custom version into ETS table. Required use case for this is to support validation of parsed configuration before it's stored when using APIs which expect a version to be passed as parameter
To remove a spcific version from ETS table
Functions
Fetches previously loaded spreadsheet data from ETS matching the given version and returns it as a {:ok, data} tuple.
Examples
iex> GoogleSheets.fetch "fccb56afd7d7f1cdf457e8b9b841ec75"
{:ok, [
%GoogleSheets.WorkSheet{
csv: "Key,Value\r\nInteger,1\r\nFloat,1.1\r\nString,string",
name: "KeyValue"
}]
}
iex> GoogleSheets.fetch "not_a_valid_version"
:not_found
Fetches previously loaded spreadsheet data from ETS matching the given version. KeyError is raised if no spreadsheet data is found with the given version.
Examples
iex> GoogleSheets.fetch! "fccb56afd7d7f1cdf457e8b9b841ec75"
[%GoogleSheets.WorkSheet{
csv: "Key,Value\r\nInteger,1\r\nFloat,1.1\r\nString,string",
name: "KeyValue"}
]
iex> GoogleSheets.fetch! "not_a_valid_version"
** (KeyError) key "not_a_valid_version" not found
Returns true, if there is a version stored for the spreadsheet identified by spreadsheet_id argument.
Returns {:ok, version, data} tuple for the latest stored version for the spreadsheet identified by spreadsheet_id argument. If there is no version available, :not_found is returned.
Returns {version, data} tuple for the latest stored version for the spreadsheet identified by spreadsheet_id argument. If no version is found, KeyError exception is raised.
Returns {:ok, data} tuple for the latest stored entry for the spreadsheet identified by spreadsheet_id argument. If no entry is found, :not_found is returned.
Returns the latest stored entry for the spreadsheet identified by spreadsheet_id argument. If no entry is found, KeyError exception is raised.
Returns {:ok, version} tuple or the latest stored version for the spreadsheet identified by spreadsheet_id argument. If no version is found, :not_found is returned.
Returns the latest version stored for the spreadsheet identified by spreadsheet_id argument. If no version is found, KeyError exception is raised.
update(spreadseheet_id :: atom, timeout :: non_neg_integer) :: {:ok, :updated, String.t} | {:ok, :unchanged} | {:error, term}
Manually triggers an update for fetching new data for the given spreadsheet_id argument.
Return values:
- {:ok, :updated, version} - Spreadsheet was updated and stored with the version
- {:ok, :unchanged} - Spreadsheet contents haven't been changed since last update.
- {:error, reason} - The update failed because of reason.
To support storing custom version into ETS table. Required use case for this is to support validation of parsed configuration before it's stored when using APIs which expect a version to be passed as parameter.
Examples
iex> GoogleSheets.version_add :config, "add-test-configuration", %{data: "test-data"}
iex> GoogleSheets.fetch "add-test-configuration"
{:ok, %{data: "test-data"}}