Class: Datacite::Response

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

Overview

The response object from the datacite API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.

Parameters:

  • response (Hash)

    a json reponse



7
8
9
# File 'lib/datacite/response.rb', line 7

def initialize(response)
  @body = response.body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



11
12
13
# File 'lib/datacite/response.rb', line 11

def body
  @body
end

Instance Method Details

#doiObject



13
14
15
# File 'lib/datacite/response.rb', line 13

def doi
  body.dig("data", "id")
end