Class: Pubmedly::Pubmed
- Inherits:
-
Object
- Object
- Pubmedly::Pubmed
- Defined in:
- lib/pubmedly/pubmed.rb
Overview
The Pubmed class is the main entry point for the gem. It is initialized with an NCBI API key and exposes methods for searching and fetching articles.
Instance Method Summary collapse
- #articles(term, **kwargs) ⇒ Object
- #fetch ⇒ Object
-
#initialize(api_key) ⇒ Pubmed
constructor
A new instance of Pubmed.
- #search ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Pubmed
Returns a new instance of Pubmed.
15 16 17 |
# File 'lib/pubmedly/pubmed.rb', line 15 def initialize(api_key) @client = Client.new(api_key) end |
Instance Method Details
#articles(term, **kwargs) ⇒ Object
27 28 29 |
# File 'lib/pubmedly/pubmed.rb', line 27 def articles(term, **kwargs) fetch(search(term, **kwargs), **kwargs) end |
#fetch ⇒ Object
23 24 25 |
# File 'lib/pubmedly/pubmed.rb', line 23 def fetch(...) Parsers::Response.new(@client.fetch(...)).articles end |
#search ⇒ Object
19 20 21 |
# File 'lib/pubmedly/pubmed.rb', line 19 def search(...) Parsers::Response.new(@client.search(...)).ids end |