onix 0.8.4 → 0.8.5
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.
- data/CHANGELOG +6 -0
- data/lib/onix.rb +1 -1
- data/spec/apa_product_spec.rb +9 -9
- data/spec/audience_range_spec.rb +4 -4
- data/spec/contributor_spec.rb +4 -4
- data/spec/header_spec.rb +7 -7
- data/spec/imprint_spec.rb +4 -4
- data/spec/language_spec.rb +4 -4
- data/spec/lists_spec.rb +3 -3
- data/spec/market_representation_spec.rb +4 -6
- data/spec/measure_spec.rb +4 -4
- data/spec/media_file_spec.rb +4 -4
- data/spec/normaliser_spec.rb +27 -4
- data/spec/other_text_spec.rb +4 -4
- data/spec/price_spec.rb +4 -4
- data/spec/product_identifier_spec.rb +4 -4
- data/spec/product_spec.rb +8 -8
- data/spec/publisher_spec.rb +4 -4
- data/spec/reader_spec.rb +11 -11
- data/spec/sales_restriction_spec.rb +4 -5
- data/spec/sender_identifier.rb +4 -4
- data/spec/series_identifier_spec.rb +4 -4
- data/spec/series_spec.rb +4 -4
- data/spec/spec_helper.rb +4 -1
- data/spec/stock_spec.rb +4 -4
- data/spec/subject_spec.rb +4 -5
- data/spec/supply_detail_spec.rb +4 -4
- data/spec/title_spec.rb +4 -4
- data/spec/website_spec.rb +4 -4
- data/spec/writer_spec.rb +7 -7
- data/support/switch-onix-2.1-short-to-reference.xsl +3 -2
- metadata +82 -38
data/spec/subject_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe ONIX::Subject do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
|
@@ -11,19 +11,19 @@ context "ONIX::Subject" do
|
|
|
11
11
|
@root = @doc.root
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it "should correctly convert to a string" do
|
|
15
15
|
sub = ONIX::Subject.from_xml(@root.to_s)
|
|
16
16
|
sub.to_xml.to_s[0,9].should eql("<Subject>")
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
it "should provide read access to first level attributes" do
|
|
20
20
|
sub = ONIX::Subject.from_xml(@root.to_s)
|
|
21
21
|
sub.subject_scheme_id.should eql(3)
|
|
22
22
|
sub.subject_scheme_name.should eql("RBA Subjects")
|
|
23
23
|
sub.subject_code.should eql("AABB")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
it "should provide write access to first level attributes" do
|
|
27
27
|
sub = ONIX::Subject.new
|
|
28
28
|
|
|
29
29
|
sub.subject_scheme_id = 2
|
|
@@ -35,4 +35,3 @@ context "ONIX::Subject" do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
end
|
|
38
|
-
|
data/spec/supply_detail_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe ONIX::SupplyDetail do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
|
@@ -11,12 +11,12 @@ context "ONIX::SupplyDetail" do
|
|
|
11
11
|
@root = @doc.root
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it "should correctly convert to a string" do
|
|
15
15
|
sd = ONIX::SupplyDetail.from_xml(@root.to_s)
|
|
16
16
|
sd.to_xml.to_s[0,14].should eql("<SupplyDetail>")
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
it "should provide read access to first level attributes" do
|
|
20
20
|
sd = ONIX::SupplyDetail.from_xml(@root.to_s)
|
|
21
21
|
|
|
22
22
|
sd.supplier_name.should eql("Rainbow Book Agencies")
|
|
@@ -28,7 +28,7 @@ context "ONIX::SupplyDetail" do
|
|
|
28
28
|
sd.prices.size.should eql(1)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
it "should provide write access to first level attributes" do
|
|
32
32
|
sd = ONIX::SupplyDetail.new
|
|
33
33
|
|
|
34
34
|
sd.supplier_name = "RBA"
|
data/spec/title_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe ONIX::Title do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
|
@@ -11,19 +11,19 @@ context "ONIX::Title" do
|
|
|
11
11
|
@root = @doc.root
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it "should correctly convert to a string" do
|
|
15
15
|
t = ONIX::Title.from_xml(@root.to_s)
|
|
16
16
|
t.to_xml.to_s[0,7].should eql("<Title>")
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
it "should provide read access to first level attributes" do
|
|
20
20
|
t = ONIX::Title.from_xml(@root.to_s)
|
|
21
21
|
t.title_type.should eql(1)
|
|
22
22
|
t.title_text.should eql("Good Grief")
|
|
23
23
|
t.subtitle.should eql("A Constructive Approach to the Problem of Loss")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
it "should provide write access to first level attributes" do
|
|
27
27
|
t = ONIX::Title.new
|
|
28
28
|
|
|
29
29
|
t.title_type = 1
|
data/spec/website_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe ONIX::Website do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
|
@@ -11,19 +11,19 @@ context "ONIX::Website" do
|
|
|
11
11
|
@root = @doc.root
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it "should correctly convert to a string" do
|
|
15
15
|
web = ONIX::Website.from_xml(@root.to_s)
|
|
16
16
|
web.to_xml.to_s[0,9].should eql("<Website>")
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
it "should provide read access to first level attributes" do
|
|
20
20
|
web = ONIX::Website.from_xml(@root.to_s)
|
|
21
21
|
|
|
22
22
|
web.website_role.should eql(1)
|
|
23
23
|
web.website_link.should eql("http://www.rainbowbooks.com.au")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
it "should provide write access to first level attributes" do
|
|
27
27
|
web = ONIX::Website.new
|
|
28
28
|
|
|
29
29
|
web.website_role = 2
|
data/spec/writer_spec.rb
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe ONIX::Writer do
|
|
6
6
|
|
|
7
7
|
before(:each) do
|
|
8
8
|
@output = StringIO.new
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
it "should output the correct xml metadata" do
|
|
12
12
|
header = ONIX::Header.new
|
|
13
13
|
writer = ONIX::Writer.new(@output, header)
|
|
14
14
|
writer.end_document
|
|
@@ -22,7 +22,7 @@ context "ONIX::Writer" do
|
|
|
22
22
|
lines[1][0,9].should eql("<!DOCTYPE")
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
it "should output the correct xml metadata when used in block form" do
|
|
26
26
|
header = ONIX::Header.new
|
|
27
27
|
ONIX::Writer.open(@output, header) { |writer| }
|
|
28
28
|
|
|
@@ -35,7 +35,7 @@ context "ONIX::Writer" do
|
|
|
35
35
|
lines[1][0,9].should eql("<!DOCTYPE")
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
it "should output the header node" do
|
|
39
39
|
header = ONIX::Header.new
|
|
40
40
|
|
|
41
41
|
ONIX::Writer.open(@output, header) { |writer| }
|
|
@@ -45,7 +45,7 @@ context "ONIX::Writer" do
|
|
|
45
45
|
lines[3][0,7].should eql("<Header")
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it "should output the product node" do
|
|
49
49
|
header = ONIX::Header.new
|
|
50
50
|
product = ONIX::Product.new
|
|
51
51
|
|
|
@@ -58,7 +58,7 @@ context "ONIX::Writer" do
|
|
|
58
58
|
lines[4][0,8].should eql("<Product")
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
it "should correctly store finished state" do
|
|
62
62
|
header = ONIX::Header.new
|
|
63
63
|
writer = ONIX::Writer.new(@output, header)
|
|
64
64
|
writer.finished?.should be_false
|
|
@@ -67,7 +67,7 @@ context "ONIX::Writer" do
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
=begin
|
|
70
|
-
|
|
70
|
+
it "should convert non-ASCII chars to references when outputting as a string" do
|
|
71
71
|
header = ONIX::Header.new
|
|
72
72
|
header.from_person = "Hans Küng"
|
|
73
73
|
ONIX::Writer.open(@output, header) { |writer| }
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<xsl:template match="*">
|
|
9
9
|
<xsl:variable name="target-name">
|
|
10
10
|
<xsl:choose>
|
|
11
|
-
<xsl:when test="$target='short'"><xsl:value-of select="@shortname"/></xsl:when>
|
|
12
|
-
<xsl:
|
|
11
|
+
<xsl:when test="$target='short' and @shortname"><xsl:value-of select="@shortname"/></xsl:when>
|
|
12
|
+
<xsl:when test="$target='reference' and @refname"><xsl:value-of select="@refname"/></xsl:when>
|
|
13
|
+
<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
|
|
13
14
|
</xsl:choose>
|
|
14
15
|
</xsl:variable>
|
|
15
16
|
<xsl:element name="{$target-name}">
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 53
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 8
|
|
9
|
-
-
|
|
10
|
-
version: 0.8.
|
|
9
|
+
- 5
|
|
10
|
+
version: 0.8.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- James Healy
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-
|
|
18
|
+
date: 2010-12-21 00:00:00 +11:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -35,7 +35,7 @@ dependencies:
|
|
|
35
35
|
type: :runtime
|
|
36
36
|
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
|
-
name:
|
|
38
|
+
name: i18n
|
|
39
39
|
prerelease: false
|
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
41
|
none: false
|
|
@@ -49,9 +49,23 @@ dependencies:
|
|
|
49
49
|
type: :runtime
|
|
50
50
|
version_requirements: *id002
|
|
51
51
|
- !ruby/object:Gem::Dependency
|
|
52
|
-
name:
|
|
52
|
+
name: andand
|
|
53
53
|
prerelease: false
|
|
54
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
55
|
+
none: false
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
hash: 3
|
|
60
|
+
segments:
|
|
61
|
+
- 0
|
|
62
|
+
version: "0"
|
|
63
|
+
type: :runtime
|
|
64
|
+
version_requirements: *id003
|
|
65
|
+
- !ruby/object:Gem::Dependency
|
|
66
|
+
name: nokogiri
|
|
67
|
+
prerelease: false
|
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
55
69
|
none: false
|
|
56
70
|
requirements:
|
|
57
71
|
- - ">="
|
|
@@ -62,9 +76,39 @@ dependencies:
|
|
|
62
76
|
- 4
|
|
63
77
|
version: "1.4"
|
|
64
78
|
type: :runtime
|
|
65
|
-
version_requirements: *
|
|
79
|
+
version_requirements: *id004
|
|
80
|
+
- !ruby/object:Gem::Dependency
|
|
81
|
+
name: rake
|
|
82
|
+
prerelease: false
|
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
84
|
+
none: false
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
hash: 3
|
|
89
|
+
segments:
|
|
90
|
+
- 0
|
|
91
|
+
version: "0"
|
|
92
|
+
type: :development
|
|
93
|
+
version_requirements: *id005
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: rspec
|
|
96
|
+
prerelease: false
|
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ~>
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
hash: 1
|
|
103
|
+
segments:
|
|
104
|
+
- 2
|
|
105
|
+
- 1
|
|
106
|
+
version: "2.1"
|
|
107
|
+
type: :development
|
|
108
|
+
version_requirements: *id006
|
|
66
109
|
description: A convient mapping between ruby objects and the ONIX XML specification
|
|
67
|
-
email:
|
|
110
|
+
email:
|
|
111
|
+
- jimmy@deefa.com
|
|
68
112
|
executables: []
|
|
69
113
|
|
|
70
114
|
extensions: []
|
|
@@ -103,34 +147,6 @@ files:
|
|
|
103
147
|
- lib/onix/product.rb
|
|
104
148
|
- lib/onix/media_file.rb
|
|
105
149
|
- lib/onix.rb
|
|
106
|
-
- README.markdown
|
|
107
|
-
- TODO
|
|
108
|
-
- CHANGELOG
|
|
109
|
-
- dtd/2.1r3/iso-mopf.ent
|
|
110
|
-
- dtd/2.1r3/onix-international.dtd
|
|
111
|
-
- dtd/2.1r3/iso-mfrk.ent
|
|
112
|
-
- dtd/2.1r3/iso-amsa.ent
|
|
113
|
-
- dtd/2.1r3/iso-amsc.ent
|
|
114
|
-
- dtd/2.1r3/iso-tech.ent
|
|
115
|
-
- dtd/2.1r3/iso-num.ent
|
|
116
|
-
- dtd/2.1r3/iso-dia.ent
|
|
117
|
-
- dtd/2.1r3/iso-num.old.ent
|
|
118
|
-
- dtd/2.1r3/xhtml-symbol.ent
|
|
119
|
-
- dtd/2.1r3/iso-pub.ent
|
|
120
|
-
- dtd/2.1r3/reference.elt
|
|
121
|
-
- dtd/2.1r3/iso-amsr.ent
|
|
122
|
-
- dtd/2.1r3/iso-cyr1.ent
|
|
123
|
-
- dtd/2.1r3/iso-amsn.ent
|
|
124
|
-
- dtd/2.1r3/iso-lat1.ent
|
|
125
|
-
- dtd/2.1r3/iso-box.ent
|
|
126
|
-
- dtd/2.1r3/iso-mscr.ent
|
|
127
|
-
- dtd/2.1r3/xhtml-special.ent
|
|
128
|
-
- dtd/2.1r3/iso-lat2.ent
|
|
129
|
-
- dtd/2.1r3/iso-cyr2.ent
|
|
130
|
-
- dtd/2.1r3/iso-amsb.ent
|
|
131
|
-
- dtd/2.1r3/iso-amso.ent
|
|
132
|
-
- dtd/2.1r3/iso-grk3.ent
|
|
133
|
-
- dtd/2.1r3/onix-xhtml.elt
|
|
134
150
|
- support/codes/009.tsv
|
|
135
151
|
- support/codes/102.tsv
|
|
136
152
|
- support/codes/157.tsv
|
|
@@ -279,6 +295,34 @@ files:
|
|
|
279
295
|
- support/switch-onix-tagnames-2.0.xsl
|
|
280
296
|
- support/extract.rb
|
|
281
297
|
- support/switch-onix-tagnames-1.1.xsl
|
|
298
|
+
- dtd/2.1r3/iso-mopf.ent
|
|
299
|
+
- dtd/2.1r3/onix-international.dtd
|
|
300
|
+
- dtd/2.1r3/iso-mfrk.ent
|
|
301
|
+
- dtd/2.1r3/iso-amsa.ent
|
|
302
|
+
- dtd/2.1r3/iso-amsc.ent
|
|
303
|
+
- dtd/2.1r3/iso-tech.ent
|
|
304
|
+
- dtd/2.1r3/iso-num.ent
|
|
305
|
+
- dtd/2.1r3/iso-dia.ent
|
|
306
|
+
- dtd/2.1r3/iso-num.old.ent
|
|
307
|
+
- dtd/2.1r3/xhtml-symbol.ent
|
|
308
|
+
- dtd/2.1r3/iso-pub.ent
|
|
309
|
+
- dtd/2.1r3/reference.elt
|
|
310
|
+
- dtd/2.1r3/iso-amsr.ent
|
|
311
|
+
- dtd/2.1r3/iso-cyr1.ent
|
|
312
|
+
- dtd/2.1r3/iso-amsn.ent
|
|
313
|
+
- dtd/2.1r3/iso-lat1.ent
|
|
314
|
+
- dtd/2.1r3/iso-box.ent
|
|
315
|
+
- dtd/2.1r3/iso-mscr.ent
|
|
316
|
+
- dtd/2.1r3/xhtml-special.ent
|
|
317
|
+
- dtd/2.1r3/iso-lat2.ent
|
|
318
|
+
- dtd/2.1r3/iso-cyr2.ent
|
|
319
|
+
- dtd/2.1r3/iso-amsb.ent
|
|
320
|
+
- dtd/2.1r3/iso-amso.ent
|
|
321
|
+
- dtd/2.1r3/iso-grk3.ent
|
|
322
|
+
- dtd/2.1r3/onix-xhtml.elt
|
|
323
|
+
- README.markdown
|
|
324
|
+
- TODO
|
|
325
|
+
- CHANGELOG
|
|
282
326
|
- spec/lists_spec.rb
|
|
283
327
|
- spec/series_spec.rb
|
|
284
328
|
- spec/media_file_spec.rb
|
|
@@ -308,7 +352,7 @@ files:
|
|
|
308
352
|
- spec/product_spec.rb
|
|
309
353
|
- spec/price_spec.rb
|
|
310
354
|
has_rdoc: true
|
|
311
|
-
homepage: http://github.com/yob/onix
|
|
355
|
+
homepage: http://github.com/yob/onix
|
|
312
356
|
licenses: []
|
|
313
357
|
|
|
314
358
|
post_install_message:
|
|
@@ -338,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
338
382
|
version: "0"
|
|
339
383
|
requirements: []
|
|
340
384
|
|
|
341
|
-
rubyforge_project:
|
|
385
|
+
rubyforge_project:
|
|
342
386
|
rubygems_version: 1.3.7
|
|
343
387
|
signing_key:
|
|
344
388
|
specification_version: 3
|