'Return attributes of this HDA that are exposed using the API.'

def to_dict(self, view='collection', expose_dataset_path=False):

    original_rval = super(HistoryDatasetAssociation, self).to_dict(view=view)
    hda = self
    rval = dict(id=hda.id, hda_ldda='hda', uuid=(lambda uuid: (str(uuid) if uuid else None))(hda.dataset.uuid), hid=hda.hid, file_ext=hda.ext, peek=(lambda hda: (hda.display_peek() if (hda.peek and (hda.peek != 'no    peek')) else None))(hda), model_class=self.__class__.__name__, name=hda.name, deleted=hda.deleted, purged=hda.purged, visible=hda.visible, state=hda.state, history_content_type=hda.history_content_type, file_size=int(hda.get_size()), create_time=hda.create_time.isoformat(), update_time=hda.update_time.isoformat(), data_type=((hda.datatype.__class__.__module__ + '.') + hda.datatype.__class__.__name__), genome_build=hda.dbkey, misc_info=(hda.info.strip() if isinstance(hda.info, string_types) else hda.info), misc_blurb=hda.blurb)
    rval.update(original_rval)
    if (hda.copied_from_library_dataset_dataset_association is not None):
        rval['copied_from_ldda_id'] = hda.copied_from_library_dataset_dataset_association.id
    if (hda.history is not None):
        rval['history_id'] = hda.history.id
    if (hda.extended_metadata is not None):
        rval['extended_metadata'] = hda.extended_metadata.data
    rval['peek'] = to_unicode(hda.display_peek())
    for (name, spec) in hda.metadata.spec.items():
        val = hda.metadata.get(name)
        if isinstance(val, MetadataFile):
            if (not expose_dataset_path):
                continue
            val = val.file_name
        elif ((val is None) and hasattr(hda.datatype, name)):
            val = getattr(hda.datatype, name)
        rval[('metadata_' + name)] = val
    return rval
