exNoops v0.1.1 Exnoops.Riddlebot View Source

Module to interact with GIthub's Noop: Riddlebot

See the official noop documentation

Link to this section Summary

Functions

Get Riddlebot certificate (assuming to completed the riddles)

Get Riddlebot riddle

Query Riddlebot for instructions

Start Riddlebot's challenge by passing in your github name

Submmit Riddlebot riddle

Link to this section Functions

Link to this function

get_certificate(endpoint) View Source
get_certificate(String.t()) :: {atom(), map()}

Get Riddlebot certificate (assuming to completed the riddles)

Examples

iex> Exnoops.Riddlebot.get_certificate("/riddlebot/certificate/613oBeHRK_2BzTZ8YgRwxEN-hBxrD1ZOnRspvSuJ4hJks8svZvSBynJ09sOdoFQM")
{:ok, %{
  "message" => "This certifies that your-login-here completed the Riddlebot challenge.",
  "elapsed" => 1928,
  "completed" => "2019-06-24T22:11:39.231Z"
}}
Link to this function

get_riddle(endpoint) View Source
get_riddle(String.t()) :: {atom(), map()}

Get Riddlebot riddle

Examples

iex> Exnoops.Riddlebot.get_riddle("/riddlebot/riddles/Zsy4sdsCuYrIPwbnw5HOowNvsWcxmh_uo31C8tkN4wU")
{:ok, %{
  "message" => "The riddleText is reversed. When you have figured out the answer, post it back as JSON. See the exampleResponse for details.",
  "riddlePath" => "/riddlebot/riddles/Zsy4sdsCuYrIPwbnw5HOowNvsWcxmh_uo31C8tkN4wU",
  "exampleResponse" => %{ "answer" => "ANSWER GOES HERE" },
  "riddleType" => "reverse",
  "riddleText" => "EVIF EERHT OREZ XIS OWT OWT NEVES RUOF EVIF THGIE TA KCAB EM LLAC ESAELP TOBHTAP SI TI OLLEH"
}}

Query Riddlebot for instructions

Examples

iex> Exnoops.Riddlebot.start()
{:ok, %{
  "message" => "Post your GitHub login to this URL to get started",
  "exampleResponse" => %{ "login" => "noops-challenge" }
}}
Link to this function

start(username) View Source
start(String.t()) :: {atom(), map()}

Start Riddlebot's challenge by passing in your github name

Examples

iex> Exnoops.Riddlebot.start("noop-challenger")
{:ok, %{
  "message" => "Hello from Riddlebot. Get the first riddle at the provided riddlePath",
  "riddlePath" => "/riddlebot/riddles/Zsy4sdsCuYrIPwbnw5HOowNvsWcxmh_uo31C8tkN4wU"
}}
Link to this function

submit_riddle(endpoint, answer) View Source
submit_riddle(String.t(), String.t()) :: {atom(), map()}

Submmit Riddlebot riddle

Examples

iex> Exnoops.Riddlebot.submit_riddle("/riddlebot/riddles/Zsy4sdsCuYrIPwbnw5HOowNvsWcxmh_uo31C8tkN4wU", "...")
{:ok, {:ok, %{
  "result" => "correct",
  "nextRiddlePath" => "/riddlebot/riddles/4LpseM7Yg8_wB0sX50eWCtQLPtassehfrZwjMSGhKLk"
}}}