title: What's the easiest way to make HTTParty return an object/class rather than a JSON response?
body: <p>Right now I call:</p>
  
  <pre><code>def child(parent_id, child_id, params = {})
    if @api_token
      self.class.get("/parents/#{parent_id}/children/#{child_id}", query: params,
                        :headers=&gt;{"Authorization"=&gt;"Token token=#{@api_token}"})
    else
      self.class.get("/parents/#{parent_id}/children/#{child_id}", query: params)
    end
  end
  </code></pre>
  
  <p>It returns the JSON response directly from the API as a hash. Is there an easy way for me to standardize the response so that it parses the JSON and generates a class? </p>
  
  <p>Example:</p>
  
  <pre><code>Original Response
  --------
  {'child' : { 'name' : 'John Doe', 'age' : 23 } }
  
  Desired Response
  --------
  res.name # John Doe
  res.age  # 23
  res.class # APIClient::Child
  </code></pre>