Module: Dvla::Dataverse::Helper
- Defined in:
- lib/dvla/dataverse/helper.rb,
lib/dvla/dataverse/helper/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.4"
Class Method Summary collapse
-
.create_record(record_name, record_data) ⇒ Object
create a new record.
-
.delete_record(record_name, record_id) ⇒ Object
remove the record.
-
.retrieve_record(record_name: nil, max_return: nil) ⇒ Array
Get all the records as an array.
-
.service_check ⇒ Object
check if the service is online, also, check if the connection is established without and error.
-
.update_record(record_name, record_id, record_data) ⇒ Object
update the record.
Class Method Details
.create_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
51 52 53 54 55 |
# File 'lib/dvla/dataverse/helper.rb', line 51 def self.create_record(record_name, record_data) CreateRecords .new .new_record(record_name, record_data) end |
.delete_record(record_name, record_id) ⇒ Object
remove the record. You must provide the record ID and the record name. The record ID and the record name should be string
65 66 67 68 69 |
# File 'lib/dvla/dataverse/helper.rb', line 65 def self.delete_record(record_name, record_id) DeleteRecord .new .remove_record(record_name, record_id) end |
.retrieve_record(record_name: nil, max_return: nil) ⇒ Array
Get all the records as an array. If no records is found, this function will throw http 404 error. You can retrieve sub-records using the filter. You can only set the maximum records to be return if specify the record name
36 37 38 39 40 |
# File 'lib/dvla/dataverse/helper.rb', line 36 def self.retrieve_record(record_name: nil, max_return: nil) RetrieveRecords .new .get_records(record_name: record_name, max_return: max_return) end |
.service_check ⇒ Object
check if the service is online, also, check if the connection is established without and error.
89 90 91 92 93 |
# File 'lib/dvla/dataverse/helper.rb', line 89 def self.service_check ServiceCheck .new .send_request end |
.update_record(record_name, record_id, record_data) ⇒ Object
update the record. You must provide the record name, the record ID, and the record data.
81 82 83 84 85 |
# File 'lib/dvla/dataverse/helper.rb', line 81 def self.update_record(record_name, record_id, record_data) UpdateRecord .new .alter_record(record_name, record_id, record_data) end |