aboutsummaryrefslogtreecommitdiff
path: root/lib/zendex.ex
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2016-11-12 18:14:24 -0700
committerkballou <kballou@devnulllabs.io>2016-11-14 11:19:49 -0700
commit141547d8440b024a240654960b8f3f55a31d8ede (patch)
tree1b3bfa811c68c6f7fa1c557b31ffdc9e6804e30f /lib/zendex.ex
parent011abb47be01bce1bce599e0c265c079fa55fe86 (diff)
downloadzendex-add_streaming.tar.gz
zendex-add_streaming.tar.xz
refactoring to use new Zendex HTTPoison Clientadd_streaming
This change also replaces the tests that were using the "in-memory" client with `exvcr` cassettes based tests. This does increase test time by about a second, but the overall improvement in not having to maintain a separate module for testing is nice. Mocking request/response pairs is, however, slightly tedious.
Diffstat (limited to 'lib/zendex.ex')
-rw-r--r--lib/zendex.ex19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/zendex.ex b/lib/zendex.ex
index 2fbde39..e697d8b 100644
--- a/lib/zendex.ex
+++ b/lib/zendex.ex
@@ -38,15 +38,6 @@ defmodule Zendex do
resp
end
- def patch(path, connection, body \\ "") do
- _request(:patch, url(connection, path), connection.authentication, body)
- end
-
- def patch!(path, connection, body \\ "") do
- {_, resp} = patch(path, connection, body)
- resp
- end
-
@doc """
Underlying utility retrieval function
@@ -66,8 +57,14 @@ defmodule Zendex do
{auth, _} = Map.split(connection, [:authentication])
case pagination(options) do
- nil -> request_stream(:get, url, auth, "", :one_page)
- :none -> request_stream(:get, url, auth, "", :one_page)
+ nil ->
+ :get
+ |> request_stream(url, auth, "", :one_page)
+ |> realize_if_needed
+ :none ->
+ :get
+ |> request_stream(url, auth, "", :one_page)
+ |> realize_if_needed
:auto ->
:get
|> request_stream(url, auth)