Module: Evidence

Defined in:
lib/another_place/application/evidence.rb

Constant Summary collapse

START_MESSAGE =
<<EOF

Welcome to the town of Palmer Lakes, officer. It's a sleepy place:
we've never quite seen something like this before... Sorry you had
to come out for such a tragedy. But where are my manners? Let's
head over to the double_r_diner and get some cherry pie. Plus,
they make a damn fine coffee!

> As with all of the clues here, you'll have to identify an API
> endpoint and the correctly formatted URL and HTTP request verb
> to access the next clue.
>
> You can use HTTParty, Postman, or `curl url:port --include` to
> inspect the HTTP response's header AND body.
>
> Let's start by getting "/double_r_diner"...
==
EOF
CLUES =
{
  "/double_r_diner" => {
    header_clue: "",
    log_clue:    "Take a look at all our /pies... Find one you want?",
    body_clue:   ""
  },
  "/pies" => [
    {
      header_clue: "What **kind** of pie do you want? Try asking for it with a query?",
      log_clue:    "",
      body_clue:   "\"That is a fantastic-looking **cherry** pie!\"\n"
    },
    {
      header_clue: "What should we do next? Where should we go?",
      log_clue:    "You will need to use both a nested path (resource/id) and a query parameter...",
      body_clue:   {
        resource: 'scenes',
        resource_id: 'crime',
        query: {investigate: 'body'}
      }
    }
  ],
  "/scenes/crime" => {
    header_clue: "",
    log_clue:    "Trust your instincts. Follow the status code, and do what it asks of you.",
    body_clue:   ""
  },
  "/aXQgd2FzIHBq" => {
    header_clue: "Join all of the odd elements, after the array has been reversed",
    log_clue:    "You are now in *another place*... Is this a dream???",
    body_clue:   [
      "5", "3os", "b3J", "3HH", "WN0", "hwq", "lyZ", "sPk", "gZG", "e00",
      "b3Q", "9F.", "HJv", "bky", "hlI", "8fh", "gdG", "2he", "aW4", "111"
    ]
  },
  "/aW4gdGhlIHJvb3QgZGlyZWN0b3J5" => {
    header_clue: "You hear something... Could it be an /alarm ?",
    log_clue:    "Wake up!",
    body_clue:   "::beep:: ::beep:: ::beep:: ::beep::\n"
  },
  "/alarm" => [
    {
      header_clue: "THE ALARM IS STILL ON! REMOVE THIS RESOURCE!",
      log_clue:    "To remove a resource, we need to **DELETE** it... We need more REST!",
      body_clue:   "::beep:: ::beep:: ::beep:: ::beep::\n"
    },
    {
      header_clue: "I need some /coffee... But this coffee is black.",
      log_clue:    "Let's **PUT** something **extra** into the coffee, like [**sugar**, **cream**].",
      body_clue:   "Structuring this data may be odd... HTTParty may be best to send it."
    }
  ],
  "/coffee" => {
    header_clue: "Wait a minute, I think I have it... We need to call the /police and leave them a message!",
    log_clue:    "Let's send the police the clue below to tell them what we know.",
    body_clue:   {
      clue: "it_was_all_a_dream"
    }
  },
  "/police" => [
    {
      header_clue: "There's no one answering, we have to go to the station...",
      log_clue:    "This status code is weird...",
      body_clue:   ""
    },
    {
      header_clue: "Read your errors!",
      log_clue:    "We have to go to /another_place",
      body_clue:   ""
    }
  ],
  "/another_place" => {
    header_clue: "If the index is even minus 1, otherwise add 1",
    log_clue:    "Turn strings to integer with .ord and integers to strings with .chr",
    body_clue:   ["e",1,"m",-1,"b","B","C",-1,"b","F","V","f","d","l",1,"f","M","W","K","l"]
  },
  "/d2l0aCB0aGUgcm0gLXJm" => {
    header_clue: "All of the nonsense paths came to you in a dream.",
    log_clue:    "The **content** of the dreams was **transferred** to you **in code**...",
    body_clue:   "If you can decode the paths so that they are readable, you will know the answer.\n"
  }
}

Class Method Summary collapse

Class Method Details



3
4
5
# File 'lib/another_place/application/evidence.rb', line 3

def self.print_to_log(message)
  $stderr.puts "== #{message}"
end