elibri_onix 0.2.3 → 0.2.4
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/Gemfile.lock +7 -1
- data/README.rdoc +1 -47
- data/Rakefile +5 -4
- data/elibri_onix.gemspec +2 -1
- data/lib/elibri_onix/onix_3_0/contributor.rb +41 -2
- data/lib/elibri_onix/onix_3_0/header.rb +12 -8
- data/lib/elibri_onix/onix_3_0/language.rb +17 -3
- data/lib/elibri_onix/onix_3_0/measure.rb +3 -7
- data/lib/elibri_onix/onix_3_0/onix_message.rb +19 -5
- data/lib/elibri_onix/onix_3_0/product.rb +203 -50
- data/lib/elibri_onix/onix_3_0/product_identifier.rb +16 -6
- data/lib/elibri_onix/onix_3_0/related_product.rb +6 -4
- data/lib/elibri_onix/onix_3_0/sender.rb +15 -6
- data/lib/elibri_onix/version.rb +1 -1
- data/test/elibri_licence_information_test.rb +2 -2
- data/test/elibri_onix_release_3_0_onix_message_test.rb +0 -16
- data/test/elibri_related_products_test.rb +10 -0
- data/test/elibri_territorial_rights_test.rb +2 -2
- data/test/fixtures/onix_related_products_example.xml +61 -0
- metadata +169 -139
@@ -2,26 +2,24 @@
|
|
2
2
|
module Elibri
|
3
3
|
module ONIX
|
4
4
|
module Release_3_0
|
5
|
-
|
5
|
+
#Klasa reprezentująca produkt
|
6
|
+
#Niektóre pola mogą pozostać bez wartości - zależy to od formy produktu
|
6
7
|
class Product
|
7
8
|
|
8
|
-
|
9
|
-
#important thing - record reference is unique eLibri identifier
|
10
|
-
|
11
|
-
|
9
|
+
#:nodoc:
|
12
10
|
ATTRIBUTES =
|
13
11
|
[
|
14
12
|
:elibri_dialect, :height, :width, :thickness, :weight, :ean, :isbn13, :number_of_pages, :duration,
|
15
13
|
:file_size, :publisher_name, :publisher_id, :imprint_name, :current_state, :reading_age_from, :reading_age_to,
|
16
14
|
:table_of_contents, :description, :reviews, :excerpts, :series, :title, :subtitle, :collection_title,
|
17
15
|
:collection_part, :full_title, :original_title, :trade_title, :parsed_publishing_date, :record_reference,
|
18
|
-
:deletion_text, :cover_type, :cover_price, :vat, :pkwiu, :product_composition,
|
16
|
+
:deletion_text, :cover_type, :cover_price, :vat, :pkwiu, :product_composition,
|
19
17
|
:publisher, :product_form, :no_contributor, :edition_statement, :number_of_illustrations, :publishing_status,
|
20
18
|
:publishing_date, :premiere, :front_cover, :series_names, :city_of_publication,
|
21
19
|
:elibri_product_category1_id, :elibri_product_category2_id, :preview_exists, :short_description, :sale_restricted_to_poland
|
22
20
|
]
|
23
21
|
|
24
|
-
|
22
|
+
#:nodoc:
|
25
23
|
RELATIONS =
|
26
24
|
[
|
27
25
|
:contributors, #IMPORTANT
|
@@ -34,24 +32,166 @@ module Elibri
|
|
34
32
|
:cover_designers, :inked_or_colored_bys, :editors, :revisors, :translators, :editor_in_chiefs, :read_bys
|
35
33
|
]
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
#:doc:
|
36
|
+
#wysokość w milimetrach
|
37
|
+
attr_reader :height
|
38
|
+
|
39
|
+
#szerokość w milimetrach
|
40
|
+
attr_reader :width
|
41
|
+
|
42
|
+
#gruboś w milimetrach
|
43
|
+
attr_reader :thickness
|
44
|
+
|
45
|
+
#waga w gramach
|
46
|
+
attr_reader :weight
|
47
|
+
|
48
|
+
#ean, jeśli jest inny, niż isbn13
|
49
|
+
attr_reader :ean
|
50
|
+
|
51
|
+
#isbn13 - bez kresek
|
52
|
+
attr_reader :isbn13
|
53
|
+
|
54
|
+
#ilość stron w książce drukowanej
|
55
|
+
attr_reader :number_of_pages
|
56
|
+
|
57
|
+
#czas trwania nagrania w audiobooku, w minutach
|
58
|
+
attr_reader :duration
|
59
|
+
|
60
|
+
#nazwa wydawnictwa
|
61
|
+
attr_reader :publisher_name
|
62
|
+
|
63
|
+
#ID wydawnictwa w systemie elibri
|
64
|
+
attr_reader :publisher_id
|
65
|
+
|
66
|
+
#Imprint, jeśli wydawnictwo używa imprintów. Jeżeli wydawnictwo podało imprint, to ta wartość powinna zostać wyświetlona
|
67
|
+
#użytkownikowi w sklepie jako nazwa wydawnictwa.
|
68
|
+
attr_reader :imprint_name
|
69
|
+
|
70
|
+
#Status produktu - jedna z wartości: announced, :preorder, :published, :out_of_print
|
71
|
+
attr_reader :current_state
|
72
|
+
|
73
|
+
#Wiek czytelnika - od
|
74
|
+
attr_reader :reading_age_from
|
75
|
+
|
76
|
+
#Wiek czytelnika - do
|
77
|
+
attr_reader :reading_age_to
|
78
|
+
|
79
|
+
#Spis treści - jeśli wydawca takowy umieścił
|
80
|
+
attr_reader :table_of_contents
|
81
|
+
|
82
|
+
#Opis produktu
|
83
|
+
attr_reader :description
|
84
|
+
|
85
|
+
#lista serii, w postaci [nazwa serii, numer w serii]
|
86
|
+
attr_reader :series
|
87
|
+
|
88
|
+
#tytuł ksiażki
|
89
|
+
attr_reader :title
|
90
|
+
|
91
|
+
#podtytuł
|
92
|
+
attr_reader :subtitle
|
93
|
+
|
94
|
+
#nazwa cyklu (częste przy komiksach, gdy seria jest częścią tytułu, np. Thorgal)
|
95
|
+
attr_reader :collection_title
|
96
|
+
|
97
|
+
#numer w cyklu
|
98
|
+
attr_reader :collection_part
|
99
|
+
|
100
|
+
#pełen tytuł
|
101
|
+
attr_reader :full_title
|
102
|
+
|
103
|
+
#tytuł oryginału
|
104
|
+
attr_reader :original_title
|
105
|
+
|
106
|
+
#krótki opis, jeśli wydawca takowy zamieści
|
107
|
+
attr_reader :short_description
|
108
|
+
|
109
|
+
#id kategorii elibri (1)
|
110
|
+
attr_reader :elibri_product_category1_id
|
111
|
+
|
112
|
+
#id kategorii elibri (2)
|
113
|
+
attr_reader :elibri_product_category2_id
|
114
|
+
|
115
|
+
#data końca licencji, jeśli licencja nie jest bezterminowa, w formacie YYYYMMDD
|
116
|
+
attr_reader :licence_limited_to_before_type_cast
|
117
|
+
|
118
|
+
#data końca licencji, jeśli licencja nie jest bezterminowa, instancja Date
|
119
|
+
attr_reader :licence_limited_to
|
120
|
+
|
121
|
+
#lista formatów, w jakich jest dostępny ebook (PDF, MOBI, EPUB)
|
122
|
+
attr_reader :digital_formats
|
123
|
+
|
124
|
+
#sposób zabezpieczania pliki (DRM, WATERMARK) - pliki dostępne w API transakcyjnym zawsze będą chronione watermarkiem
|
125
|
+
attr_reader :technical_protection
|
43
126
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
127
|
+
#record reference - wewnętrzny identyfikator rekordu, niezmienny i unikatowy
|
128
|
+
attr_reader :record_reference
|
129
|
+
|
130
|
+
#typ okładki, np. 'miękka ze skrzydełkami'
|
131
|
+
attr_reader :cover_type
|
132
|
+
|
133
|
+
#sugerowana cena detaliczna brutto produktu
|
134
|
+
attr_reader :cover_price
|
135
|
+
|
136
|
+
#stawka VAT
|
137
|
+
attr_reader :vat
|
138
|
+
|
139
|
+
#PKWiU
|
140
|
+
attr_reader :pkwiu
|
53
141
|
|
142
|
+
#kod ONIX typu produktu, np. 'BA' - lista dostępna pod adresem
|
143
|
+
#https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
|
144
|
+
attr_reader :product_form
|
54
145
|
|
146
|
+
#lista autorów, tłumaczy i innych, którzy mieli wkład w książkę, lista instancji Contributor
|
147
|
+
attr_reader :contributors
|
148
|
+
|
149
|
+
#lista języków, lista intancji Language
|
150
|
+
attr_reader :languages
|
151
|
+
|
152
|
+
#informacja o numerze wydania
|
153
|
+
attr_reader :edition_statement
|
154
|
+
|
155
|
+
#liczba ilustracji
|
156
|
+
attr_reader :number_of_illustrations
|
157
|
+
|
158
|
+
#reprezentacja xml dla produktu
|
159
|
+
attr_reader :to_xml
|
160
|
+
|
161
|
+
#miasto, w którym została wydana ksiażka
|
162
|
+
attr_reader :city_of_publication
|
163
|
+
|
164
|
+
#:nodoc:
|
165
|
+
attr_reader :text_contents
|
166
|
+
attr_reader :file_size
|
167
|
+
attr_reader :elibri_dialect
|
168
|
+
attr_reader :reviews
|
169
|
+
attr_reader :excerpts
|
170
|
+
attr_reader :trade_title
|
171
|
+
attr_reader :notification_type
|
172
|
+
attr_reader :deletion_text
|
173
|
+
attr_reader :product_composition
|
174
|
+
attr_reader :measures
|
175
|
+
attr_reader :imprint
|
176
|
+
attr_reader :publisher
|
177
|
+
attr_reader :publishing_status
|
178
|
+
attr_reader :title_details
|
179
|
+
attr_reader :collections
|
180
|
+
attr_reader :extents
|
181
|
+
attr_reader :subjects
|
182
|
+
attr_reader :audience_ranges
|
183
|
+
attr_reader :supply_details
|
184
|
+
attr_reader :identifiers
|
185
|
+
attr_reader :no_contributor
|
186
|
+
attr_reader :supporting_resources
|
187
|
+
attr_reader :sales_restrictions
|
188
|
+
attr_reader :publishing_date
|
189
|
+
attr_reader :related_products
|
190
|
+
|
191
|
+
#:nodoc:
|
192
|
+
attr_accessor :sale_restricted_to_poland, :unlimited_licence, :no_contributor, :preview_exists
|
193
|
+
|
194
|
+
#:doc:
|
55
195
|
def initialize(data)
|
56
196
|
@to_xml = data.to_s
|
57
197
|
#initialize variables that need to be array
|
@@ -76,11 +216,11 @@ module Elibri
|
|
76
216
|
@record_reference = data.at_xpath('xmlns:RecordReference').try(:text)
|
77
217
|
@notification_type = data.at_xpath('xmlns:NotificationType').try(:text)
|
78
218
|
@deletion_text = data.at_xpath('xmlns:DeletionText').try(:text)
|
79
|
-
@
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
83
|
-
@
|
219
|
+
@cover_type = data.at_xpath('elibri:CoverType').try(:text)
|
220
|
+
@cover_price = BigDecimal.new(data.at_xpath('elibri:CoverPrice').try(:text)) if data.at_xpath('elibri:CoverPrice')
|
221
|
+
@vat = data.at_xpath('elibri:Vat').try(:text).try(:to_i)
|
222
|
+
@pkwiu = data.at_xpath('elibri:PKWiU').try(:text)
|
223
|
+
@preview_exists = (data.at_xpath('elibri:preview_exists').try(:text) == "true")
|
84
224
|
@identifiers = data.xpath('xmlns:ProductIdentifier').map { |ident_data| ProductIdentifier.new(ident_data) }
|
85
225
|
begin
|
86
226
|
@related_products = data.at_xpath('xmlns:RelatedMaterial').xpath('xmlns:RelatedProduct').map { |related_data| RelatedProduct.new(related_data) }
|
@@ -116,7 +256,7 @@ module Elibri
|
|
116
256
|
@title_details = data.xpath('xmlns:TitleDetail').map { |title_data| TitleDetail.new(title_data) }
|
117
257
|
@collections = data.xpath('xmlns:Collection').map { |collection_data| Collection.new(collection_data) }
|
118
258
|
@contributors = data.xpath('xmlns:Contributor').map { |contributor_data| Contributor.new(contributor_data) }
|
119
|
-
@no_contributor = data.at_xpath('xmlns:NoContributor')
|
259
|
+
@no_contributor = !!data.at_xpath('xmlns:NoContributor')
|
120
260
|
@languages = data.xpath('xmlns:Language').map { |language_data| Language.new(language_data) }
|
121
261
|
@extents = data.xpath('xmlns:Extent').map { |extent_data| Extent.new(extent_data) }
|
122
262
|
@subjects = data.xpath('xmlns:Subject').map { |subject_data| Subject.new(subject_data) }
|
@@ -159,32 +299,35 @@ module Elibri
|
|
159
299
|
|
160
300
|
end
|
161
301
|
|
162
|
-
# Attributes in namespace elibri:* are specific for dialect >= 3.0.1.
|
163
|
-
# If dialect is less than 3.0.1, returns nil.
|
164
|
-
%w{cover_type cover_price vat pkwiu}.each do |method_name|
|
165
|
-
module_eval(<<-EVAL_END, __FILE__, __LINE__ + 1)
|
166
|
-
def #{method_name} # def vat
|
167
|
-
if @elibri_dialect.to_s >= '3.0.1' # if @elibri_dialect.to_s >= '3.0.1'
|
168
|
-
#{method_name}_from_3_0_1 # vat_from_3_0_1
|
169
|
-
else # else
|
170
|
-
nil # nil
|
171
|
-
end # end
|
172
|
-
end # end
|
173
|
-
EVAL_END
|
174
|
-
end
|
175
|
-
|
176
302
|
def sales_restrictions?
|
177
303
|
@sales_restrictions.size > 0
|
178
304
|
end
|
179
305
|
|
306
|
+
#flaga, czy sprzedaż książki jest ograniczona do Polski
|
307
|
+
def sale_restricted_to_poland?
|
308
|
+
@sale_restricted_to_poland
|
309
|
+
end
|
310
|
+
|
311
|
+
#flaga informująca, czy licencja jest bezterminowa
|
312
|
+
def unlimited_licence?
|
313
|
+
@unlimited_licence
|
314
|
+
end
|
315
|
+
|
316
|
+
#flaga - true, jeśli produkt nie ma żadnego autora
|
180
317
|
def no_contributor?
|
181
|
-
@no_contributor
|
318
|
+
@no_contributor
|
182
319
|
end
|
183
320
|
|
321
|
+
#flaga, czy książka to praca zbiorowa?
|
184
322
|
def unnamed_persons?
|
185
323
|
@contributors.size == 1 && contributors[0].unnamed_persons.present?
|
186
324
|
end
|
187
325
|
|
326
|
+
#flaga, czy istnieje podgląd produktu
|
327
|
+
def preview_exists?
|
328
|
+
@preview_exists
|
329
|
+
end
|
330
|
+
|
188
331
|
def authors
|
189
332
|
unnamed_persons? ? ["praca zbiorowa"] : @contributors.find_all { |c| c.role_name == "author" }.map(&:person_name)
|
190
333
|
end
|
@@ -202,27 +345,36 @@ module Elibri
|
|
202
345
|
end
|
203
346
|
end
|
204
347
|
|
348
|
+
#czy istnieje podgląd?
|
205
349
|
def preview_exists?
|
206
350
|
@preview_exists
|
207
351
|
end
|
208
352
|
|
353
|
+
#okładka ksiązki, instance SupportingResource
|
209
354
|
def front_cover
|
210
355
|
@supporting_resources.find { |resource| resource.content_type_name == "front_cover" }
|
211
356
|
end
|
212
357
|
|
358
|
+
#lista nazwa serii, do których należy produkt
|
213
359
|
def series_names
|
214
360
|
@series.map { |series| series[0] }
|
215
361
|
end
|
216
362
|
|
363
|
+
#data premiery, jako instancja Date (tylko wtedy, gdy dokładna data jest znana)
|
217
364
|
def premiere
|
218
365
|
Date.new(*parsed_publishing_date) if parsed_publishing_date.size == 3
|
219
366
|
end
|
367
|
+
|
368
|
+
def related_products_record_references
|
369
|
+
related_products.map(&:record_reference)
|
370
|
+
end
|
220
371
|
|
372
|
+
#:nodoc:
|
221
373
|
def proprietary_identifiers
|
222
374
|
@identifiers.find_all { |i| i.identifier_type == "proprietary" }.inject({}) { |res, ident| res[ident.type_name] = ident.value; res }
|
223
375
|
end
|
224
376
|
|
225
|
-
|
377
|
+
#:nodoc:
|
226
378
|
def pretty_print_instance_variables
|
227
379
|
(instance_variables - ["@roxml_references", "@measures", "@identifiers", "@notification_type", "@publishing_status",
|
228
380
|
"@elibri_dialect", "@product_composition", "@extents", "@publisher", "@imprint",
|
@@ -231,7 +383,7 @@ module Elibri
|
|
231
383
|
}.sort
|
232
384
|
end
|
233
385
|
|
234
|
-
|
386
|
+
#:nodoc:
|
235
387
|
def pretty_print(pp)
|
236
388
|
pp.object_address_group(self) {
|
237
389
|
pp.seplist(self.pretty_print_instance_variables, lambda { pp.text ',' }) {|v|
|
@@ -246,7 +398,9 @@ module Elibri
|
|
246
398
|
}
|
247
399
|
}
|
248
400
|
end
|
249
|
-
|
401
|
+
|
402
|
+
#data premiery w postaci listy [rok, miesiąc, dzień], [rok, miesiąc], [rok], lub pustej listy - jeśli data premiery nie jest znana
|
403
|
+
#(data premiery może nie być znana w przypadku backlisty)
|
250
404
|
def parsed_publishing_date
|
251
405
|
if sales_restrictions?
|
252
406
|
date = sales_restrictions[0].end_date
|
@@ -259,7 +413,7 @@ module Elibri
|
|
259
413
|
end
|
260
414
|
|
261
415
|
|
262
|
-
private
|
416
|
+
private
|
263
417
|
|
264
418
|
def find_title(code)
|
265
419
|
@title_details.find {|title_detail| title_detail.type == code}
|
@@ -279,8 +433,8 @@ private
|
|
279
433
|
@publisher_id = @publisher.eid if publisher
|
280
434
|
@imprint_name = @imprint.name if imprint
|
281
435
|
@isbn13 = @identifiers.find { |identifier| identifier.identifier_type == "isbn13" }.try(:value)
|
282
|
-
@reading_age_from = @audience_ranges.find {|ar| (ar.qualifier == "18") && (ar.precision == "03")}.try(:value)
|
283
|
-
@reading_age_to = @audience_ranges.find {|ar| (ar.qualifier == "18") && (ar.precision == "04")}.try(:value)
|
436
|
+
@reading_age_from = @audience_ranges.find {|ar| (ar.qualifier == "18") && (ar.precision == "03")}.try(:value).try(:to_i)
|
437
|
+
@reading_age_to = @audience_ranges.find {|ar| (ar.qualifier == "18") && (ar.precision == "04")}.try(:value).try(:to_i)
|
284
438
|
@table_of_contents = @text_contents.find { |t| t.type_name == "table_of_contents" }
|
285
439
|
@description = @text_contents.find { |t| t.type_name == "main_description" }
|
286
440
|
@short_description = @text_contents.find { |t| t.type_name == "short_description" }
|
@@ -300,7 +454,6 @@ private
|
|
300
454
|
|
301
455
|
@elibri_product_category1_id = subjects[0].code if subjects[0]
|
302
456
|
@elibri_product_category2_id = subjects[1].code if subjects[1]
|
303
|
-
@preview_exists = (preview_exists_from_3_0_1 == "true")
|
304
457
|
|
305
458
|
compute_state!
|
306
459
|
end
|
@@ -3,21 +3,29 @@ module Elibri
|
|
3
3
|
module ONIX
|
4
4
|
module Release_3_0
|
5
5
|
|
6
|
+
#product identifier, for example isbn
|
6
7
|
class ProductIdentifier
|
7
8
|
|
8
|
-
#from ONIX documentation:
|
9
|
-
#A repeatable group of data elements which together define an identifier of a product in accordance with a specified scheme.
|
10
|
-
#As well as standard identifiers, the composite allows proprietary identifiers (SKUs) assigned by wholesalers or
|
11
|
-
#vendors to be sent as part of the ONIX record.
|
12
|
-
|
13
9
|
include HashId
|
14
10
|
|
15
|
-
|
11
|
+
#onix code of type (see elibri_onix_dict, Elibri::ONIX::Dict::Release_3_0::ProductIDType)
|
12
|
+
attr_accessor :type
|
13
|
+
|
14
|
+
#if type is prioprietery (01) - then the name of type
|
15
|
+
attr_accessor :type_name
|
16
|
+
|
17
|
+
#identifier value
|
18
|
+
attr_accessor :value
|
19
|
+
|
20
|
+
#xml representation of identifier
|
21
|
+
attr_accessor :to_xml
|
16
22
|
|
23
|
+
#:nodoc:
|
17
24
|
ATTRIBUTES = [
|
18
25
|
:type, :type_name, :value, :identifier_type
|
19
26
|
]
|
20
27
|
|
28
|
+
#:nodoc:
|
21
29
|
RELATIONS = [
|
22
30
|
:inspect_include_fields
|
23
31
|
]
|
@@ -29,10 +37,12 @@ module Elibri
|
|
29
37
|
@value = data.at_xpath('xmlns:IDValue').try(:text)
|
30
38
|
end
|
31
39
|
|
40
|
+
#returs the string name of value type
|
32
41
|
def identifier_type
|
33
42
|
Elibri::ONIX::Dict::Release_3_0::ProductIDType.find_by_onix_code(@type).const_name.downcase
|
34
43
|
end
|
35
44
|
|
45
|
+
#:nodoc:
|
36
46
|
def inspect_include_fields
|
37
47
|
[:identifier_type]
|
38
48
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
|
4
|
-
|
5
3
|
module Elibri
|
6
4
|
module ONIX
|
7
5
|
module Release_3_0
|
@@ -12,16 +10,20 @@ module Elibri
|
|
12
10
|
#An optional and repeatable group of data elements which together describe a product which has a specified relationship
|
13
11
|
#to the product described in the ONIX record.
|
14
12
|
include HashId
|
15
|
-
|
13
|
+
|
14
|
+
#:nodoc:
|
16
15
|
ATTRIBUTES = [
|
17
16
|
:relation_code, :proprietary_identifiers, :record_reference
|
18
17
|
]
|
19
18
|
|
19
|
+
#:nodoc:
|
20
20
|
RELATIONS = [
|
21
21
|
:identifiers
|
22
22
|
]
|
23
23
|
|
24
|
-
|
24
|
+
attr_reader :relation_code
|
25
|
+
attr_reader :identifiers
|
26
|
+
attr_reader :to_xml
|
25
27
|
|
26
28
|
def initialize(data)
|
27
29
|
@to_xml = data.to_s
|
@@ -2,19 +2,28 @@
|
|
2
2
|
module Elibri
|
3
3
|
module ONIX
|
4
4
|
module Release_3_0
|
5
|
-
|
5
|
+
|
6
|
+
#Sender of the message
|
6
7
|
class Sender
|
7
8
|
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
attr_accessor :
|
9
|
+
#name of company, which sent the message
|
10
|
+
attr_accessor :sender_name
|
11
|
+
|
12
|
+
#contact person
|
13
|
+
attr_accessor :contact_name
|
14
|
+
|
15
|
+
#contact email
|
16
|
+
attr_accessor :email_address
|
17
|
+
|
18
|
+
#xml representation of sender
|
19
|
+
attr_accessor :to_xml
|
13
20
|
|
21
|
+
#:nodoc:
|
14
22
|
ATTRIBUTES = [
|
15
23
|
:sender_name, :contact_name, :email_address
|
16
24
|
]
|
17
25
|
|
26
|
+
#:nodoc:
|
18
27
|
RELATIONS = []
|
19
28
|
|
20
29
|
def initialize(data)
|
data/lib/elibri_onix/version.rb
CHANGED
@@ -6,10 +6,10 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
|
6
6
|
it "should be able to parse licence end info" do
|
7
7
|
|
8
8
|
product = load_fixture("onix_unlimited_book_sample_example.xml")
|
9
|
-
assert product.unlimited_licence
|
9
|
+
assert product.unlimited_licence?
|
10
10
|
|
11
11
|
product = load_fixture("onix_epub_details_example.xml")
|
12
|
-
assert !product.unlimited_licence
|
12
|
+
assert !product.unlimited_licence?
|
13
13
|
assert_equal "20140307", product.licence_limited_to_before_type_cast
|
14
14
|
assert_equal Date.new(2014, 3, 7), product.licence_limited_to
|
15
15
|
end
|
@@ -167,20 +167,4 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
-
|
171
|
-
it "should consider elibri_dialect attribute and ignore attributes unrecognized in specified dialect" do
|
172
|
-
xml_string = File.read File.join(File.dirname(__FILE__), "..", "test", "fixtures", "old_dialect.xml")
|
173
|
-
|
174
|
-
onix = Elibri::ONIX::Release_3_0::ONIXMessage.new(xml_string)
|
175
|
-
assert_equal '3.0', onix.release
|
176
|
-
assert_equal '3.0.0', onix.elibri_dialect
|
177
|
-
|
178
|
-
product = onix.products.first
|
179
|
-
assert_equal '3.0.0', product.elibri_dialect
|
180
|
-
assert_nil product.cover_type
|
181
|
-
assert_nil product.cover_price
|
182
|
-
assert_nil product.vat
|
183
|
-
assert_nil product.pkwiu
|
184
|
-
end
|
185
|
-
|
186
170
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
4
|
+
|
5
|
+
it "should be able to parse related products info" do
|
6
|
+
product = load_fixture("onix_related_products_example.xml")
|
7
|
+
assert_equal ["c486ef9c55659d3e123b"], product.related_products_record_references
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -6,9 +6,9 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
|
6
6
|
it "should be able to parse territorial rights info" do
|
7
7
|
|
8
8
|
product1 = load_fixture("onix_territorial_rights_example.xml", 0)
|
9
|
-
assert product1.sale_restricted_to_poland
|
9
|
+
assert product1.sale_restricted_to_poland?
|
10
10
|
|
11
11
|
product2 = load_fixture("onix_territorial_rights_example.xml", 1)
|
12
|
-
assert !product2.sale_restricted_to_poland
|
12
|
+
assert !product2.sale_restricted_to_poland?
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ONIXMessage xmlns="http://ns.editeur.org/onix/3.0/reference" xmlns:elibri="http://elibri.com.pl/ns/extensions" release="3.0">
|
3
|
+
<elibri:Dialect>3.0.1</elibri:Dialect>
|
4
|
+
<Header>
|
5
|
+
<Sender>
|
6
|
+
<SenderName>Elibri.com.pl</SenderName>
|
7
|
+
<ContactName>Tomasz Meka</ContactName>
|
8
|
+
<EmailAddress>kontakt@elibri.com.pl</EmailAddress>
|
9
|
+
</Sender>
|
10
|
+
<SentDateTime>20130124</SentDateTime>
|
11
|
+
</Header>
|
12
|
+
<Product>
|
13
|
+
<RecordReference>fdb8fa072be774d97a97</RecordReference>
|
14
|
+
<NotificationType>03</NotificationType>
|
15
|
+
<ProductIdentifier>
|
16
|
+
<ProductIDType>15</ProductIDType>
|
17
|
+
<IDValue>9788324799992</IDValue>
|
18
|
+
</ProductIdentifier>
|
19
|
+
<DescriptiveDetail>
|
20
|
+
<ProductComposition>00</ProductComposition>
|
21
|
+
<ProductForm>BA</ProductForm>
|
22
|
+
<TitleDetail>
|
23
|
+
<TitleType>01</TitleType>
|
24
|
+
<TitleElement>
|
25
|
+
<TitleElementLevel>01</TitleElementLevel>
|
26
|
+
<TitleText>Nielegalni</TitleText>
|
27
|
+
</TitleElement>
|
28
|
+
</TitleDetail>
|
29
|
+
</DescriptiveDetail>
|
30
|
+
<PublishingDetail>
|
31
|
+
<Publisher>
|
32
|
+
<PublishingRole>01</PublishingRole>
|
33
|
+
<PublisherIdentifier>
|
34
|
+
<PublisherIDType>01</PublisherIDType>
|
35
|
+
<IDTypeName>ElibriPublisherCode</IDTypeName>
|
36
|
+
<IDValue>11</IDValue>
|
37
|
+
</PublisherIdentifier>
|
38
|
+
<PublisherName>GREG</PublisherName>
|
39
|
+
</Publisher>
|
40
|
+
<CityOfPublication>Warszawa</CityOfPublication>
|
41
|
+
<PublishingStatus>04</PublishingStatus>
|
42
|
+
<SalesRights>
|
43
|
+
<SalesRightsType>01</SalesRightsType>
|
44
|
+
<Territory>
|
45
|
+
<RegionsIncluded>WORLD</RegionsIncluded>
|
46
|
+
</Territory>
|
47
|
+
</SalesRights>
|
48
|
+
</PublishingDetail>
|
49
|
+
<RelatedMaterial>
|
50
|
+
<RelatedProduct>
|
51
|
+
<ProductRelationCode>24</ProductRelationCode>
|
52
|
+
<ProductIdentifier>
|
53
|
+
<ProductIDType>01</ProductIDType>
|
54
|
+
<IDTypeName>elibri</IDTypeName>
|
55
|
+
<IDValue>c486ef9c55659d3e123b</IDValue>
|
56
|
+
</ProductIdentifier>
|
57
|
+
</RelatedProduct>
|
58
|
+
</RelatedMaterial>
|
59
|
+
<elibri:preview_exists>false</elibri:preview_exists>
|
60
|
+
</Product>
|
61
|
+
</ONIXMessage>
|