class DMAO::API::DMP
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/dmp.rb, line 48 def self.handle_unprocessable_entity error_response errors = parse_error_response error_response raise_error_if_key DMAO::API::Errors::InvalidProjectID, errors, "project" raise DMAO::API::Errors::InvalidDMP.new("Invalid DMP details, please see errors.", errors) end
instance_from_api_data(data)
click to toggle source
# File lib/dmao/api/dmp.rb, line 33 def self.instance_from_api_data data attributes = { id: data["id"], institution_id: data["relationships"]["institution"]["data"]["id"], reviewed: data["attributes"]["reviewed"], url: data["attributes"]["url"],system_uuid: data["attributes"]["system-uuid"], system_modified_at: data["attributes"]["system-modified-at"], project_id: data["relationships"]["project"]["data"]["id"] } new(attributes) end
new(attributes)
click to toggle source
# File lib/dmao/api/dmp.rb, line 21 def initialize(attributes) @id = attributes[:id] @institution_id = attributes[:institution_id] @reviewed = attributes[:reviewed] @url = attributes[:url] @system_uuid = attributes[:system_uuid] @system_modified_at = attributes[:system_modified_at] @project_id = attributes[:project_id] end