Class: CreateRecords

Inherits:
DataverseOperations show all
Defined in:
lib/dvla/dataverse/operations/create_records.rb

Instance Method Summary collapse

Methods inherited from DataverseOperations

#apply_filter, #get_url_from_config_file, #http_request_artifacts, #initialize, #send_request, #setup_http_headers

Constructor Details

This class inherits a constructor from DataverseOperations

Instance Method Details

#new_record(record_name, record_data) ⇒ Object

create a new record. You must provide the record name and the record payload/data. The payload/data must be a hash

Examples:

payload = {email => '[email protected]'}
new_record('user', payload)

Parameters:

  • record_name (String)

    the name of the record

  • record_data (Hash)

    the record payload



20
21
22
23
24
25
# File 'lib/dvla/dataverse/operations/create_records.rb', line 20

def new_record(record_name, record_data)
  setup_http_payload(record_data)
  apply_filter({ record_name: record_name })

  send_request
end

#setup_artifactsObject



5
6
7
8
9
# File 'lib/dvla/dataverse/operations/create_records.rb', line 5

def setup_artifacts
  setup_http_headers
  http_request_artifacts.url = get_url_from_config_file
  http_request_artifacts.method = :post
end