Temporal v0.1.3 Temporal.Fetch

Summary

Functions

Clean up a possible fetched file

Go and fetch the data if it’s time, using the provided method

Touch a file, useful if you want to “skip” a download

Functions

clean(args)

Clean up a possible fetched file

Examples

iex> Temporal.Fetch.clean(%{basedir: "/tmp/", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/tmp/20170504/my.a4word.com/webfiles/x.txt"

iex> Temporal.Fetch.clean(%{basedir: "/etc/bad", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/etc/bad/20170504/my.a4word.com/webfiles/x.txt"
default_opts()
go(args)

Go and fetch the data if it’s time, using the provided method.

iex> Temporal.Fetch.clean(%{source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
...> Temporal.Fetch.go(%{source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:ok, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}

iex> Temporal.Fetch.go(%{method: :get, source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:skip, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}

iex> Temporal.Fetch.go(%{force: true, method: :get, source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:ok, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}
touch(args)

Touch a file, useful if you want to “skip” a download

Examples

iex> Temporal.Fetch.touch(%{basedir: "/tmp/", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/tmp/20170504/my.a4word.com/webfiles/x.txt"

iex> Temporal.Fetch.touch(%{basedir: "/etc/bad", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/etc/bad/20170504/my.a4word.com/webfiles/x.txt"