pinger v0.1.1 Pinger.Target

Target specification for the URL to monitor, it can handle address, interval and if is active

Summary

Functions

A simple request to “https://www.google.com”

Mark Target struct as active

Mark Target struct as inactive

Create a new Target struct with name, address, interval (default 10000) and active (default true)

Update Target struct address

Update Target struct name

Functions

get_google()

A simple request to “https://www.google.com”

Example

iex> Pinger.Target.get_google
...> |> Pinger.Target.update_address("https://www.google.com.br")
%Pinger.Target{active: true, address: "https://www.google.com.br", name: "Google"}
mark_active(dest)

Mark Target struct as active

Example

iex> Pinger.Target.new("Google", "https://www.google.com", 10000, false)
...> |> Pinger.Target.mark_active
%Pinger.Target{active: true, address: "https://www.google.com", interval: 10000, name: "Google"}
mark_inactive(dest)

Mark Target struct as inactive

Example

iex> dest = Pinger.Target.new("Google", "https://www.google.com")
...> Pinger.Target.mark_inactive(dest)
%Pinger.Target{active: false, address: "https://www.google.com", name: "Google"}
new(name, address, interval \\ 10000, active \\ true)

Create a new Target struct with name, address, interval (default 10000) and active (default true)

Example

iex> Pinger.Target.new("Google", "https://www.google.com")
%Pinger.Target{active: true, address: "https://www.google.com", interval: 10000, name: "Google"}

iex> Pinger.Target.new("Google", "https://www.google.com", 5000, false)
%Pinger.Target{active: false, address: "https://www.google.com", interval: 5000, name: "Google"}
update_address(dest, address)

Update Target struct address

Example

iex> Pinger.Target.new("Google", "https://www.google.com")
...> |> Pinger.Target.update_address("https://www.google.com.br")
%Pinger.Target{active: true, address: "https://www.google.com.br", name: "Google"}
update_name(dest, name)

Update Target struct name

Example

iex> Pinger.Target.new("Google", "https://www.google.com")
...> |> Pinger.Target.update_name("The Google")
%Pinger.Target{active: true, address: "https://www.google.com", name: "The Google"}