rbook 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+
3
+ require 'test/unit'
4
+ require 'rexml/document'
5
+ require 'rbook/onix'
6
+
7
+ class TestStreamReader < Test::Unit::TestCase
8
+
9
+ # test the stream reader works without throwing an exception
10
+ def test_stream_reader
11
+ counter = 0
12
+
13
+ assert_nothing_raised() {
14
+ reader = RBook::Onix::StreamReader.new(File.dirname(__FILE__)+"/../../data/single_product.xml")
15
+ reader.each do |product|
16
+ counter += 1
17
+ end
18
+ }
19
+
20
+ assert_equal 1, counter
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+
3
+ require 'test/unit'
4
+ require 'rexml/document'
5
+ require 'rbook/onix'
6
+ require 'stringio'
7
+
8
+ class TestStreamWriter < Test::Unit::TestCase
9
+
10
+ # test the stream writer works without throwing an exception
11
+ def test_stream_writer
12
+
13
+ assert_nothing_raised() {
14
+ reader = RBook::Onix::StreamReader.new(File.dirname(__FILE__)+"/../../data/single_product.xml")
15
+
16
+ output = StringIO.new
17
+ msg = RBook::Onix::Message.new
18
+ msg.from_company = "Test Company"
19
+ msg.from_person = "James Healy"
20
+
21
+ writer = RBook::Onix::StreamWriter.new(output, msg)
22
+ writer.start_document
23
+
24
+ reader.each do |product|
25
+ writer << product
26
+ end
27
+
28
+ writer.end_document
29
+ }
30
+
31
+ end
32
+ end
@@ -7,7 +7,7 @@ require File.dirname(__FILE__) + '/../mocks/titlepage_driver'
7
7
  class TitlePageTest < Test::Unit::TestCase
8
8
 
9
9
  def setup
10
- @tp = RBook::TitlePage.new(MockTitlePageDriver.new)
10
+ @tp = RBook::TitlePage::Client.new(RBook::TitlePage::MockTitlePageDriver.new)
11
11
  end
12
12
 
13
13
  # ensure a SOAP exception is raised if incorrect login details are provided
@@ -29,11 +29,11 @@ class TitlePageTest < Test::Unit::TestCase
29
29
  return
30
30
  end
31
31
 
32
- RBook::TitlePage.open("test","apa", MockTitlePageDriver.new) do |tp|
32
+ RBook::TitlePage::Client.open("test","apa", RBook::TitlePage::MockTitlePageDriver.new) do |tp|
33
33
 
34
34
  result = tp.find("9780091835132")
35
35
 
36
- assert_kind_of SearchResults, result
36
+ assert_kind_of RBook::TitlePage::SearchResults, result
37
37
  assert_not_equal nil, result.Product
38
38
 
39
39
  end
@@ -50,7 +50,7 @@ class TitlePageTest < Test::Unit::TestCase
50
50
  @tp.login("test","apa")
51
51
  result = @tp.find("9780091835132")
52
52
 
53
- assert_kind_of SearchResults, result
53
+ assert_kind_of RBook::TitlePage::SearchResults, result
54
54
  assert_not_equal nil, result.Product
55
55
 
56
56
  @tp.logout
@@ -67,7 +67,7 @@ class TitlePageTest < Test::Unit::TestCase
67
67
  @tp.login("test","apa")
68
68
  result = @tp.find("9780672327568")
69
69
 
70
- assert_kind_of SearchResults, result
70
+ assert_kind_of RBook::TitlePage::SearchResults, result
71
71
  assert_not_equal nil, result.Product
72
72
 
73
73
  @tp.logout
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rbook
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.1"
7
- date: 2006-09-26 00:00:00 +10:00
6
+ version: "0.2"
7
+ date: 2006-10-04 00:00:00 +10:00
8
8
  summary: A collection of classes and modules for working with bibliographic data
9
9
  require_paths:
10
10
  - lib
@@ -25,44 +25,37 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - James Healy
30
31
  files:
31
32
  - examples/www
33
+ - examples/onix
32
34
  - examples/titlepage.rb
33
- - examples/www/find_all.rb
35
+ - examples/gbip.rb
34
36
  - examples/www/list.rb
35
37
  - examples/www/find_cover_from_amazon.rb
36
38
  - examples/www/find_url_from_rainbow.rb
39
+ - examples/www/find_all.rb
40
+ - examples/onix/stream_reader.rb
37
41
  - lib/rbook
38
- - lib/rbook/errors.rb
39
- - lib/rbook/bisac.rb
42
+ - lib/rbook/www
43
+ - lib/rbook/onix
44
+ - lib/rbook/titlepage
40
45
  - lib/rbook/titlepage.rb
41
- - lib/rbook/isbn.rb
42
46
  - lib/rbook/onix.rb
43
- - lib/rbook/onix
47
+ - lib/rbook/errors.rb
48
+ - lib/rbook/bisac.rb
44
49
  - lib/rbook/www.rb
45
- - lib/rbook/titlepage
46
- - lib/rbook/www
47
- - lib/rbook/onix/lists
48
- - lib/rbook/onix/sales_restriction.rb
49
- - lib/rbook/onix/supply_detail.rb
50
- - lib/rbook/onix/product.rb
51
- - lib/rbook/onix/lists.rb
52
- - lib/rbook/onix/contributor.rb
53
- - lib/rbook/onix/message.rb
54
- - lib/rbook/onix/xchar.rb
55
- - lib/rbook/onix/lists/contributor_role.rb
56
- - lib/rbook/onix/lists/product_form.rb
57
- - lib/rbook/titlepage/titlepage_driver.rb
58
- - lib/rbook/titlepage/titlepage_utils.rb
59
- - lib/rbook/titlepage/TitleQueryClient.rb
60
- - lib/rbook/www/base.rb
61
- - lib/rbook/www/pearson_au_scraper.rb
50
+ - lib/rbook/isbn.rb
51
+ - lib/rbook/bisac
52
+ - lib/rbook/gbip
53
+ - lib/rbook/gbip.rb
62
54
  - lib/rbook/www/wiley_us_scraper.rb
63
55
  - lib/rbook/www/hha_scraper.rb
64
56
  - lib/rbook/www/random_au_scraper.rb
65
57
  - lib/rbook/www/oup_scraper.rb
58
+ - lib/rbook/www/pearson_au_scraper.rb
66
59
  - lib/rbook/www/penguin_scraper.rb
67
60
  - lib/rbook/www/harper_au_scraper.rb
68
61
  - lib/rbook/www/aau_scraper.rb
@@ -73,7 +66,26 @@ files:
73
66
  - lib/rbook/www/sas_scraper.rb
74
67
  - lib/rbook/www/random_us_scraper.rb
75
68
  - lib/rbook/www/harper_us_scraper.rb
69
+ - lib/rbook/www/base.rb
76
70
  - lib/rbook/www/macmillan_scraper.rb
71
+ - lib/rbook/onix/lists
72
+ - lib/rbook/onix/product.rb
73
+ - lib/rbook/onix/lists.rb
74
+ - lib/rbook/onix/sales_restriction.rb
75
+ - lib/rbook/onix/supply_detail.rb
76
+ - lib/rbook/onix/message.rb
77
+ - lib/rbook/onix/xchar.rb
78
+ - lib/rbook/onix/contributor.rb
79
+ - lib/rbook/onix/stream_reader.rb
80
+ - lib/rbook/onix/stream_writer.rb
81
+ - lib/rbook/onix/lists/contributor_role.rb
82
+ - lib/rbook/onix/lists/product_form.rb
83
+ - lib/rbook/titlepage/client.rb
84
+ - lib/rbook/titlepage/titlepage_utils.rb
85
+ - lib/rbook/titlepage/titlepage_driver.rb
86
+ - lib/rbook/bisac/product.rb
87
+ - lib/rbook/bisac/message.rb
88
+ - lib/rbook/gbip/pos.rb
77
89
  - test/unit
78
90
  - test/data
79
91
  - test/mocks
@@ -87,12 +99,15 @@ files:
87
99
  - test/unit/onix/message_test.rb
88
100
  - test/unit/onix/xchar_test.rb
89
101
  - test/unit/onix/contributor_test.rb
90
- - test/data/single_product.xml
102
+ - test/unit/onix/stream_writer_test.rb
103
+ - test/unit/onix/stream_reader_test.rb
91
104
  - test/data/xml_not_onix.xml
92
105
  - test/data/abingdon.xml
93
106
  - test/data/invalid_no_product.xml
107
+ - test/data/single_product.xml
94
108
  - test/data/chalice.xml
95
109
  - test/data/not_xml.csv
110
+ - test/data/valid_bisac.txt
96
111
  - test/data/eerdsman.xml
97
112
  - test/data/augsburg.xml
98
113
  - test/mocks/titlepage_driver.rb
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'defaultDriver.rb'
3
-
4
- endpoint_url = ARGV.shift
5
- obj = TitleQueryPortType.new(endpoint_url)
6
-
7
- # run ruby with -d to see SOAP wiredumps.
8
- obj.wiredump_dev = STDERR if $DEBUG
9
-
10
- # SYNOPSIS
11
- # Login(userName, password)
12
- #
13
- # ARGS
14
- # userName String - {http://www.w3.org/2001/XMLSchema}string
15
- # password String - {http://www.w3.org/2001/XMLSchema}string
16
- #
17
- # RETURNS
18
- # token String - {http://www.w3.org/2001/XMLSchema}string
19
- #
20
- userName = "rba303"
21
- password = "ra1nb0Wb"
22
- puts obj.login(userName, password)
23
-
24
- # SYNOPSIS
25
- # SearchByISBN(token, iSBN)
26
- #
27
- # ARGS
28
- # token String - {http://www.w3.org/2001/XMLSchema}string
29
- # iSBN String - {http://www.w3.org/2001/XMLSchema}string
30
- #
31
- # RETURNS
32
- # searchResults SearchResults - {urn:TitleQuery}SearchResults
33
- #
34
- token = iSBN = nil
35
- puts obj.searchByISBN(token, iSBN)
36
-
37
- # SYNOPSIS
38
- # SearchByEAN(token, eAN)
39
- #
40
- # ARGS
41
- # token String - {http://www.w3.org/2001/XMLSchema}string
42
- # eAN String - {http://www.w3.org/2001/XMLSchema}string
43
- #
44
- # RETURNS
45
- # searchResults SearchResults - {urn:TitleQuery}SearchResults
46
- #
47
- token = eAN = nil
48
- puts obj.searchByEAN(token, eAN)
49
-
50
- # SYNOPSIS
51
- # Logout(token)
52
- #
53
- # ARGS
54
- # token String - {http://www.w3.org/2001/XMLSchema}string
55
- #
56
- # RETURNS
57
- # N/A
58
- #
59
- token = nil
60
- puts obj.logout(token)
61
-
62
-