Add some basic code

This commit is contained in:
2024-10-10 22:04:34 -05:00
parent 7f7a63f379
commit caa9a46c1b
10 changed files with 136 additions and 13 deletions

18
lib/elixir_rss.ex Normal file
View File

@@ -0,0 +1,18 @@
defmodule ElixirRss do
@moduledoc """
Documentation for `ElixirRss`.
"""
@doc """
Hello world.
## Examples
iex> ElixirRss.hello()
:world
"""
def hello do
:world
end
end

14
lib/fetch_rss.ex Normal file
View File

@@ -0,0 +1,14 @@
defmodule ElixirRss.Fetch do
def fetch(url) do
url
|> HTTPoison.get()
|> handle_response()
end
defp handle_response({:ok, %{status_code: 200, body: body}}) do
{:ok, body}
end
defp handle_response({_, %{status_code: _, body: body}}) do
{:error, body}
end
end