Class: Crossrefapi::Works
- Inherits:
-
Object
- Object
- Crossrefapi::Works
- Defined in:
- lib/crossrefapi/works.rb
Overview
This class serves as the main entry point for interacting with the CrossRef API prefixes endpoints.
For detailed API documentation, visit: api.crossref.org/swagger-ui/index.html#/Works
Example usage:
client = Crossrefapi::Client.new
response = client.works.by_doi('10.2305/IUCN.UK.2016-1.RLTS.T56003281A22157381.en')
pp response
Instance Method Summary collapse
- #all(query) ⇒ Object
- #by_doi(doi) ⇒ Object
- #by_doi_agency(doi) ⇒ Object
-
#initialize(client) ⇒ Works
constructor
A new instance of Works.
Constructor Details
#initialize(client) ⇒ Works
Returns a new instance of Works.
16 17 18 |
# File 'lib/crossrefapi/works.rb', line 16 def initialize(client) @client = client end |
Instance Method Details
#all(query) ⇒ Object
20 21 22 |
# File 'lib/crossrefapi/works.rb', line 20 def all(query) @client.get("works", query) end |
#by_doi(doi) ⇒ Object
24 25 26 |
# File 'lib/crossrefapi/works.rb', line 24 def by_doi(doi) @client.get("works/#{doi}") end |
#by_doi_agency(doi) ⇒ Object
28 29 30 |
# File 'lib/crossrefapi/works.rb', line 28 def by_doi_agency(doi) @client.get("works/#{doi}/agency") end |