Class: Datacite::RegisterDoiRequestBody

Inherits:
Object
  • Object
show all
Defined in:
lib/datacite/register_doi_request_body.rb

Overview

The JSON request to create a specific DOI

Instance Method Summary collapse

Constructor Details

#initialize(prefix:, suffix:) ⇒ RegisterDoiRequestBody

Returns a new instance of RegisterDoiRequestBody.

Parameters:

  • prefix (String)
  • suffix (String)


8
9
10
11
# File 'lib/datacite/register_doi_request_body.rb', line 8

def initialize(prefix:, suffix:)
  @prefix = prefix
  @suffix = suffix
end

Instance Method Details

#to_json(*_args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/datacite/register_doi_request_body.rb', line 14

def to_json(*_args)
  {
    data: {
      type: "dois",
      attributes: {
        doi: "#{prefix}/#{suffix}"
      }
    }
  }
end