class

Hwaro::Models::RemoteDataConfig

Inherits Reference < Object

One [[data.remote]] entry — a declarative remote data source fetched once per build (before render) into site.data.<key>. This class is the validated config shape; fetching, caching and error handling live in Core::Build::RemoteData. See docs/content/templates/data-model.md.

Constants

VALID_FORMATS = ["json", "toml", "yaml", "csv"] of ::String

Accepted format values (also the set inference can produce).

VALID_ON_ERROR = ["fail", "warn-and-use-cache", "warn-and-skip"] of ::String

Accepted on_error modes.

Constructors

new(key : String, url : String)
Source

Instance methods

cache_ttl

Disk-cache TTL; nil = refetch on every build. The cache file is written either way so on_error = "warn-and-use-cache" always has a fallback once one fetch has succeeded.

Source
cache_ttl=(cache_ttl : Time::Span | Nil)

Disk-cache TTL; nil = refetch on every build. The cache file is written either way so on_error = "warn-and-use-cache" always has a fallback once one fetch has succeeded.

Source
format

Explicit payload format; nil = infer from the response Content-Type, then from the URL's path extension, at fetch time.

Source
format=(format : String | Nil)

Explicit payload format; nil = infer from the response Content-Type, then from the URL's path extension, at fetch time.

Source
headers

Extra request headers (values already env-substituted). Treated as credentials: never logged, and dropped on cross-origin redirects.

Source
headers=(headers : Hash(String, String))

Extra request headers (values already env-substituted). Treated as credentials: never logged, and dropped on cross-origin redirects.

Source
key

Template-facing name: the payload lands at site.data.<key>. Also used as the cache filename, hence the restricted character set.

Source
key=(key : String)

Template-facing name: the payload lands at site.data.<key>. Also used as the cache filename, hence the restricted character set.

Source
on_error

"fail" | "warn-and-use-cache" | "warn-and-skip"

Source
on_error=(on_error : String)

"fail" | "warn-and-use-cache" | "warn-and-skip"

Source
url

Absolute http(s) URL, already env-substituted.

Source
url=(url : String)

Absolute http(s) URL, already env-substituted.

Source