class DMAO::API::Dataset
Constants
- ENDPOINT
- INVALID_ENTITY_CLASS
- INVALID_ENTITY_ERROR_MESSAGE
- INVALID_ID_ERROR
- NOT_FOUND_ERROR
- VALID_ATTRIBUTES
Public Class Methods
handle_unprocessable_entity(error_response)
click to toggle source
# File lib/dmao/api/dataset.rb, line 77 def self.handle_unprocessable_entity error_response errors = parse_error_response error_response raise_error_if_key DMAO::API::Errors::InvalidProjectID, errors, "project" raise_error_if_key DMAO::API::Errors::InvalidOrganisationUnitID, errors, "owning_unit" raise DMAO::API::Errors::InvalidDataset.new("Invalid dataset details, please see errors.", errors) end
instance_from_api_data(data)
click to toggle source
# File lib/dmao/api/dataset.rb, line 55 def self.instance_from_api_data data attributes = { id: data["id"], institution_id: data["relationships"]["institution"]["data"]["id"], permanent_id: data["attributes"]["permanent-id"], title: data["attributes"]["title"], description: data["attributes"]["description"], publisher: data["attributes"]["publisher"], access: data["attributes"]["access"], notes: data["attributes"]["notes"], creation_date: data["attributes"]["creation-date"], system_uuid: data["attributes"]["system-uuid"], system_modified_at: data["attributes"]["system-modified-at"], project_id: data["relationships"]["project"]["data"]["id"], owning_unit_id: data["relationships"]["owning-unit"]["data"]["id"] } new(attributes) end
new(attributes)
click to toggle source
# File lib/dmao/api/dataset.rb, line 37 def initialize(attributes) @id = attributes[:id] @institution_id = attributes[:institution_id] @permanent_id = attributes[:permanent_id] @title = attributes[:title] @description = attributes[:description] @publisher = attributes[:publisher] @access = attributes[:access] @notes = attributes[:notes] @creation_date = attributes[:creation_date] @system_uuid = attributes[:system_uuid] @system_modified_at = attributes[:system_modified_at] @project_id = attributes[:project_id] @owning_unit_id = attributes[:owning_unit_id] end