contentdm_api 0.3.8 → 0.3.9

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: c360b8c161aa3aabb878d689e3003b115a9d7db8
4
- data.tar.gz: c04c8ad9223156ba3f08b28a973e68a49e823104
3
+ metadata.gz: 8427c4149b9298b985da7c0866b8a988980cd586
4
+ data.tar.gz: 05831fb10287a22c7a6a842214c424fd98a86149
5
5
  SHA512:
6
- metadata.gz: b357fffcbd6504ee7e7d798d68bab1283bcad0f9cff50bf09ed6696d4280c0d220118f95d2d1fd0469cb41aebf1983f636fb1b7f0eccc367dd73532cd681bf17
7
- data.tar.gz: ed18f0abbb8afc1a49493b16c60bea5f0eca481366e7e910b284e7c0d49c24d2acc65dede6c0ddc3e9b1b6d8d34f4d9d01e0e1663800d85428554c5aa05cb1e8
6
+ metadata.gz: 703e28c897cb1495c7659e09a6085ead17901eced6553d1ec79a5efa9749351e21623d6d3bd41600bbc04318facb5d5c066985492bbe079cbffa6f5358d83f97
7
+ data.tar.gz: 31f037b87f3b73979ea0d7f3947969aaf6a42e634e47d30a45f0b08316f24a01b597354dfb9db74d6aedeee1e3fe540f587d4b8dbb09053aaa58b3516b954c7f
@@ -41,8 +41,11 @@ module CONTENTdmAPI
41
41
  # @return [Hash] Merged responses from the dmGetItemInfo and
42
42
  # dmGetCompoundObjectInfo functions
43
43
  def metadata
44
- result.merge('id' => "#{collection}/#{id}")
45
- .merge('page' => compounds(page))
44
+ if with_compound
45
+ result_with_id.merge('page' => compounds(page))
46
+ else
47
+ result_with_id.merge('page' => [])
48
+ end
46
49
  end
47
50
 
48
51
  private
@@ -51,18 +54,17 @@ module CONTENTdmAPI
51
54
  result.fetch('page', [])
52
55
  end
53
56
 
57
+ def result_with_id
58
+ @result_with_id ||= result.merge('id' => "#{collection}/#{id}")
59
+ end
60
+
54
61
  def result
55
- return if values.first == {} && values.last == {}
56
- if values.length > 1
57
- values.first.merge('page' => values.last.fetch('page', []))
58
- else
59
- values.first
60
- end
62
+ values.first.merge('page' => values.last.fetch('page', []))
61
63
  end
62
64
 
63
65
  def compounds(page)
64
- return [] unless with_compound
65
66
  page.map do |compound|
67
+ # API gives inconsistent results
66
68
  return {} unless compound.is_a?(Hash)
67
69
  compound.merge(self.class.new(base_url: base_url,
68
70
  collection: collection,
@@ -1,3 +1,3 @@
1
1
  module CONTENTdmAPI
2
- VERSION = '0.3.8'.freeze
2
+ VERSION = '0.3.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentdm_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fennell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2016-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler