Skip to content

Commit

Permalink
Merge branch 'main' into mccalluc-diff-module
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Dec 20, 2022
2 parents 033274f + a5cbc72 commit 9caad7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/models/pdc_metadata/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def to_xml

class << self
# Creates a PDCMetadata::Resource from a JSON string
def new_from_json(json_data)
# TODO: When folks are back in the office, there is an agenda item to discuss
# what "json" means to everyone. There may be some renaming after that.
def new_from_json(hash)
resource = PDCMetadata::Resource.new
return resource if json_data.blank?

hash = json_data
return resource if hash.blank?

set_basics(resource, hash)
set_curator_controlled_metadata(resource, hash)
Expand Down
3 changes: 1 addition & 2 deletions spec/models/pdc_serialization/datacite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@
fixtures_dir = "spec/fixtures/resource-to-datacite"
Dir.glob("#{fixtures_dir}/*.resource.yaml").each do |resource_path|
it "handles #{resource_path}" do
resource_json = YAML.load_file(resource_path).to_json
resource = PDCMetadata::Resource.new_from_json(resource_json)
resource = PDCMetadata::Resource.new_from_json(YAML.load_file(resource_path))
datacite_xml = resource.to_xml

datacite_path = resource_path.gsub(".resource.yaml", ".datacite.xml")
Expand Down

0 comments on commit 9caad7a

Please sign in to comment.