Class: Orcid::RemoteWorkService

Inherits:
Object
  • Object
show all
Defined in:
app/services/orcid/remote_work_service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orcid_profile_id, options = {}) ⇒ RemoteWorkService

Returns a new instance of RemoteWorkService.



8
9
10
11
12
13
14
15
# File 'app/services/orcid/remote_work_service.rb', line 8

def initialize(orcid_profile_id, options = {})
  @orcid_profile_id = orcid_profile_id
  @request_method = options.fetch(:request_method) { :get }
  @body = options.fetch(:body) { "" }
  @token = options.fetch(:token) { Orcid.access_token_for(orcid_profile_id) }
  @headers = options.fetch(:headers) { default_headers }
  @path = options.fetch(:path) { default_path }
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def headers
  @headers
end

#orcid_profile_idObject (readonly)

Returns the value of attribute orcid_profile_id.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def orcid_profile_id
  @orcid_profile_id
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def path
  @path
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def request_method
  @request_method
end

#tokenObject (readonly)

Returns the value of attribute token.



7
8
9
# File 'app/services/orcid/remote_work_service.rb', line 7

def token
  @token
end

Class Method Details

.call(orcid_profile_id, options = {}) ⇒ Object



3
4
5
# File 'app/services/orcid/remote_work_service.rb', line 3

def self.call(orcid_profile_id, options = {})
  new(orcid_profile_id, options).call
end

Instance Method Details

#callObject

:post will append works to the Orcid Profile :put will replace the existing Orcid Profile works with the payload :get will retrieve the Orcid Profile support.orcid.org/knowledgebase/articles/177528-add-works-technical-developer



21
22
23
24
# File 'app/services/orcid/remote_work_service.rb', line 21

def call
  response = deliver
  response.body
end