defmodule Jump do @base_url "https://wikimedia.org/api/rest_v1" def fetch(article, start, the_end) do url = "/metrics/pageviews/per-article/en.wikipedia.org/all-access/user/#{article}/daily/#{start}/#{the_end}" %{body: %{"items" => items}} = Req.get!(req(), url: url) items end def post(summary) do Req.post!("https://postman-echo.com/post", body: Jason.encode!(summary)) end def req do Req.new(base_url: @base_url) end end