contentdm_api 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.txt +2 -0
- data/README.md +6 -2
- data/Rakefile +1 -1
- data/contentdm_api.gemspec +1 -1
- data/lib/contentdm_api/{compound_item.rb → item.rb} +19 -12
- data/lib/contentdm_api/version.rb +1 -1
- data/lib/contentdm_api.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a6a33fcbb1e545ed9c15fc211ef732c61c3d8b6
|
4
|
+
data.tar.gz: 8d7d3675d3703a126b0bae9316d55b0fc21bb383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6433e76f1b4bdd7694941b52e70528bd0c6dc9ede4ddb17d58489032807398405f0da0dbb84dcd66510cc4d7f49b2b0e23d072dd1b5df6ecaccc92ca7e3c20f1
|
7
|
+
data.tar.gz: 69864f2865c29bc0646a070ded4acf1e6995146e141009f51e9d534ed0720cb4ad98e153cb70ade1dcb0125f1d6fa8db2a8f7c8057ddd80bd0ab20fb33cdb399
|
data/.travis.yml
CHANGED
data/CHANGELOG.txt
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CONTENTdm API for Ruby
|
2
2
|
|
3
|
+
[](https://travis-ci.org/UMNLibraries/contentdm_api)
|
4
|
+
|
3
5
|
Ruby bindings for the [CONTENTdm API](https://www.oclc.org/support/services/contentdm_api/help/customizing-website-help/other-customizations/contentdm_api-api-reference.en.html).
|
4
6
|
|
5
7
|
## Installation
|
@@ -29,10 +31,10 @@ Include the library in your code:
|
|
29
31
|
**Retrieve Item Metadata Along With Its Compound Object Info (If it Exists)**
|
30
32
|
|
31
33
|
```
|
32
|
-
CONTENTdmAPI::
|
34
|
+
CONTENTdmAPI::Item.new(base_url: 'https://server16022.contentdm.oclc.org/dmwebservices/index.php', collection: 'p16022coll39', id: 446).metadata
|
33
35
|
```
|
34
36
|
|
35
|
-
|
37
|
+
Item has been added as a convenience. It is a wrapper around the `CONTENTdmAPI::RequestBatch` feature (see below). Set `with_compound: false` to avoid attempting the dmGetCompoundObjectInfo lookup call.
|
36
38
|
|
37
39
|
**Call a CONTENTdm API function directoy**
|
38
40
|
|
@@ -59,6 +61,8 @@ You may also use the Response class to parse and handle API inconsistencies (e.g
|
|
59
61
|
responses.map { |resp| CONTENTdmAPI::Response.new(raw_data: resp[:value]).parsed }
|
60
62
|
```
|
61
63
|
|
64
|
+
## [API Documentation](http://www.rubydoc.info/gems/contentdm_api)
|
65
|
+
|
62
66
|
## Development
|
63
67
|
|
64
68
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/contentdm_api.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Chad Fennell"]
|
10
10
|
spec.email = ["fenne035@umn.edu"]
|
11
11
|
|
12
|
-
spec.summary = %q{Ruby bindings for the
|
12
|
+
spec.summary = %q{Ruby bindings for the CONTENTdm API}
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module CONTENTdmAPI
|
2
2
|
# A convenience method to retrive a Ruby hash of Item data from the CONTENTdm
|
3
3
|
# API
|
4
|
-
class
|
5
|
-
attr_reader :collection, :id, :requester, :base_url, :response
|
4
|
+
class Item
|
5
|
+
attr_reader :collection, :id, :requester, :base_url, :response, :with_compound
|
6
6
|
|
7
7
|
# @param [String] base_url URL to the CONTENTdm API
|
8
8
|
# "http://CdmServer.com:port/dmwebservices/index.php"
|
@@ -16,16 +16,18 @@ module CONTENTdmAPI
|
|
16
16
|
def initialize(base_url: '',
|
17
17
|
collection: '',
|
18
18
|
id: 0,
|
19
|
+
with_compound: true,
|
19
20
|
requester: RequestBatch,
|
20
21
|
response: Response)
|
21
|
-
@collection
|
22
|
-
@id
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
22
|
+
@collection = collection
|
23
|
+
@id = id
|
24
|
+
@with_compound = with_compound
|
25
|
+
@requester = requester
|
26
|
+
@base_url = base_url
|
27
|
+
@response = response
|
26
28
|
end
|
27
29
|
|
28
|
-
# A hash of metadata with compound data for
|
30
|
+
# A hash of item metadata with optional compound data for the given item
|
29
31
|
#
|
30
32
|
# @return [Hash] Merged responses from the dmGetItemInfo and
|
31
33
|
# dmGetCompoundObjectInfo functions
|
@@ -52,10 +54,15 @@ module CONTENTdmAPI
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def service_configs
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
(with_compound) ? item_config.concat(compound_config) : item_config
|
58
|
+
end
|
59
|
+
|
60
|
+
def item_config
|
61
|
+
[{ function: 'dmGetItemInfo', params: [collection, id] }]
|
62
|
+
end
|
63
|
+
|
64
|
+
def compound_config
|
65
|
+
[{ function: 'dmGetCompoundObjectInfo', params: [collection, id] }]
|
59
66
|
end
|
60
67
|
end
|
61
68
|
end
|
data/lib/contentdm_api.rb
CHANGED
@@ -6,5 +6,5 @@ require_relative './contentdm_api/request'
|
|
6
6
|
require_relative './contentdm_api/request_batch'
|
7
7
|
require_relative './contentdm_api/service'
|
8
8
|
require_relative './contentdm_api/response'
|
9
|
-
require_relative './contentdm_api/
|
9
|
+
require_relative './contentdm_api/item'
|
10
10
|
|
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.1
|
4
|
+
version: 0.2.1
|
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-07-
|
11
|
+
date: 2016-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,6 +115,7 @@ extra_rdoc_files: []
|
|
115
115
|
files:
|
116
116
|
- ".gitignore"
|
117
117
|
- ".travis.yml"
|
118
|
+
- CHANGELOG.txt
|
118
119
|
- CODE_OF_CONDUCT.md
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE.txt
|
@@ -124,7 +125,7 @@ files:
|
|
124
125
|
- bin/setup
|
125
126
|
- contentdm_api.gemspec
|
126
127
|
- lib/contentdm_api.rb
|
127
|
-
- lib/contentdm_api/
|
128
|
+
- lib/contentdm_api/item.rb
|
128
129
|
- lib/contentdm_api/request.rb
|
129
130
|
- lib/contentdm_api/request_batch.rb
|
130
131
|
- lib/contentdm_api/response.rb
|
@@ -153,6 +154,6 @@ rubyforge_project:
|
|
153
154
|
rubygems_version: 2.4.8
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
|
-
summary: Ruby bindings for the
|
157
|
+
summary: Ruby bindings for the CONTENTdm API
|
157
158
|
test_files: []
|
158
159
|
has_rdoc:
|