contentdm_api 0.1.0 → 0.2.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: bf2ba5a1ff4e7315d73cbb6e99d105181cbcc277
4
- data.tar.gz: 820ed7b399108439c2920caf845ae2a764b221d0
3
+ metadata.gz: 7a6a33fcbb1e545ed9c15fc211ef732c61c3d8b6
4
+ data.tar.gz: 8d7d3675d3703a126b0bae9316d55b0fc21bb383
5
5
  SHA512:
6
- metadata.gz: a8cf5688445b8c8d134f5eda8992c3da0a71f3d5ac4b58fe58412afeb6959bb749a6663f1b07ab1f3d60abe2c6aa0ce8f680aec723533edb22314ffe4779ab01
7
- data.tar.gz: 993bc29b0603d6e031e0259a8ed74c7c4ddfd62ceb08c1bb633929899db41cebd1e740988691990eb3349be33892bf9ed6efb60d45c5bc34036be6507d89e987
6
+ metadata.gz: 6433e76f1b4bdd7694941b52e70528bd0c6dc9ede4ddb17d58489032807398405f0da0dbb84dcd66510cc4d7f49b2b0e23d072dd1b5df6ecaccc92ca7e3c20f1
7
+ data.tar.gz: 69864f2865c29bc0646a070ded4acf1e6995146e141009f51e9d534ed0720cb4ad98e153cb70ade1dcb0125f1d6fa8db2a8f7c8057ddd80bd0ab20fb33cdb399
data/.travis.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
  rvm:
3
4
  - 2.2.3
5
+ - 2.3.1
4
6
  before_install: gem install bundler -v 1.11.2
data/CHANGELOG.txt ADDED
@@ -0,0 +1,2 @@
1
+ version 0.1.0 Initial release
2
+ version 0.2.0 Switch from a CompoundItem to Item with a :with_compound flag convenience method
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # CONTENTdm API for Ruby
2
2
 
3
+ [![Build Status](https://travis-ci.org/UMNLibraries/contentdm_api.svg?branch=master)](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::CompoundItem.new(base_url: 'https://server16022.contentdm.oclc.org/dmwebservices/index.php', collection: 'p16022coll39', id: 446).metadata
34
+ CONTENTdmAPI::Item.new(base_url: 'https://server16022.contentdm.oclc.org/dmwebservices/index.php', collection: 'p16022coll39', id: 446).metadata
33
35
  ```
34
36
 
35
- CompoundItem has been added as a convenience. It is a wrapper around the `CONTENTdmAPI::RequestBatch` feature (see below).
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
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList['test/**/*_test.rb']
8
8
  end
9
9
 
10
- task :default => :spec
10
+ task :default => :test
@@ -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 ContentDM API}
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 CompoundItem
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 = collection
22
- @id = id
23
- @requester = requester
24
- @base_url = base_url
25
- @response = response
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 a given item
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
- { function: 'dmGetItemInfo', params: [collection, id] },
57
- { function: 'dmGetCompoundObjectInfo', params: [collection, id] }
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
@@ -1,3 +1,3 @@
1
1
  module CONTENTdmAPI
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  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/compound_item'
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.0
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-15 00:00:00.000000000 Z
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/compound_item.rb
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 ContentDM API
157
+ summary: Ruby bindings for the CONTENTdm API
157
158
  test_files: []
158
159
  has_rdoc: