Sha256: 2fde9803bebc44789c2d6b749cf77fabb8dc936bcbfba1fbb5808a3f02d23a89

Contents?: true

Size: 894 Bytes

Versions: 13

Compression:

Stored size: 894 Bytes

Contents

module Sufia
  module ResourceSync
    class CapabilityListWriter
      attr_reader :resource_list_url, :description_url
      def initialize(resource_list_url:, description_url:)
        @resource_list_url = resource_list_url
        @description_url = description_url
      end

      def write
        builder.to_xml
      end

      private

        def builder
          Nokogiri::XML::Builder.new do |xml|
            xml.urlset('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
                       'xmlns:rs' => 'http://www.openarchives.org/rs/terms/') do
              xml['rs'].ln(rel: "up", href: description_url)
              xml['rs'].md(capability: "capabilitylist")
              xml.url do
                xml.loc resource_list_url
                xml['rs'].md(capability: 'resourcelist')
              end
            end
          end
        end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sufia-7.4.1 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.4.0 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.3.1 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.3.0 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.3.0.rc3 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.3.0.rc2 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.3.0.rc1 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.2.0 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.1.0 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.0.0 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.0.0.rc2 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.0.0.rc1 lib/sufia/resource_sync/capability_list_writer.rb
sufia-7.0.0.beta4 lib/sufia/resource_sync/capability_list_writer.rb