title: Case statement when processing HTTPoison call
body: <p>I'm trying to use the same HTTPoison calls for an API call that returns either multiple items or a single item. The response for multiple items throws them into an "items" property, while the single item just returns the item info as the JSON string.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>  def process_url(method, id \\ 0) do
      if id &gt; 0 do
        "http://api.call.com/#{method}/#{id}?key=API_KEY"
      else
        "http://api.call.com/#{method}?key=API_KEY"
      end
    end
  
    def process_response_body(body) do
      body
      |&gt; Poison.decode!(as: %{"items" =&gt; [%Item{}]})
      |&gt; Map.fetch!("items")
    end
  </code></pre>
  
  <p>In process_response_body, how can I have it check for the items property in the JSON response, and if it doesn't exist, process it differently?</p>