voyager_oracle_api 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.3.0
data/lib/collection.rb CHANGED
@@ -20,12 +20,14 @@ module Voyager
20
20
  private
21
21
 
22
22
  def parse_results
23
- results = @connection.results['retrieve_holdings'][@bibid]
23
+ results = @connection.results['retrieve_holdings'][@bibid.to_s]
24
+ @holdings = {}
24
25
 
25
- @holdings = results.reject { |r| r["MFHD_ID"].nil? }
26
- status = Status.new(holdings)
26
+ @holdings = results.reject { |r| r["MFHD_ID"].nil? } if results
27
+
28
+ status = Status.new(@holdings)
27
29
 
28
- @holdings_status = status.statuses
30
+ @holdings_status = status
29
31
 
30
32
  end
31
33
 
@@ -38,9 +38,12 @@ module Voyager
38
38
  order by c.mfhd_id, c.item_id, item_status
39
39
  HERE
40
40
 
41
-
42
- raw_results = execute_select_command(query, bibid: bibids)
43
- parse_results(raw_results, name: 'retrieve_holdings', hash_by: 'BIB_ID')
41
+ unless bibids.empty?
42
+ raw_results = execute_select_command(query, bibid: bibids)
43
+ parse_results(raw_results, name: 'retrieve_holdings', hash_by: 'BIB_ID')
44
+ else
45
+ @results['retrieve_holdings'] ||= {}
46
+ end
44
47
  end
45
48
 
46
49
 
@@ -52,7 +55,8 @@ module Voyager
52
55
  result_hash = @results[options[:name]]
53
56
 
54
57
  results.each do |row|
55
- if (key = row[options[:hash_by]])
58
+ if (key = row[options[:hash_by]].to_s)
59
+
56
60
  result_hash[key] ||= []
57
61
  result_hash[key] << row
58
62
  end
@@ -91,4 +95,4 @@ module Voyager
91
95
 
92
96
 
93
97
  end
94
- end
98
+ end
data/lib/request.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Voyager
2
2
  module Request
3
- def simple_holdings_check(*bibids)
3
+ def self.simple_holdings_check(*bibids)
4
4
 
5
5
  con = OracleConnection.new()
6
6
  con.retrieve_holdings(*bibids)
@@ -8,11 +8,11 @@ module Voyager
8
8
  results = {}
9
9
 
10
10
  bibids.each do |bibid|
11
- results[bibid] = Collection.new(bibid: bibid, connection: con).to_hash(args)
11
+ results[bibid] = Collection.new(bibid: bibid, connection: con).to_hash()
12
12
  end
13
13
 
14
14
  return results
15
15
 
16
16
  end
17
17
  end
18
- end
18
+ end
data/test/test_complex.rb CHANGED
@@ -10,8 +10,8 @@ class TestComplexHoldings < MiniTest::Unit::TestCase
10
10
  collection = Collection.new(bibid: 525807, connection: con)
11
11
  assert !collection.holdings.empty?
12
12
 
13
- assert_kind_of Hash, collection.holdings_status
14
- assert_equal "some_available", collection.holdings_status["690696"]
13
+ assert_kind_of Status, collection.holdings_status
14
+ assert_equal "some_available", collection.holdings_status.to_hash["690696"]
15
15
 
16
16
  end
17
17
 
@@ -22,9 +22,9 @@ class TestComplexHoldings < MiniTest::Unit::TestCase
22
22
  collection = Collection.new(bibid: 9538750, connection: con)
23
23
  assert !collection.holdings.empty?
24
24
 
25
- assert_kind_of Hash, collection.holdings_status
26
- assert_equal "available", collection.holdings_status["12589678"]
27
- assert_equal "unavailable", collection.holdings_status["12703665"]
25
+ assert_kind_of Status, collection.holdings_status
26
+ assert_equal "available", collection.holdings_status.to_hash["12589678"]
27
+ assert_equal "unavailable", collection.holdings_status.to_hash["12703665"]
28
28
 
29
29
  end
30
30
 
data/test/test_simple.rb CHANGED
@@ -10,8 +10,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
10
10
  collection = Collection.new(bibid: 989388, connection: con)
11
11
  assert !collection.holdings.empty?
12
12
 
13
- assert_kind_of Hash, collection.holdings_status
14
- assert_equal "none", collection.holdings_status["1246943"]
13
+ assert_equal "none", collection.holdings_status.to_hash["1246943"]
15
14
 
16
15
  end
17
16
 
@@ -22,8 +21,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
22
21
  collection = Collection.new(bibid: 187780, connection: con)
23
22
  assert !collection.holdings.empty?
24
23
 
25
- assert_kind_of Hash, collection.holdings_status
26
- assert_equal "available", collection.holdings_status["261307"]
24
+ assert_equal "available", collection.holdings_status.to_hash["261307"]
27
25
 
28
26
  end
29
27
 
@@ -34,8 +32,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
34
32
  collection = Collection.new(bibid: 245, connection: con)
35
33
  assert !collection.holdings.empty?
36
34
 
37
- assert_kind_of Hash, collection.holdings_status
38
- assert_equal "unavailable", collection.holdings_status["356"]
35
+ assert_equal "unavailable", collection.holdings_status.to_hash["356"]
39
36
 
40
37
  end
41
38
 
@@ -46,8 +43,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
46
43
  collection = Collection.new(bibid: 9835, connection: con)
47
44
  assert !collection.holdings.empty?
48
45
 
49
- assert_kind_of Hash, collection.holdings_status
50
- assert_equal "available", collection.holdings_status["15217"]
46
+ assert_equal "available", collection.holdings_status.to_hash["15217"]
51
47
 
52
48
  end
53
49
 
@@ -58,8 +54,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
58
54
  collection = Collection.new(bibid: 1812, connection: con)
59
55
  assert !collection.holdings.empty?
60
56
 
61
- assert_kind_of Hash, collection.holdings_status
62
- assert_equal "available", collection.holdings_status["2895"]
57
+ assert_equal "available", collection.holdings_status.to_hash["2895"]
63
58
 
64
59
  end
65
60
 
@@ -70,8 +65,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
70
65
  collection = Collection.new(bibid: 2656, connection: con)
71
66
  assert !collection.holdings.empty?
72
67
 
73
- assert_kind_of Hash, collection.holdings_status
74
- assert_equal "available", collection.holdings_status["4278"]
68
+ assert_equal "available", collection.holdings_status.to_hash["4278"]
75
69
 
76
70
  end
77
71
 
@@ -82,8 +76,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
82
76
  collection = Collection.new(bibid: 24981, connection: con)
83
77
  assert !collection.holdings.empty?
84
78
 
85
- assert_kind_of Hash, collection.holdings_status
86
- assert_equal "unavailable", collection.holdings_status["38212"]
79
+ assert_equal "unavailable", collection.holdings_status.to_hash["38212"]
87
80
 
88
81
  end
89
82
 
@@ -94,8 +87,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
94
87
  collection = Collection.new(bibid: 54865, connection: con)
95
88
  assert !collection.holdings.empty?
96
89
 
97
- assert_kind_of Hash, collection.holdings_status
98
- assert_equal "unavailable", collection.holdings_status["80701"]
90
+ assert_equal "unavailable", collection.holdings_status.to_hash["80701"]
99
91
 
100
92
  end
101
93
 
@@ -107,8 +99,7 @@ class TestSimpleHoldings < MiniTest::Unit::TestCase
107
99
  collection = Collection.new(bibid: 39, connection: con)
108
100
  assert !collection.holdings.empty?
109
101
 
110
- assert_kind_of Hash, collection.holdings_status
111
- assert_equal "some_available", collection.holdings_status["46"]
102
+ assert_equal "some_available", collection.holdings_status.to_hash["46"]
112
103
 
113
104
  end
114
105
 
@@ -0,0 +1,110 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "voyager_oracle_api"
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["James Stuart", "Gary Bertchume"]
12
+ s.date = "2012-10-03"
13
+ s.description = "Middleware gem for Voyager Oracle API calls, specificially holdings information "
14
+ s.email = "github@jamesstuart.org"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "Guardfile",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "config/item_status_codes.yml",
29
+ "config/order_status_codes.yml",
30
+ "lib/collection.rb",
31
+ "lib/oracle_connection.rb",
32
+ "lib/request.rb",
33
+ "lib/status.rb",
34
+ "lib/voyager_oracle_api.rb",
35
+ "tasks/build_tests.rake",
36
+ "test/fixtures/complex_2c_1in_1out.json",
37
+ "test/fixtures/complex_some_available_2_3_4_14_17.json",
38
+ "test/fixtures/fixture_test.json",
39
+ "test/fixtures/simple_1_available_item.json",
40
+ "test/fixtures/simple_1_available_item_returned.json",
41
+ "test/fixtures/simple_1_available_item_review.json",
42
+ "test/fixtures/simple_1_available_item_withdrawal.json",
43
+ "test/fixtures/simple_1_unavailable_item_2.json",
44
+ "test/fixtures/simple_1_unavailable_lost.json",
45
+ "test/fixtures/simple_1_unavailable_missing.json",
46
+ "test/fixtures/simple_no_items.json",
47
+ "test/fixtures/simple_some_available_1_2.json",
48
+ "test/helper.rb",
49
+ "test/test_complex.rb",
50
+ "test/test_fixtures.rb",
51
+ "test/test_simple.rb",
52
+ "test/test_voyager_connection.rb",
53
+ "voyager_api.gemspec",
54
+ "voyager_oracle_api.gemspec"
55
+ ]
56
+ s.homepage = "http://github.com/cul/voyager_oracle_api"
57
+ s.licenses = ["MIT"]
58
+ s.require_paths = ["lib"]
59
+ s.rubygems_version = "1.8.24"
60
+ s.summary = "Columbia University Voyager Oracle API wrapper"
61
+
62
+ if s.respond_to? :specification_version then
63
+ s.specification_version = 3
64
+
65
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
66
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
67
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
68
+ s.add_runtime_dependency(%q<ruby-oci8>, [">= 0"])
69
+ s.add_runtime_dependency(%q<json>, [">= 0"])
70
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
71
+ s.add_development_dependency(%q<minitest>, [">= 0"])
72
+ s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
73
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
74
+ s.add_development_dependency(%q<rcov>, [">= 0"])
75
+ s.add_development_dependency(%q<guard-minitest>, [">= 0"])
76
+ s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
77
+ s.add_development_dependency(%q<mocha>, [">= 0"])
78
+ s.add_development_dependency(%q<growl>, [">= 0"])
79
+ else
80
+ s.add_dependency(%q<activesupport>, [">= 0"])
81
+ s.add_dependency(%q<i18n>, [">= 0"])
82
+ s.add_dependency(%q<ruby-oci8>, [">= 0"])
83
+ s.add_dependency(%q<json>, [">= 0"])
84
+ s.add_dependency(%q<activesupport>, [">= 0"])
85
+ s.add_dependency(%q<minitest>, [">= 0"])
86
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
87
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
88
+ s.add_dependency(%q<rcov>, [">= 0"])
89
+ s.add_dependency(%q<guard-minitest>, [">= 0"])
90
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
91
+ s.add_dependency(%q<mocha>, [">= 0"])
92
+ s.add_dependency(%q<growl>, [">= 0"])
93
+ end
94
+ else
95
+ s.add_dependency(%q<activesupport>, [">= 0"])
96
+ s.add_dependency(%q<i18n>, [">= 0"])
97
+ s.add_dependency(%q<ruby-oci8>, [">= 0"])
98
+ s.add_dependency(%q<json>, [">= 0"])
99
+ s.add_dependency(%q<activesupport>, [">= 0"])
100
+ s.add_dependency(%q<minitest>, [">= 0"])
101
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
102
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
103
+ s.add_dependency(%q<rcov>, [">= 0"])
104
+ s.add_dependency(%q<guard-minitest>, [">= 0"])
105
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
106
+ s.add_dependency(%q<mocha>, [">= 0"])
107
+ s.add_dependency(%q<growl>, [">= 0"])
108
+ end
109
+ end
110
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: voyager_oracle_api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stuart
@@ -200,6 +200,7 @@ files:
200
200
  - test/test_simple.rb
201
201
  - test/test_voyager_connection.rb
202
202
  - voyager_api.gemspec
203
+ - voyager_oracle_api.gemspec
203
204
  homepage: http://github.com/cul/voyager_oracle_api
204
205
  licenses:
205
206
  - MIT
@@ -213,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
214
  requirements:
214
215
  - - ">="
215
216
  - !ruby/object:Gem::Version
216
- hash: -1056935341
217
+ hash: -614486029
217
218
  segments:
218
219
  - 0
219
220
  version: "0"