Class: Orcid::Remote::ProfileQueryService
- Defined in:
- app/services/orcid/remote/profile_query_service.rb,
app/services/orcid/remote/profile_query_service/response_parser.rb,
app/services/orcid/remote/profile_query_service/search_response.rb,
app/services/orcid/remote/profile_query_service/query_parameter_builder.rb
Overview
Responsible for querying Orcid to find various ORCiDs
Defined Under Namespace
Modules: QueryParameterBuilder Classes: ResponseParser, SearchResponse
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query_builder ⇒ Object
readonly
Returns the value of attribute query_builder.
-
#response_builder ⇒ Object
readonly
Returns the value of attribute response_builder.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #call(input) ⇒ Object (also: #search)
-
#initialize(config = {}, &callbacks) ⇒ ProfileQueryService
constructor
A new instance of ProfileQueryService.
Methods inherited from Service
Constructor Details
#initialize(config = {}, &callbacks) ⇒ ProfileQueryService
Returns a new instance of ProfileQueryService.
13 14 15 16 17 18 19 20 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 13 def initialize(config = {}, &callbacks) super(&callbacks) @query_builder = config.fetch(:query_parameter_builder) { QueryParameterBuilder } @token = config.fetch(:token) { default_token } @parser = config.fetch(:parser) { ResponseParser } @path = config.fetch(:path) { 'v1.1/search/orcid-bio/' } @headers = config.fetch(:headers) { default_headers } end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 11 def headers @headers end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
12 13 14 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 12 def parser @parser end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 11 def path @path end |
#query_builder ⇒ Object (readonly)
Returns the value of attribute query_builder.
11 12 13 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 11 def query_builder @query_builder end |
#response_builder ⇒ Object (readonly)
Returns the value of attribute response_builder.
11 12 13 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 11 def response_builder @response_builder end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
11 12 13 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 11 def token @token end |
Class Method Details
.call(query, config = {}, &callbacks) ⇒ Object
7 8 9 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 7 def self.call(query, config = {}, &callbacks) new(config, &callbacks).call(query) end |
Instance Method Details
#call(input) ⇒ Object Also known as: search
22 23 24 25 26 27 28 |
# File 'app/services/orcid/remote/profile_query_service.rb', line 22 def call(input) parameters = query_builder.call(input) response = deliver(parameters) parsed_response = parse(response.body) issue_callbacks(parsed_response) parsed_response end |