def handle_response(response, resource_descriptor)
      if resource_descriptor.is_collection?
        location = response.respond_to?(:location) ? response.location : nil
        ResourceCollection.new response.parsed_response, resource_descriptor, location: location
      else
        resource_descriptor.resource_klass.new response.parsed_response
      end
    end
def handle_response(response, resource_descriptor)
      if resource_descriptor.is_collection?
        location = response.respond_to?(:location) ? response.location : nil
        ResourceCollection.new response.parsed_response, resource_descriptor, location: location
      else
        resource_descriptor.resource_klass.new response.parsed_response
      end
    end
@private
 Formats the response from the Oanda API into a resource object.

 @param [#each_pair] response a hash-like object returned by
   the internal http client.

 @param [OandaAPI::Client::ResourceDescriptor] resource_descriptor metadata
   describing the requested resource.
 @return [OandaAPI::ResourceBase, OandaAPI::ResourceCollection] see {#execute_request}