Sha256: 360b363bb2ca646be64f541331fb68573a9ddca1940bf90e5310ca0c6b301eb7

Contents?: true

Size: 880 Bytes

Versions: 13

Compression:

Stored size: 880 Bytes

Contents

module Sufia
  module ResourceSync
    class SourceDescriptionWriter
      attr_reader :capability_list_url
      def initialize(capability_list_url: 'http://example.com/dataset1/capabilitylist.xml')
        @capability_list_url = capability_list_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: capability_list_url)
              xml['rs'].md(capability: "description")
              xml.url do
                xml.loc capability_list_url
                xml['rs'].md(capability: 'capabilitylist')
              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/source_description_writer.rb
sufia-7.4.0 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.3.1 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.3.0 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.3.0.rc3 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.3.0.rc2 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.3.0.rc1 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.2.0 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.1.0 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.0.0 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.0.0.rc2 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.0.0.rc1 lib/sufia/resource_sync/source_description_writer.rb
sufia-7.0.0.beta4 lib/sufia/resource_sync/source_description_writer.rb