• 
      

    Change how parsing of response payloads works.

    Review Request #4213 — Created June 6, 2013 and submitted — Latest diff uploaded

    Information

    Review Board
    master

    Reviewers

    Change how parsing of response payloads works.
    
    Previously, every resource had to override parse(), call the parent
    parse(), grab the contents of the payload within the envelope, and then
    set each field in the response from the parent parse() and return it.
    
    The problem with that is that only works if we have the envelope. That
    won't work from list resources.
    
    Now, subclasses override parseResourceData, which only needs to return
    the data specific to the subclass. The rsp it parses from is guaranteed
    to be within the envelope, if one exists.
    
    parse() exists only in BaseResource now. It will remove the rsp data
    from the envelope if it sees a 'stat' header. Otherwise, it assumes the
    data it's dealing with is proper resource data.
    
    This is needed for my upcoming change to introduce
    BaseResourceCollection.
    All unit tests pass.
    
    My BaseResourceCollection was able to deserialize models after this
    change.