diff --git a/lib/last_fm/session.ex b/lib/last_fm/session.ex
index 2148b275..359b548f 100644
--- a/lib/last_fm/session.ex
+++ b/lib/last_fm/session.ex
@@ -10,6 +10,28 @@ defmodule LastFm.Session do
Record.defrecord(:xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl"))
+ @doc """
+ Parses a Last.fm session XML response into a Session struct.
+
+ ## Examples
+
+ iex> xml = \"\"\"
+ ...>
+ ...>
+ ...>
+ ...> cloud8421
+ ...> super-secret
+ ...> 1
+ ...>
+ ...>
+ ...> \"\"\"
+ iex> LastFm.Session.parse(xml)
+ %LastFm.Session{
+ name: "cloud8421",
+ key: "super-secret",
+ pro: true
+ }
+ """
def parse(xml_string) do
doc = scan(xml_string)
diff --git a/test/last_fm/session_test.exs b/test/last_fm/session_test.exs
index e235d0c1..d3cd8ec8 100644
--- a/test/last_fm/session_test.exs
+++ b/test/last_fm/session_test.exs
@@ -3,6 +3,8 @@ defmodule LastFm.SessionTest do
alias LastFm.Session
+ doctest LastFm.Session
+
@xml """