diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http_client/in_memory.ex | 21 | ||||
-rw-r--r-- | lib/zendex/http_client/in_memory.ex | 14 |
2 files changed, 21 insertions, 14 deletions
diff --git a/lib/http_client/in_memory.ex b/lib/http_client/in_memory.ex new file mode 100644 index 0000000..3d1a3ea --- /dev/null +++ b/lib/http_client/in_memory.ex @@ -0,0 +1,21 @@ +defmodule Zendex.HttpClient.InMemory do + @moduledoc """ + Allows testing of the Zendex project by mocking out calls to an actual Zendesk + API. + """ + + def get!("http://test.zendesk.com/api/v2/tickets.json", + [{"Authorization", _authentication}]) do + "ticket" + end + + def get!("http://test.zendesk.com/api/v2/search.json?query=requester%3AJimbob+type%3Aticket", + [{"Authorization", _authentication}]) do + ["Jimbob Ticket 1", "Jimbob Ticket 2"] + end + + def post!("http://test.zendesk.com/api/v2/tickets.json", + "{\"ticket\": {}}", + [{"Authorization", _authentication}, {"Content-Type", "application/json"} ]) do + end +end diff --git a/lib/zendex/http_client/in_memory.ex b/lib/zendex/http_client/in_memory.ex deleted file mode 100644 index 31dc00a..0000000 --- a/lib/zendex/http_client/in_memory.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule Zendex.HttpClient.InMemory do - @moduledoc """ - Allows testing of the Zendex project by mocking out calls to an actual Zendesk - API. - """ - - def get!("http://test.zendesk.com/api/v2/tickets.json", [{"Authorization", authentication}]) do - "ticket" - end - - def get!("http://test.zendesk.com/api/v2/search.json?query=requester%3AJimbob+type%3Aticket", [{"Authorization", authentication}]) do - ["Jimbob Ticket 1", "Jimbob Ticket 2"] - end -end |