Skip to content

Commit

Permalink
indifferent access for doi creaation options
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 14, 2020
1 parent d40e8b7 commit c2766dc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bolognese (1.7.3)
bolognese (1.7.4)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand Down Expand Up @@ -119,7 +119,7 @@ GEM
namae (1.0.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oj (3.10.6)
oj (3.10.7)
oj_mimic_json (1.0.1)
optimist (3.0.1)
postrank-uri (1.0.24)
Expand Down
1 change: 1 addition & 0 deletions lib/bolognese/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Metadata
:types, :content_url, :related_identifiers, :style, :locale, :date_registered

def initialize(input: nil, from: nil, **options)
options = HashWithIndifferentAccess.new(options)
id = normalize_id(input, options)
ra = nil

Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bolognese
VERSION = "1.7.3"
VERSION = "1.7.4"
end
2 changes: 1 addition & 1 deletion spec/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
it "missing_comma" do
json = IO.read(fixture_path + "datacite_software_missing_comma.json")
response = subject.jsonlint(json)
expect(response).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
expect(response).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
end

it "overlapping_keys" do
Expand Down
2 changes: 1 addition & 1 deletion spec/readers/datacite_json_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
input = fixture_path + "datacite_software_missing_comma.json"
subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
expect(subject.valid?).to be false
expect(subject.errors).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
expect(subject.codemeta).to be_nil
end

Expand Down
4 changes: 3 additions & 1 deletion spec/readers/datacite_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"funderIdentifier"=>"https://doi.org/10.13039/501100000780",
"funderIdentifierType"=>"Crossref Funder ID",
"funderName"=>"European Commission"}],
types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" })
types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" },
"identifiers" => [{ "identifierType"=>"Repository ID", "identifier"=>"123" }])

expect(subject.valid?).to be true
expect(subject.doi).to eq("10.5281/zenodo.1239")
Expand All @@ -359,6 +360,7 @@
"funderIdentifier"=>"https://doi.org/10.13039/501100000780",
"funderIdentifierType"=>"Crossref Funder ID",
"funderName"=>"European Commission"}])
expect(subject.identifiers).to eq([{"identifier"=>"123", "identifierType"=>"Repository ID"}])
expect(subject.agency).to eq("DataCite")
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
expect(subject.state).to eq("findable")
Expand Down

0 comments on commit c2766dc

Please sign in to comment.