resync-client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 339acc57f21bd27647e8f9484157b6b4d6f34007
4
- data.tar.gz: 293b87bfd6ec673c9e01701d1976626aef06994b
3
+ metadata.gz: 892297d37e81bd989c01ec1b8727c75944272ef5
4
+ data.tar.gz: 54e05162319203f118f59c2582ef2522cdf7e869
5
5
  SHA512:
6
- metadata.gz: 5b30f4db7f6ff8c3a7c8652edc4458dc991593f6e1d14ccf49e7e7d28d16f03fdb94853a24d70ff57d4e32fb927ef447e0fd78145a442b41533e9b11668188d4
7
- data.tar.gz: f37a86a97b4b3018d79b6a64031f3a0e36f6d5a165a19ff8a88284c490061d0876cfea283989321c3f4b7837e2203d262dff22d57796c793c981791bc5368cc0
6
+ metadata.gz: e6ae887ca08bda37140982c22c0f8cd6594f243a826464a9178d64e3f48e43340ffa20e50b853e4d09281ac3b831fa92c6ec6c23ad373c4a8ee476fb6a43957f
7
+ data.tar.gz: a841308856143cff35689d72676e4cb31e32207622b7f35582f56bd2524793ab56412d93236afa3400d6a31c593f74358e36064014ec2a4576023c4b4e3bfd20
data/CHANGES.md ADDED
@@ -0,0 +1,7 @@
1
+ # 0.1.1
2
+
3
+ - Update to depend on [resync](https://github.com/dmolesUC3/resync) 0.1.1
4
+
5
+ # 0.1.0
6
+
7
+ - Initial release
data/README.md CHANGED
@@ -2,58 +2,55 @@
2
2
 
3
3
  A gem providing a Ruby client for the [ResourceSync](http://www.openarchives.org/rs/1.0/resourcesync) web synchronization framework, based on the [resync](https://github.com/dmolesUC3/resync) gem and [Net::HTTP](http://ruby-doc.org/stdlib-2.2.2/libdoc/net/http/rdoc/Net/HTTP.html).
4
4
 
5
- ## Status
6
-
7
- This is a work in progress. We welcome bug reports and feature requests.
8
-
9
5
  ## Usage
10
6
 
11
7
  Retrieving the [Source Description](http://www.openarchives.org/rs/1.0/resourcesync#wellknown) for a site:
12
8
 
13
9
  ```ruby
14
- client = Resync::Client.new
10
+ client = Resync::Client.new
15
11
 
16
- source_desc_uri = 'http://example.org/.well-known/resourcesync'
17
- source_desc = client.get_and_parse(source_desc_uri) # => Resync::SourceDescription
12
+ source_desc_uri = 'http://example.org/.well-known/resourcesync'
13
+ source_desc = client.get_and_parse(source_desc_uri) # => Resync::SourceDescription
18
14
  ```
19
15
 
20
16
  Retrieving a [Capability List](http://www.openarchives.org/rs/1.0/resourcesync#CapabilityList) from the source description:
21
17
 
22
18
  ```ruby
23
- cap_list_resource = source_desc.resource_for(capability: 'capabilitylist')
24
- cap_list = cap_list_resource.get_and_parse # => Resync::CapabilityList
19
+ cap_list_resource = source_desc.resource_for(capability: 'capabilitylist')
20
+ cap_list = cap_list_resource.get_and_parse # => Resync::CapabilityList
25
21
  ```
26
22
 
27
23
  Retrieving a [Change List](http://www.openarchives.org/rs/1.0/resourcesync#ChangeList) and downloading the latest revision of a known resource to a file
28
24
 
29
25
  ```ruby
30
- change_list_resource = cap_list.resource_for(capability: 'changelist')
31
- change_list = change_list_resource.get_and_parse # => Resync::ChangeList
32
- latest_rev_resource = change_list.latest_for(uri: URI('http://example.com/my-resource'))
33
- latest_rev_resource.download_to_file('/tmp/my-resource.txt')
26
+ change_list_resource = cap_list.resource_for(capability: 'changelist')
27
+ change_list = change_list_resource.get_and_parse # => Resync::ChangeList
28
+ latest_rev_resource = change_list.latest_for(uri: URI('http://example.com/my-resource'))
29
+ latest_rev_resource.download_to_file('/tmp/my-resource.txt')
34
30
  ```
35
31
 
36
32
  Retrieving a [Change Dump](http://www.openarchives.org/rs/1.0/resourcesync#ChangeDump), searching through its manifests for changes to a specified URL, downloading the ZIP package containing that resource, and extracting it from the ZIP package:
37
33
 
38
34
  ```ruby
39
- change_dump_resource = cap_list.resource_for(capability: 'changedump')
40
- change_dump = change_dump_resource.get_and_parse # => Resync::ChangeDump
41
- change_dump.resources.each do |package|
42
- manifest_link = package.link_for(rel: 'contents')
43
- if manifest_link
44
- manifest = manifest_link.get_and_parse # => Resync::ChangeDumpManifest
45
- latest_resource = manifest.latest_for(uri: URI('http://example.com/my-resource'))
46
- if latest_resource
47
- timestamp = latest_resource.modified_time.strftime('%s%3N')
48
- zip_package = package.zip_package # => Resync::ZipPackage (downloaded to temp file)
49
- bitstream = zip_package.bitstream_for(latest_resource) # => Resync::Bitstream
50
- content = bitstream.content # => String (extracted from ZIP file)
51
- File.open("/tmp/my-resource-#{timestamp}.txt") { |f| f.write(content) }
52
- end
53
- end
35
+ change_dump_resource = cap_list.resource_for(capability: 'changedump')
36
+ change_dump = change_dump_resource.get_and_parse # => Resync::ChangeDump
37
+ change_dump.resources.each do |package|
38
+ manifest_link = package.link_for(rel: 'contents')
39
+ if manifest_link
40
+ manifest = manifest_link.get_and_parse # => Resync::ChangeDumpManifest
41
+ latest_resource = manifest.latest_for(uri: URI('http://example.com/my-resource'))
42
+ if latest_resource
43
+ timestamp = latest_resource.modified_time.strftime('%s%3N')
44
+ zip_package = package.zip_package # => Resync::ZipPackage (downloaded to temp file)
45
+ bitstream = zip_package.bitstream_for(latest_resource) # => Resync::Bitstream
46
+ content = bitstream.content # => String (extracted from ZIP file)
47
+ File.open("/tmp/my-resource-#{timestamp}.txt") { |f| f.write(content) }
54
48
  end
49
+ end
50
+ end
55
51
  ```
56
52
 
57
- ## Limitations
53
+ ## Status
54
+
55
+ 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](https://github.com/resync/resync-simulator) -- and that not much beyond what you'll find in [example.rb](example.rb). So expect some trouble. `:)`
58
56
 
59
- `resync-client` hasn't really been tested except with [resync-simulator](https://github.com/resync/resync-simulator), and that not much beyond what you'll find in [example.rb](example.rb), so expect trouble.
@@ -1,6 +1,6 @@
1
1
  module Resync
2
2
  class Client
3
3
  # The version of this gem.
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'resync', '~> 0.1.0'
25
+ spec.add_dependency 'resync', '~> 0.1', '>= 0.1.1'
26
26
  spec.add_dependency 'rubyzip', '~> 1.1.7'
27
27
 
28
28
  spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resync-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-02 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resync
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.0
19
+ version: '0.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 0.1.0
29
+ version: '0.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.1
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rubyzip
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -147,6 +153,7 @@ files:
147
153
  - ".rubocop.yml"
148
154
  - ".ruby-version"
149
155
  - ".travis.yml"
156
+ - CHANGES.md
150
157
  - Gemfile
151
158
  - LICENSE.md
152
159
  - README.md