Sha256: 72995ab5f26ba305fd341debda0bafd1ef464319121c5ffa2c0652743bb7011c

Contents?: true

Size: 540 Bytes

Versions: 9

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Bolognese
  module Readers
    module DataciteJsonReader
      def read_datacite_json(string: nil, **options)
        errors = jsonlint(string)
        return { "errors" => errors } if errors.present?

        datacite_json = string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {}
        datacite_json["publisher"] = normalize_publisher(datacite_json["publisher"]) if datacite_json.fetch("publisher", nil).present?

        datacite_json
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bolognese-2.3.2 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.3.0 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.2.0 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.1.1 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.1.0 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.0.3 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.0.2 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.0.1 lib/bolognese/readers/datacite_json_reader.rb
bolognese-2.0.0 lib/bolognese/readers/datacite_json_reader.rb