Class: Cinii::Client::Article
- Inherits:
-
Base
- Object
- Base
- Cinii::Client::Article
show all
- Defined in:
- lib/cinii/client/article.rb
Constant Summary
collapse
- ARTICLE_REQUIRED_KEYS =
%I(
q title author author_id issn publisher affiliation journal volume
issue page references year_from year_to
)
Instance Method Summary
collapse
Methods inherited from Base
#has_required_params?, #initialize, #send_get
Instance Method Details
#article(naid) ⇒ Object
37
38
39
40
41
|
# File 'lib/cinii/client/article.rb', line 37
def article(naid)
raise 'Not implemented yet.'
response = send_get("/naid/#{naid}")
end
|
#author(nrid) ⇒ Object
44
45
46
47
48
|
# File 'lib/cinii/client/article.rb', line 44
def author(nrid)
raise 'Not implemented yet.'
response = send_get("/nrid/#{nrid}")
end
|
#list_articles(**params) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/cinii/client/article.rb', line 13
def list_articles(**params)
if params[:full_text] == true
raise ArgumentError unless has_required_params?(params, [:q])
response = send_get('/opensearch/fulltext', full_text_params(params))
else
raise ArgumentError unless has_required_params?(params, ARTICLE_REQUIRED_KEYS)
response = send_get('/opensearch/search', article_params(params))
end
Cinii::SearchResult::Article.new(response)
end
|
#list_authors(**params) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/cinii/client/article.rb', line 28
def list_authors(**params)
raise ArgumentError unless has_required_params?(params, [:q])
response = send_get('/opensearch/author', author_params(params))
Cinii::SearchResult::Article.new(response)
end
|