'Create a new record.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string (\'\') for this
argument.
:type  name: ``str``
:param zone: Zone where the requested record is created.
:type  zone: :class:`Zone`
:param type: DNS record type (A, AAAA, ...).
:type  type: :class:`RecordType`
:param data: Data for the record (depends on the record type).
Used only for A and AAAA record types.
:type  data: ``str``
:param extra: Extra attributes (driver specific). (optional)
:type extra: ``dict``
:rtype: :class:`Record`
For more info, please see:
https://docs.onapp.com/display/52API/Add+DNS+Record'

def create_record(self, name, zone, type, data, extra=None):

    dns_record = self._format_record(name, type, data, extra)
    dns_record_data = json.dumps({'dns_record': dns_record})
    response = self.connection.request(('/dns_zones/%s/records.json' % zone.id), method='POST', headers={'Content-type': 'application/json'}, data=dns_record_data)
    record = self._to_record(response.object, zone=zone)
    return record
