resync-client 0.2.1 → 0.2.3

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: 53bce63e13094ab4ffeec5ff5b3d4365c96eaf9f
4
- data.tar.gz: 72becf942fb027a0d02d948e3a98fb28d8a626fc
3
+ metadata.gz: f077335c97ed2009691229c16b7a09a67dcdd26a
4
+ data.tar.gz: 6e9ead882a801b98dfcae84a79a144829eafc624
5
5
  SHA512:
6
- metadata.gz: 97e28c200dbd29c6896c9c4d3e351f89ba0f3836f8cdf0ccc5e87517cb97fefe869e313311f87f635007a06e3373b9c499668b277d089b5b68c227fe4126559d
7
- data.tar.gz: c5b24e9fbb0db69734b5e805077b9da163b86ac84a1c4bf296868979812a49e1efa8b863ca1a7a6a386b148ed8c82f0a68c584f51281437851ff8e4a9af11bf8
6
+ metadata.gz: 7e624c546a773172d6001790e28bbd1a1a2ed1dfde653ec2e8b22e30dbd463e1e7390ae335fde5a396bb2b10ee53333582cfbc291a0a7a582d88991332148422
7
+ data.tar.gz: bc379b7fdbe407d309c6da128724a805dcd88c016750b71d17da4cee7f8b847ec13ba63f2533b476bb7fd948a81e9168a45833938d9713092c08a04646a4bbce
data/CHANGES.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.2.3
2
+
3
+ - Update to depend on [resync](https://github.com/dmolesUC3/resync) 0.2.2
4
+
5
+ # 0.2.2
6
+
7
+ - Replaced `Bistream#stream` with `Bitstream#get_input_stream`, which (unlike the former) returns a new stream with each invocation.
8
+ - Update to depend on [resync](https://github.com/dmolesUC3/resync) 0.2.1
9
+
1
10
  # 0.2.1
2
11
 
3
12
  - Update to depend on [resync](https://github.com/dmolesUC3/resync) 0.1.3
@@ -1,6 +1,6 @@
1
1
  module Resync
2
2
  class Client
3
3
  # The version of this gem.
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.3'
5
5
  end
6
6
  end
@@ -39,16 +39,17 @@ module Resync
39
39
  @size ||= @zip_entry.size
40
40
  end
41
41
 
42
- # The bitstream, as an +IO+-like object. Subsequent
43
- # calls will return the same stream.
44
- def stream
45
- @stream ||= @zip_entry.get_input_stream
42
+ # The bitstream, as an +IO+-like object. Each call
43
+ # to this method will return a new stream.
44
+ # @return [::Zip::InputStream] the bitstream.
45
+ def get_input_stream # rubocop:disable Style/AccessorMethodName
46
+ @zip_entry.get_input_stream
46
47
  end
47
48
 
48
49
  # The content of the bitstream. The content will be
49
50
  # read only once.
50
51
  def content
51
- @content ||= stream.read
52
+ @content ||= get_input_stream.read
52
53
  end
53
54
 
54
55
  # The content type of the bitstream, as per {#metadata}.
@@ -51,7 +51,7 @@ module Resync
51
51
  # Gets all bitstreams declared in the package manifest.
52
52
  # @return [Array<Bitstream>] a list of all bitstreams in the package
53
53
  def bitstreams
54
- manifest.resources.map { |r| bitstream_for(r) }
54
+ manifest.resources.to_a.map { |r| bitstream_for(r) }
55
55
  end
56
56
 
57
57
  # ------------------------------------------------------------
@@ -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.1.3'
25
+ spec.add_dependency 'resync', '~> 0.2', '>= 0.2.2'
26
26
  spec.add_dependency 'rubyzip', '~> 1.1'
27
27
 
28
28
  spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
@@ -25,19 +25,25 @@ module Resync
25
25
 
26
26
  source_desc = client.get_and_parse(sourcedesc_uri)
27
27
  expect(source_desc).to be_a(SourceDescription)
28
+ expect(source_desc.client).to be(client)
28
29
  cap_list_resource = source_desc.resource_for(capability: 'capabilitylist')
30
+ expect(cap_list_resource.client).to be(client)
29
31
  expect(cap_list_resource.uri).to eq(cap_list_uri)
30
32
 
31
33
  cap_list = cap_list_resource.get_and_parse
32
34
  expect(cap_list).to be_a(CapabilityList)
35
+ expect(cap_list.client).to be(client)
33
36
  change_list_resource = cap_list.resource_for(capability: 'changelist')
37
+ expect(change_list_resource.client).to be(client)
34
38
  expect(change_list_resource.uri).to eq(change_list_uri)
35
39
 
36
40
  change_list = change_list_resource.get_and_parse
41
+ expect(change_list.client).to be(client)
37
42
  expect(change_list).to be_a(ChangeList)
38
43
 
39
44
  changes = change_list.resources
40
- last_update = changes.select { |r| r.metadata.change == Resync::Types::Change::UPDATED }[-1]
45
+ last_update = changes.select { |r| r.metadata.change == Resync::Types::Change::UPDATED }.to_a[-1]
46
+ expect(last_update.client).to be(client)
41
47
  expect(last_update.uri).to eq(update_uri)
42
48
  expect(last_update.get).to eq(update_data)
43
49
  end
@@ -46,18 +46,19 @@ module Resync
46
46
  end
47
47
  end
48
48
 
49
- describe '#stream' do
49
+ describe '#get_input_stream' do
50
50
  it 'returns the input stream from the zip entry' do
51
51
  stream = instance_double(::Zip::InputStream)
52
52
  expect(@zip_entry).to receive(:get_input_stream).and_return(stream)
53
- expect(@bitstream.stream).to be(stream)
53
+ expect(@bitstream.get_input_stream).to be(stream)
54
54
  end
55
55
 
56
- it 'returns the same stream each time' do
57
- stream = instance_double(::Zip::InputStream)
58
- expect(@zip_entry).to receive(:get_input_stream).and_return(stream)
59
- expect(@bitstream.stream).to be(stream)
60
- expect(@bitstream.stream).to be(stream)
56
+ it 'returns a different stream each time' do
57
+ stream1 = instance_double(::Zip::InputStream)
58
+ stream2 = instance_double(::Zip::InputStream)
59
+ expect(@zip_entry).to receive(:get_input_stream).twice.and_return(stream1, stream2)
60
+ expect(@bitstream.get_input_stream).to be(stream1)
61
+ expect(@bitstream.get_input_stream).to be(stream2)
61
62
  end
62
63
  end
63
64
 
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.2.1
4
+ version: 0.2.3
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-05 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resync
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.1.3
22
+ version: 0.2.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.1'
29
+ version: '0.2'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.1.3
32
+ version: 0.2.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rubyzip
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.4.6
231
+ rubygems_version: 2.4.7
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Client library for ResourceSync