diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http_client/in_memory.ex | 6 | ||||
-rw-r--r-- | lib/zendex/user.ex | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/http_client/in_memory.ex b/lib/http_client/in_memory.ex index d05bcea..a448afd 100644 --- a/lib/http_client/in_memory.ex +++ b/lib/http_client/in_memory.ex @@ -31,6 +31,12 @@ defmodule Zendex.HttpClient.InMemory do fake_response(%{"user": %{"id": 87, "name": "Quim Stroud"}}) end + def get!("#{@base_url}/api/v2/users/show_many.json?ids=6,67", + [{"Authorization", _authentication}]) do + fake_response(%{users: [%{id: 6, name: "Kiki Segal"}, + %{id: 67, name: "Sarpedon Baumgartner"}]}) + end + def post!(@base_url <> "/api/v2/tickets.json", "{\"ticket\":{}}", [{"Authorization", _authentication}, {"Content-Type", "application/json"}]) do diff --git a/lib/zendex/user.ex b/lib/zendex/user.ex index 8479735..31c3a06 100644 --- a/lib/zendex/user.ex +++ b/lib/zendex/user.ex @@ -29,6 +29,18 @@ defmodule Zendex.User do end @doc """ + Show many user, given their ids. + """ + @spec show_many(Zendex.Connection.t, [integer]) :: map + def show_many(connection, ids) do + ids = Enum.join(ids, ",") + + "#{connection.base_url}#{@url}/show_many.json?ids=#{ids}" + |> @http_client.get!(CommonHelpers.get_headers(connection.authentication)) + |> CommonHelpers.decode_response + end + + @doc """ Create a new user. """ @spec create(Zendex.Connection.t, map) :: map |