Sha256: f43f6962091202236b247353bf2ad8de15668354e62372d60d939c053c0488fb

Contents?: true

Size: 721 Bytes

Versions: 11

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module PurlFetcher
  class Client
    # Create a MODS represenation of Cocina JSON
    class Mods
      # @param [Cocina::Models::Dro] cocina the Cocina JSON representation of the object
      def self.create(cocina:)
        new(cocina:).create
      end

      # @param [Cocina::Models::Dro] cocina the Cocina JSON representation of the object
      def initialize(cocina:)
        @cocina = cocina
      end

      def create
        response = client.post(path:, body:)
      end

      private

      attr_reader :cocina

      def body
        cocina.to_json
      end

      def client
        Client.instance
      end

      def path
        "/v1/mods"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
purl_fetcher-client-2.1.2 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-2.1.1 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-2.1.0 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-2.0.0 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.5.4 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.5.3 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.5.2 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.5.1 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.5.0 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.4.1 lib/purl_fetcher/client/mods.rb
purl_fetcher-client-1.4.0 lib/purl_fetcher/client/mods.rb