onix 0.7.8 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/CHANGELOG +14 -0
  2. data/lib/onix.rb +2 -16
  3. data/lib/onix/addressee_identifier.rb +0 -1
  4. data/lib/onix/apa_product.rb +5 -1
  5. data/lib/onix/audience_range.rb +0 -1
  6. data/lib/onix/contributor.rb +0 -1
  7. data/lib/onix/header.rb +0 -1
  8. data/lib/onix/imprint.rb +0 -1
  9. data/lib/onix/language.rb +0 -1
  10. data/lib/onix/market_representation.rb +0 -1
  11. data/lib/onix/measure.rb +0 -1
  12. data/lib/onix/media_file.rb +0 -1
  13. data/lib/onix/other_text.rb +0 -1
  14. data/lib/onix/price.rb +0 -1
  15. data/lib/onix/product.rb +0 -1
  16. data/lib/onix/product_identifier.rb +0 -1
  17. data/lib/onix/publisher.rb +0 -1
  18. data/lib/onix/reader.rb +24 -99
  19. data/lib/onix/sales_restriction.rb +0 -1
  20. data/lib/onix/sender_identifier.rb +0 -1
  21. data/lib/onix/series.rb +0 -1
  22. data/lib/onix/series_identifier.rb +0 -1
  23. data/lib/onix/stock.rb +0 -1
  24. data/lib/onix/subject.rb +0 -1
  25. data/lib/onix/supply_detail.rb +0 -1
  26. data/lib/onix/title.rb +0 -1
  27. data/lib/onix/website.rb +0 -1
  28. data/spec/apa_product_spec.rb +34 -4
  29. data/spec/audience_range_spec.rb +2 -4
  30. data/spec/contributor_spec.rb +2 -4
  31. data/spec/header_spec.rb +2 -4
  32. data/spec/imprint_spec.rb +4 -6
  33. data/spec/language_spec.rb +2 -4
  34. data/spec/market_representation_spec.rb +2 -4
  35. data/spec/measure_spec.rb +2 -4
  36. data/spec/media_file_spec.rb +2 -4
  37. data/spec/normaliser_spec.rb +1 -3
  38. data/spec/other_text_spec.rb +2 -4
  39. data/spec/price_spec.rb +2 -4
  40. data/spec/product_identifier_spec.rb +2 -4
  41. data/spec/product_spec.rb +2 -5
  42. data/spec/publisher_spec.rb +2 -4
  43. data/spec/reader_spec.rb +3 -5
  44. data/spec/sales_restriction_spec.rb +2 -4
  45. data/spec/sender_identifier.rb +2 -4
  46. data/spec/series_identifier_spec.rb +2 -4
  47. data/spec/series_spec.rb +2 -4
  48. data/spec/spec_helper.rb +7 -0
  49. data/spec/stock_spec.rb +2 -4
  50. data/spec/subject_spec.rb +2 -4
  51. data/spec/supply_detail_spec.rb +2 -4
  52. data/spec/title_spec.rb +2 -4
  53. data/spec/website_spec.rb +2 -4
  54. data/spec/writer_spec.rb +1 -4
  55. metadata +93 -92
  56. data/lib/onix/common.rb +0 -26
data/spec/website_spec.rb CHANGED
@@ -1,15 +1,13 @@
1
1
  # coding: utf-8
2
2
 
3
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
4
-
5
- require 'onix'
3
+ require File.dirname(__FILE__) + '/spec_helper.rb'
6
4
 
7
5
  context "ONIX::Website" do
8
6
 
9
7
  before(:each) do
10
8
  data_path = File.join(File.dirname(__FILE__),"..","data")
11
9
  file1 = File.join(data_path, "website.xml")
12
- @doc = LibXML::XML::Document.file(file1)
10
+ @doc = Nokogiri::XML::Document.parse(File.read(file1))
13
11
  @root = @doc.root
14
12
  end
15
13
 
data/spec/writer_spec.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
4
-
5
- require 'onix'
6
- require 'stringio'
3
+ require File.dirname(__FILE__) + '/spec_helper.rb'
7
4
 
8
5
  context "ONIX::Writer" do
9
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-19 00:00:00 +11:00
12
+ date: 2009-10-31 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,29 +18,29 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "="
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.5.3
23
+ version: 3.1.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: libxml-ruby
26
+ name: andand
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.3
33
+ version: "0"
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: andand
36
+ name: nokogiri
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: "0"
43
+ version: "1.4"
44
44
  version:
45
45
  description: A convient mapping between ruby objects and the ONIX XML specification
46
46
  email: jimmy@deefa.com
@@ -51,103 +51,103 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
 
53
53
  files:
54
+ - lib/onix/writer.rb
55
+ - lib/onix/title.rb
56
+ - lib/onix/simple_product.rb
57
+ - lib/onix/publisher.rb
58
+ - lib/onix/stock.rb
59
+ - lib/onix/contributor.rb
60
+ - lib/onix/subject.rb
61
+ - lib/onix/apa_product.rb
62
+ - lib/onix/imprint.rb
63
+ - lib/onix/series.rb
64
+ - lib/onix/website.rb
65
+ - lib/onix/sender_identifier.rb
54
66
  - lib/onix/header.rb
55
- - lib/onix/price.rb
56
- - lib/onix/product.rb
57
- - lib/onix/reader.rb
67
+ - lib/onix/measure.rb
58
68
  - lib/onix/lists/product_form.rb
69
+ - lib/onix/lists/notification_type.rb
70
+ - lib/onix/lists/language_role.rb
71
+ - lib/onix/lists/country_code.rb
72
+ - lib/onix/lists/product_form_detail.rb
59
73
  - lib/onix/lists/product_availability.rb
60
74
  - lib/onix/lists/audience_code.rb
61
- - lib/onix/lists/country_code.rb
62
75
  - lib/onix/lists/language_code.rb
63
- - lib/onix/lists/language_role.rb
64
- - lib/onix/lists/notification_type.rb
65
- - lib/onix/lists/product_form_detail.rb
66
- - lib/onix/addressee_identifier.rb
67
- - lib/onix/apa_product.rb
68
- - lib/onix/contributor.rb
69
- - lib/onix/imprint.rb
70
- - lib/onix/media_file.rb
71
- - lib/onix/other_text.rb
72
- - lib/onix/product_identifier.rb
73
- - lib/onix/publisher.rb
74
- - lib/onix/website.rb
75
- - lib/onix/sales_restriction.rb
76
- - lib/onix/sender_identifier.rb
77
- - lib/onix/simple_product.rb
78
- - lib/onix/stock.rb
79
- - lib/onix/subject.rb
80
- - lib/onix/supply_detail.rb
81
- - lib/onix/title.rb
82
76
  - lib/onix/market_representation.rb
83
- - lib/onix/measure.rb
84
- - lib/onix/writer.rb
85
- - lib/onix/common.rb
86
- - lib/onix/normaliser.rb
87
77
  - lib/onix/audience_range.rb
78
+ - lib/onix/product_identifier.rb
79
+ - lib/onix/supply_detail.rb
88
80
  - lib/onix/language.rb
89
- - lib/onix/series.rb
90
81
  - lib/onix/series_identifier.rb
82
+ - lib/onix/addressee_identifier.rb
83
+ - lib/onix/normaliser.rb
84
+ - lib/onix/other_text.rb
85
+ - lib/onix/price.rb
86
+ - lib/onix/sales_restriction.rb
87
+ - lib/onix/reader.rb
88
+ - lib/onix/product.rb
89
+ - lib/onix/media_file.rb
91
90
  - lib/onix.rb
92
91
  - README.markdown
93
92
  - TODO
94
93
  - CHANGELOG
94
+ - dtd/2.1r3/iso-mopf.ent
95
95
  - dtd/2.1r3/onix-international.dtd
96
- - dtd/2.1r3/onix-xhtml.elt
97
- - dtd/2.1r3/reference.elt
96
+ - dtd/2.1r3/iso-mfrk.ent
98
97
  - dtd/2.1r3/iso-amsa.ent
99
- - dtd/2.1r3/iso-amsb.ent
100
98
  - dtd/2.1r3/iso-amsc.ent
101
- - dtd/2.1r3/iso-amsn.ent
102
- - dtd/2.1r3/iso-amso.ent
99
+ - dtd/2.1r3/iso-tech.ent
100
+ - dtd/2.1r3/iso-num.ent
101
+ - dtd/2.1r3/iso-dia.ent
102
+ - dtd/2.1r3/iso-num.old.ent
103
+ - dtd/2.1r3/xhtml-symbol.ent
104
+ - dtd/2.1r3/iso-pub.ent
105
+ - dtd/2.1r3/reference.elt
103
106
  - dtd/2.1r3/iso-amsr.ent
104
- - dtd/2.1r3/iso-box.ent
105
107
  - dtd/2.1r3/iso-cyr1.ent
106
- - dtd/2.1r3/iso-cyr2.ent
107
- - dtd/2.1r3/iso-dia.ent
108
- - dtd/2.1r3/iso-grk3.ent
108
+ - dtd/2.1r3/iso-amsn.ent
109
109
  - dtd/2.1r3/iso-lat1.ent
110
- - dtd/2.1r3/iso-lat2.ent
111
- - dtd/2.1r3/iso-mfrk.ent
112
- - dtd/2.1r3/iso-mopf.ent
110
+ - dtd/2.1r3/iso-box.ent
113
111
  - dtd/2.1r3/iso-mscr.ent
114
- - dtd/2.1r3/iso-num.ent
115
- - dtd/2.1r3/iso-num.old.ent
116
- - dtd/2.1r3/iso-pub.ent
117
- - dtd/2.1r3/iso-tech.ent
118
112
  - dtd/2.1r3/xhtml-special.ent
119
- - dtd/2.1r3/xhtml-symbol.ent
113
+ - dtd/2.1r3/iso-lat2.ent
114
+ - dtd/2.1r3/iso-cyr2.ent
115
+ - dtd/2.1r3/iso-amsb.ent
116
+ - dtd/2.1r3/iso-amso.ent
117
+ - dtd/2.1r3/iso-grk3.ent
118
+ - dtd/2.1r3/onix-xhtml.elt
119
+ - support/switch-onix-2.1-short-to-reference.xsl
120
+ - support/entities.txt
120
121
  - support/switch-onix-tagnames-2.0.xsl
121
- - support/switch-onix-tagnames-1.1.xsl
122
122
  - support/extract.rb
123
- - support/entities.txt
124
- - support/switch-onix-2.1-short-to-reference.xsl
125
- - spec/header_spec.rb
126
- - spec/product_spec.rb
127
- - spec/reader_spec.rb
128
- - spec/writer_spec.rb
129
- - spec/contributor_spec.rb
130
- - spec/imprint_spec.rb
131
- - spec/market_representation_spec.rb
132
- - spec/website_spec.rb
133
- - spec/measure_spec.rb
123
+ - support/switch-onix-tagnames-1.1.xsl
124
+ - spec/series_spec.rb
134
125
  - spec/media_file_spec.rb
126
+ - spec/normaliser_spec.rb
135
127
  - spec/other_text_spec.rb
136
- - spec/price_spec.rb
137
- - spec/product_identifier_spec.rb
128
+ - spec/reader_spec.rb
138
129
  - spec/publisher_spec.rb
130
+ - spec/website_spec.rb
139
131
  - spec/sales_restriction_spec.rb
140
- - spec/sender_identifier.rb
132
+ - spec/series_identifier_spec.rb
141
133
  - spec/stock_spec.rb
142
- - spec/subject_spec.rb
143
- - spec/supply_detail_spec.rb
134
+ - spec/writer_spec.rb
135
+ - spec/header_spec.rb
144
136
  - spec/title_spec.rb
145
- - spec/normaliser_spec.rb
146
137
  - spec/apa_product_spec.rb
147
- - spec/audience_range_spec.rb
148
138
  - spec/language_spec.rb
149
- - spec/series_identifier_spec.rb
150
- - spec/series_spec.rb
139
+ - spec/sender_identifier.rb
140
+ - spec/audience_range_spec.rb
141
+ - spec/supply_detail_spec.rb
142
+ - spec/contributor_spec.rb
143
+ - spec/market_representation_spec.rb
144
+ - spec/spec_helper.rb
145
+ - spec/subject_spec.rb
146
+ - spec/measure_spec.rb
147
+ - spec/product_identifier_spec.rb
148
+ - spec/imprint_spec.rb
149
+ - spec/product_spec.rb
150
+ - spec/price_spec.rb
151
151
  has_rdoc: true
152
152
  homepage: http://github.com/yob/onix/tree/master
153
153
  licenses: []
@@ -179,29 +179,30 @@ signing_key:
179
179
  specification_version: 3
180
180
  summary: A convient mapping between ruby objects and the ONIX XML specification
181
181
  test_files:
182
- - spec/header_spec.rb
183
- - spec/product_spec.rb
184
- - spec/reader_spec.rb
185
- - spec/writer_spec.rb
186
- - spec/contributor_spec.rb
187
- - spec/imprint_spec.rb
188
- - spec/market_representation_spec.rb
189
- - spec/website_spec.rb
190
- - spec/measure_spec.rb
182
+ - spec/series_spec.rb
191
183
  - spec/media_file_spec.rb
184
+ - spec/normaliser_spec.rb
192
185
  - spec/other_text_spec.rb
193
- - spec/price_spec.rb
194
- - spec/product_identifier_spec.rb
186
+ - spec/reader_spec.rb
195
187
  - spec/publisher_spec.rb
188
+ - spec/website_spec.rb
196
189
  - spec/sales_restriction_spec.rb
197
- - spec/sender_identifier.rb
190
+ - spec/series_identifier_spec.rb
198
191
  - spec/stock_spec.rb
199
- - spec/subject_spec.rb
200
- - spec/supply_detail_spec.rb
192
+ - spec/writer_spec.rb
193
+ - spec/header_spec.rb
201
194
  - spec/title_spec.rb
202
- - spec/normaliser_spec.rb
203
195
  - spec/apa_product_spec.rb
204
- - spec/audience_range_spec.rb
205
196
  - spec/language_spec.rb
206
- - spec/series_identifier_spec.rb
207
- - spec/series_spec.rb
197
+ - spec/sender_identifier.rb
198
+ - spec/audience_range_spec.rb
199
+ - spec/supply_detail_spec.rb
200
+ - spec/contributor_spec.rb
201
+ - spec/market_representation_spec.rb
202
+ - spec/spec_helper.rb
203
+ - spec/subject_spec.rb
204
+ - spec/measure_spec.rb
205
+ - spec/product_identifier_spec.rb
206
+ - spec/imprint_spec.rb
207
+ - spec/product_spec.rb
208
+ - spec/price_spec.rb
data/lib/onix/common.rb DELETED
@@ -1,26 +0,0 @@
1
- module ONIX
2
- # methods we want to be available on all our ROXML classes
3
- module Common
4
-
5
- # After an input string has been marshalled into an object,
6
- # ROXML will automatically call this method.
7
- #
8
- # LibXML (and therefore ROXML) appears to forget the encoding
9
- # of the input data, a damn shame considering the Ruby 1.9 encoding
10
- # support can be vey useful.
11
- #
12
- # Since we only ever pass our ROXML objects strings we know are utf-8
13
- # encoded, it should be safe enough to force every string attribute
14
- # back once the marshalling is done.
15
- #
16
- def after_parse
17
- self.class.roxml_attrs.each do |attr|
18
- var = instance_variable_get("@#{attr.variable_name}")
19
- if var && var.respond_to?(:force_encoding)
20
- var.force_encoding("utf-8")
21
- end
22
- end
23
- end
24
- end
25
- end
26
-