@classmethod
def from_api_data(cls, data):
    """Creates a new PurchaseResults object from API data from ticketswitch.

        Args:
            data (dict): the part of the response from a ticketswitch API call
                that concerns the results of a purchase attempt.

        Returns:
            :class:`PurchaseResult <pyticketswitch.purchase_result.PurchaseResult>`:
            a new
            :class:`PurchaseResult <pyticketswitch.purchase_result.PurchaseResult>`
            object populated with the data from the api.

        """
    kwargs = {'success': data.get('success'), 'failed_3d_secure': data.get(
        'failed_3d_secure'), 'failed_avs': data.get('failed_avs'),
        'failed_cv_two': data.get('failed_cv_two'), 'error': data.get(
        'purchase_error'), 'failure_reason': data.get('failure_reason'),
        'is_partial': data.get('is_partial'), 'is_semi_credit': data.get(
        'is_semi_credit')}
    return cls(**kwargs)
