defmodule MetaInspector do
  defstruct status: nil
  @type t :: %__MODULE__{status: String.t}

  def new(url) do
    document = HTTPoison.get!(url)
    %MetaInspector{status: status(document)}
  end

  def status(document) do
    document.status_code
  end
end

defmodule MetaInspector do
  defstruct status: nil, title: nil
  @type t :: %__MODULE__{status: integer, title: String.t}

  def new(url) do
    document = HTTPoison.get!(url)
    body = document.body
    %MetaInspector{status: status(document), title: title(body)}
  end

  def status(document) do
    document.status_code
  end

  def title(body) do
    Floki.find(body, "head title")
    |> Floki.text
  end
end

Add title attribute to struct
Add title attribute to struct

nekova/metainvestigator