bolognese 0.10.2 → 0.10.3

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: fdb263ed4888b67cb1e72c5e70251e297753082ff8c9d8ebc0a828361ffc09b8
4
- data.tar.gz: 0ce0f6d026eb9bb4facc6da6063a5635e33dc3709b12e4c3acde674ed8acd15a
3
+ metadata.gz: bc0b25824fcc0ef740e3a84cee8d5a811481135b183f442f41b7706f29e25623
4
+ data.tar.gz: 7acdaf20087b71eaa8d49cc9649e3b701066a22c7c250801d55fcfb979d76d3a
5
5
  SHA512:
6
- metadata.gz: 74a757193724aa369a1adeb421c195e17c7a6f49eda510db374937304a236ee2c1043126027a5814e3ab4245a05d3597dafc67acea11aee6643e33e1638bad37
7
- data.tar.gz: cf6ffdc6ea3d908b0f8a74c7dbfba2971223b1472cc7cb2689bdcbc63155d130ce09b674b856d14784d525b6b86efec172f91fe72a4ac2dfb6d3d5b84237406f
6
+ metadata.gz: d2c0634ea207320e387174a52ea368a066263a06c1e48a838489477d6ae58b87c308c19f864c4768c036bcce606ee017b0ca8ba97a8c1d224bda861bdf82b740
7
+ data.tar.gz: 6082d4c5f232e1650a0a3b885624aad4476a0ae6033f710f96a4c0e64c03aee010089ab8752a2d99fd309f201eb56a3876a666903a6aa2e7e7c85210b8f38b00
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.10.2)
4
+ bolognese (0.10.3)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -15,7 +15,7 @@ module Bolognese
15
15
  # generate name for method to call dynamically
16
16
  hsh = @from.present? ? send("get_" + @from, id: id, sandbox: options[:sandbox]) : {}
17
17
  string = hsh.fetch("string", nil)
18
- elsif File.exist?(input)
18
+ elsif input.present? && File.exist?(input)
19
19
  ext = File.extname(input)
20
20
  if %w(.bib .ris .xml .json).include?(ext)
21
21
  string = IO.read(input)
@@ -90,7 +90,7 @@ module Bolognese
90
90
  end
91
91
 
92
92
  def should_passthru
93
- (from == "datacite") && regenerate.blank?
93
+ (from == "datacite") && regenerate.blank? && raw.present?
94
94
  end
95
95
 
96
96
  def type
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.10.2"
2
+ VERSION = "0.10.3"
3
3
  end
@@ -175,7 +175,18 @@ describe Bolognese::Metadata, vcr: true do
175
175
  expect(subject.doi).to eq("10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
176
176
  expect(subject.service_provider).to eq("DataCite")
177
177
  expect(subject.state).to eq("not_found")
178
- expect(subject.datacite).to be_nil
178
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
179
+ expect(datacite["identifier"]).to eq("identifierType"=>"DOI", "__content__"=>"10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
180
+ expect(datacite["xmlns"]).to eq("http://datacite.org/schema/kernel-4")
181
+ end
182
+
183
+ it "no input" do
184
+ input = nil
185
+ subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
186
+ expect(subject.valid?).to be false
187
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
188
+ expect(datacite["identifier"]).to eq("identifierType"=>"DOI", "__content__"=>"10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
189
+ expect(datacite["xmlns"]).to eq("http://datacite.org/schema/kernel-4")
179
190
  end
180
191
  end
181
192
 
@@ -208,6 +219,15 @@ describe Bolognese::Metadata, vcr: true do
208
219
  expect(datacite.dig("descriptions", "description")).to eq("descriptionType"=>"Abstract", "__content__"=>"This is an abstract.")
209
220
  end
210
221
 
222
+ it "change description no input" do
223
+ input = nil
224
+ subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
225
+ subject.description = "This is an abstract."
226
+ expect(subject.valid?).to be false
227
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
228
+ expect(datacite.dig("descriptions", "description")).to eq("descriptionType"=>"Abstract", "__content__"=>"This is an abstract.")
229
+ end
230
+
211
231
  it "change license" do
212
232
  input = "10.7554/eLife.01567"
213
233
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2018-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma