Build Status Code Climate Inline docs Gem Version

A gem providing a Ruby client for the ResourceSync web synchronization framework, based on the resync gem and Net::HTTP.


Retrieving the Source Description for a site:

client =

source_desc_uri = ''
source_desc = client.get_and_parse(source_desc_uri) # => Resync::SourceDescription

Retrieving a Capability List from the source description:

cap_list_resource = source_desc.resource_for(capability: 'capabilitylist')
cap_list = cap_list_resource.get_and_parse # => Resync::CapabilityList

Retrieving a Change List and downloading the latest revision of a known resource to a file

change_list_resource = cap_list.resource_for(capability: 'changelist')
change_list = change_list_resource.get_and_parse # => Resync::ChangeList
latest_rev_resource = change_list.latest_for(uri: URI(''))

Retrieving a Change Dump, searching through its manifests for changes to a specified URL, downloading the ZIP package containing that resource, and extracting it from the ZIP package:

change_dump_resource = cap_list.resource_for(capability: 'changedump')
change_dump = change_dump_resource.get_and_parse # => Resync::ChangeDump
change_dump.resources.each do |package|
  manifest_link = package.link_for(rel: 'contents')
  if manifest_link
    manifest = manifest_link.get_and_parse # => Resync::ChangeDumpManifest
    latest_resource = manifest.latest_for(uri: URI(''))
    if latest_resource
      timestamp = latest_resource.modified_time.strftime('%s%3N')
      zip_package = package.zip_package # => Resync::ZipPackage (downloaded to temp file)
      bitstream = zip_package.bitstream_for(latest_resource) # => Resync::Bitstream
      content = bitstream.content # => String (extracted from ZIP file)"/tmp/my-resource-#{timestamp}.txt") { |f| f.write(content) }


This is a work in progress -- bug reports and feature requests are welcome. It's still a prototype, and hasn't really been tested except with resync-simulator -- and that not much beyond what you'll find in example.rb. So expect some trouble. :)