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

        Args:
            data (dict): the part of the response from a ticketswitch API call
                that concerns a media asset.

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

        """
    url = data.get('secure_complete_url', None)
    secure = True
    if not url:
        url = data.get('insecure_complete_url', None)
        secure = False
    kwargs = {'caption': data.get('caption', None), 'caption_html': data.
        get('caption_html', None), 'name': data.get('name', None), 'url':
        url, 'secure': secure, 'width': data.get('width'), 'height': data.
        get('height')}
    return cls(**kwargs)
