Method: OrcidClient::Api#delete_notification

Defined in:
lib/orcid_client/api.rb

#delete_notification(options = {}) ⇒ Object



99
100
101
102
103
104
105
106
107
# File 'lib/orcid_client/api.rb', line 99

def delete_notification(options={})
  return OpenStruct.new(body: { "errors" => [{ "title" => "Notification access token missing" }] }) unless notification_access_token.present?
  return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?

  orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'

  url = "#{orcid_api_url}/v#{API_VERSION}/#{orcid}/notification-permission/#{put_code}"
  Maremma.delete(url, content_type: 'application/vnd.orcid+xml', bearer: notification_access_token)
end