uc3-dmp-citation 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f294fbee4a95b3148dab60d1c48b56a67ee71dfdb3d103b11814c68802c1d522
4
- data.tar.gz: f61d50ddf7597ba1300b373450d306d7ff982b133197e40e87dddb5c3e1404bf
3
+ metadata.gz: 51cc64bd3a8575a4fb04a20d82a1fd6386e4b35ce295267c0e565b709600c071
4
+ data.tar.gz: 1f9620c4964370b74bf04646531006e38c3a17fe5487bd7a1ec2e8de7231f830
5
5
  SHA512:
6
- metadata.gz: b395c33034a154b1052aefaf7f02d5fd6fa50e35bdc0dfe143ae1a33c7d5cddd3fdcc5e7964f930441c1354341cf72fb75e92a18db602419ff2e4bea0a7fa431
7
- data.tar.gz: 755a385577fd2ef925df4a4671d26e6925751462ec24995726cefe483adfe512f5c048c48f8419af4d6c9af595664f46a60ae54ac15704fe5d950345e36d761f
6
+ metadata.gz: 565110d35da1f33e2ade33ca48f7a6d4781e2a7b7c3898d48d0fc961cdb0450cf2acf2d759653fafa3d9235a53681032b7b306e2973faeef2203d3496899a595
7
+ data.tar.gz: 6f1080006959d2695c0087be1e7a691522087abb1438abaaedab5a822fc2d1a3b45dd42c70e01dbd958bbe48ac8ca61a2dbaec38e06a4c5e726777e63493940c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpCitation
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.4'
5
5
  end
@@ -21,16 +21,17 @@ module Uc3DmpCitation
21
21
  MSG_UNABLE_TO_UPDATE = 'Unable to update the citations on the DMP ID.'
22
22
 
23
23
  class << self
24
- def fetch_citation(doi:, logger: nil)
24
+ def fetch_citation(doi:, work_type: DEFAULT_WORK_TYPE, logger: nil)
25
25
  uri = _doi_to_uri(doi: doi)
26
26
  return nil if uri.nil? || uri.blank?
27
27
 
28
+ headers = { Accept: 'application/x-bibtex' }
28
29
  logger.debug(message: "Fetching BibTeX from: #{uri}") if logger.respond_to?(:debug)
29
30
  resp = Uc3DmpExternalApi::Client.call(url: uri, method: :get, additional_headers: headers, logger: logger)
30
31
  return nil if resp.nil? || resp.to_s.strip.empty?
31
32
 
32
33
  bibtex = BibTeX.parse(_cleanse_bibtex(text: resp))
33
- work_type = identifier['work_type'].nil? ? determine_work_type(bibtex: bibtex) : identifier['work_type']
34
+ work_type = work_type.nil? ? determine_work_type(bibtex: bibtex) : work_type
34
35
  _bibtex_to_citation(uri: uri, work_type: work_type, bibtex: bibtex)
35
36
  end
36
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-citation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley