aboutsummaryrefslogtreecommitdiff
path: root/lib/http_client/in_memory.ex
blob: 3d1a3ea7333a5a1b09376094a0db0c2f0fcab8dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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