diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2020-08-29 22:28:04 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2020-08-29 22:43:12 -0400 |
commit | 126ff42d912dfea9e251e2b98bdcf8f295b8707e (patch) | |
tree | 5820307fc63e643e36b9534686c3585d5ad3b346 /lib/mix | |
parent | add module for handling .well-known (diff) |
make Polyjuice.Client.start_link return {:ok, pid}, like a normal start_link
add a function that returns a client struct from the pid, and add a stop
function to Polyjuice.Client.stop
Diffstat (limited to 'lib/mix')
-rw-r--r-- | lib/mix/tasks/polyjuice/login.ex | 6 | ||||
-rw-r--r-- | lib/mix/tasks/polyjuice/logout.ex | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/mix/tasks/polyjuice/login.ex b/lib/mix/tasks/polyjuice/login.ex index 3ae1234..f485ed5 100644 --- a/lib/mix/tasks/polyjuice/login.ex +++ b/lib/mix/tasks/polyjuice/login.ex @@ -51,16 +51,18 @@ defmodule Mix.Tasks.Polyjuice.Login do nil end - client = + {:ok, client_pid} = Polyjuice.Client.start_link( url, storage: storage, sync: false ) + client = Polyjuice.Client.get_client(client_pid) + ret = Polyjuice.Client.log_in_with_password(client, user_id, password) - Polyjuice.Client.stop(client) + Polyjuice.Client.API.stop(client) if storage, do: Polyjuice.Client.Storage.close(storage) diff --git a/lib/mix/tasks/polyjuice/logout.ex b/lib/mix/tasks/polyjuice/logout.ex index 9ac65a3..71f0e4d 100644 --- a/lib/mix/tasks/polyjuice/logout.ex +++ b/lib/mix/tasks/polyjuice/logout.ex @@ -54,7 +54,7 @@ defmodule Mix.Tasks.Polyjuice.Logout do nil end - client = + {:ok, client_pid} = Polyjuice.Client.start_link( url, access_token: opts[:access_token], @@ -62,9 +62,11 @@ defmodule Mix.Tasks.Polyjuice.Logout do sync: false ) + client = Polyjuice.Client.get_client(client_pid) + ret = Polyjuice.Client.log_out(client) - Polyjuice.Client.stop(client) + Polyjuice.Client.API.stop(client) if storage, do: Polyjuice.Client.Storage.close(storage) |