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 +4 -4
- data/lib/contentdm_api/item.rb +11 -9
- data/lib/contentdm_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8427c4149b9298b985da7c0866b8a988980cd586
|
4
|
+
data.tar.gz: 05831fb10287a22c7a6a842214c424fd98a86149
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703e28c897cb1495c7659e09a6085ead17901eced6553d1ec79a5efa9749351e21623d6d3bd41600bbc04318facb5d5c066985492bbe079cbffa6f5358d83f97
|
7
|
+
data.tar.gz: 31f037b87f3b73979ea0d7f3947969aaf6a42e634e47d30a45f0b08316f24a01b597354dfb9db74d6aedeee1e3fe540f587d4b8dbb09053aaa58b3516b954c7f
|
data/lib/contentdm_api/item.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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,
|
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.
|
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-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|