'Update an existing record.
API docs: http://www.linode.com/api/dns/domain.resource.update'

def update_record(self, record, name=None, type=None, data=None, extra=None):

    params = {'api_action': 'domain.resource.update', 'ResourceID': record.id, 'DomainID': record.zone.id}
    if name:
        params['Name'] = name
    if data:
        params['Target'] = data
    if (type is not None):
        params['Type'] = self.RECORD_TYPE_MAP[type]
    merged = merge_valid_keys(params=params, valid_keys=VALID_RECORD_EXTRA_PARAMS, extra=extra)
    self.connection.request(API_ROOT, params=params).objects[0]
    updated_record = get_new_obj(obj=record, klass=Record, attributes={'name': name, 'data': data, 'type': type, 'extra': merged})
    return updated_record
