diff options
author | Steven Blowers <shdblowers@gmail.com> | 2016-10-30 17:48:18 +0000 |
---|---|---|
committer | Steven Blowers <shdblowers@gmail.com> | 2016-10-30 17:48:18 +0000 |
commit | 687caf80ebd23ab659bed97f5ee43f97a8b182df (patch) | |
tree | d72002f23295d0e90aaa1dfeddd1b875ca3db101 /lib/http_client/in_memory.ex | |
parent | 6894ba18c6da270cb387cf8fa974b1da259bf361 (diff) | |
download | zendex-687caf80ebd23ab659bed97f5ee43f97a8b182df.tar.gz zendex-687caf80ebd23ab659bed97f5ee43f97a8b182df.tar.xz |
adding functionality to list all users
Diffstat (limited to 'lib/http_client/in_memory.ex')
-rw-r--r-- | lib/http_client/in_memory.ex | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/http_client/in_memory.ex b/lib/http_client/in_memory.ex index 91e5d84..50c5436 100644 --- a/lib/http_client/in_memory.ex +++ b/lib/http_client/in_memory.ex @@ -21,11 +21,20 @@ defmodule Zendex.HttpClient.InMemory do fake_response(["Reginald Ticket 1", "Reginald Ticket 2"]) end - def post!(@base_url <> "/api/v2/tickets.json", "{\"ticket\":{}}", [{"Authorization", _authentication}, {"Content-Type", "application/json"}]) do + def get!(@base_url <> "/api/v2/users.json", + [{"Authorization", _authentication}]) do + fake_response("users") + end + + def post!(@base_url <> "/api/v2/tickets.json", + "{\"ticket\":{}}", + [{"Authorization", _authentication}, {"Content-Type", "application/json"}]) do fake_response("Ticket created successfully!") end - def post!(@base_url <> "/api/v2/users.json", "{\"user\":{\"name\":\"Roger\",\"email\":\"roger@dodger.com\"}}", [{"Authorization", _authentication}, {"Content-Type", "application/json"}]) do + def post!(@base_url <> "/api/v2/users.json", + "{\"user\":{\"name\":\"Roger\",\"email\":\"roger@dodger.com\"}}", + [{"Authorization", _authentication}, {"Content-Type", "application/json"}]) do fake_response(%{user: %{id: 1234, name: "Roger", email: "roger@dodger.com"}}) end |