   use ExActor.Strict, export: :encore
   import Prelude
 
-  @url Application.get_env(:confluence, :url) 
+  @url Application.get_env(:confluence, :url)
   @wk1 String.strip(File.read!("data/wikitemplates/wk1.txt"))
   @disabled Application.get_env(:confluence, :disabled)
 

      title: "#{group.id}: #{group.title}",
      space: "MOOC"}
    case make_request("storePage", page, token) do
      {:ok, resp} -> 
        %{ group | wiki_url: String.replace(resp["url"], "http:", "https:") } |> Survey.Repo.update!
        {:ok, resp}
      x -> x 
    end
    |> reply
  end

  defcall get_page(id), state: token do
    if is_integer(id), do: id = Integer.to_string(id)
    make_request("getPage", id, token)
    |> reply
  end

  def gen_password, do: :crypto.rand_bytes(20) |> safe_encode_base64

  def make_request(method, param, token) do
    request_body = %XMLRPC.MethodCall{method_name: "confluence2." <> method,  
      params: List.flatten([token, param])}
    |> XMLRPC.encode!
    |> web_request

      name: String.downcase(user.edx_email),
      fullname: user.nick}
    case make_request("addUser", [userdef, pwd], token) do
      h = {:ok, _} ->
        %{ user | wiki_pwd: pwd } |> Survey.Repo.update!
        reply(h)
      h -> reply(h)
