elibri_onix 0.5.13 → 0.5.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elibri_onix/onix_3_0/product.rb +22 -16
- data/lib/elibri_onix/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfc49b1d70bb6f2b9845bdf86cbb50ab1c3a17b4cbb833d720ed2d8e5f7c641c
|
4
|
+
data.tar.gz: 8f36e62235c9ceb753dea48729cf95d33171a1bef06f4895f09d279ff6e217ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c3195abd309afe4d00b8d399a62a52e36f6a3c711900f2e3615483944d437153cf583602be6c726af4b03acc2451c1422c8df6748b75ac772e554aa4ed0ec10
|
7
|
+
data.tar.gz: 250a4a7957ae090d5984816dc91e862a807442f1ee3b48df96d6962e4bb89e23822a7460706120fa7bb688df205b90ce1fe3a50649dbe4698f8591fa6d39c955
|
@@ -11,11 +11,11 @@ module Elibri
|
|
11
11
|
#:nodoc:
|
12
12
|
ATTRIBUTES =
|
13
13
|
[
|
14
|
-
:height, :width, :thickness, :weight, :ean, :isbn13, :number_of_pages, :duration,
|
15
|
-
:file_size, :publisher_name, :publisher_id, :imprint_name, :current_state, :reading_age_from, :reading_age_to,
|
14
|
+
:height, :width, :thickness, :weight, :ean, :isbn13, :number_of_pages, :duration,
|
15
|
+
:file_size, :publisher_name, :publisher_id, :imprint_name, :current_state, :reading_age_from, :reading_age_to,
|
16
16
|
:table_of_contents, :description, :reviews, :excerpts, :series, :title, :subtitle, :collection_title,
|
17
17
|
:collection_part, :full_title, :original_title, :trade_title, :parsed_publishing_date, :record_reference,
|
18
|
-
:deletion_text, :cover_type, :cover_price, :vat, :pkwiu, :additional_info, :product_composition,
|
18
|
+
:deletion_text, :cover_type, :cover_price, :vat, :pkwiu, :additional_info, :product_composition,
|
19
19
|
:publisher, :product_form, :no_contributor, :edition_statement, :edition_type_onix_code, :number_of_illustrations, :publishing_status,
|
20
20
|
:publishing_date, :premiere, :front_cover, :series_names, :city_of_publication,
|
21
21
|
:preview_exists, :short_description, :sale_restricted_to_poland,
|
@@ -151,7 +151,7 @@ module Elibri
|
|
151
151
|
#AdditionalInfo
|
152
152
|
attr_reader :additional_info
|
153
153
|
|
154
|
-
#kod ONIX typu produktu, np. 'BA' - lista dostępna pod adresem
|
154
|
+
#kod ONIX typu produktu, np. 'BA' - lista dostępna pod adresem
|
155
155
|
#https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
|
156
156
|
attr_reader :product_form
|
157
157
|
|
@@ -192,12 +192,12 @@ module Elibri
|
|
192
192
|
#dodatkowa informacja handlowa
|
193
193
|
attr_reader :additional_trade_information
|
194
194
|
|
195
|
-
#ilość elementów (puzzle, gry planszowe)
|
195
|
+
#ilość elementów (puzzle, gry planszowe)
|
196
196
|
attr_reader :number_of_pieces
|
197
197
|
|
198
198
|
#min. ilość graczy - gry planszowe
|
199
199
|
attr_reader :players_number_from
|
200
|
-
|
200
|
+
|
201
201
|
#max. ilość graczy - gry planszowe
|
202
202
|
attr_reader :players_number_to
|
203
203
|
|
@@ -265,7 +265,7 @@ module Elibri
|
|
265
265
|
@deletion_text = data.at_css('DeletionText').try(:text)
|
266
266
|
|
267
267
|
if data.namespaces.values.any? { |uri| uri =~ /elibri/ }
|
268
|
-
@cover_type = data.at_xpath('elibri:CoverType').try(:text)
|
268
|
+
@cover_type = data.at_xpath('elibri:CoverType').try(:text)
|
269
269
|
@pkwiu = data.at_xpath('elibri:PKWiU').try(:text)
|
270
270
|
@hyphenated_isbn = data.at_xpath('elibri:HyphenatedISBN').try(:text)
|
271
271
|
@pdw_exclusiveness = data.at_xpath('elibri:PDWExclusiveness').try(:text)
|
@@ -289,7 +289,7 @@ module Elibri
|
|
289
289
|
@vat = data.at_xpath('elibri:Vat').try(:text).try(:to_i)
|
290
290
|
else
|
291
291
|
price_sd = @supply_details.find { |sd| sd.supplier && sd.supplier.role == Elibri::ONIX::Dict::Release_3_0::SupplierRole::PUB_TO_RET }
|
292
|
-
if price_sd && price_sd.price && price_sd.price && price_sd.price.type == Elibri::ONIX::Dict::Release_3_0::PriceTypeCode::RRP_WITH_TAX
|
292
|
+
if price_sd && price_sd.price && price_sd.price && price_sd.price.type == Elibri::ONIX::Dict::Release_3_0::PriceTypeCode::RRP_WITH_TAX
|
293
293
|
@vat = price_sd.price.tax_rate_percent.to_i
|
294
294
|
@cover_price = price_sd.price.amount
|
295
295
|
@additional_trade_information = price_sd.additional_trade_information
|
@@ -333,14 +333,14 @@ module Elibri
|
|
333
333
|
elsif date = data.at_xpath("elibri:SaleRestrictedTo").try(:text)
|
334
334
|
@unlimited_licence = false
|
335
335
|
@licence_limited_to_before_type_cast = date
|
336
|
-
@licence_limited_to =
|
336
|
+
@licence_limited_to = _parse_date(date)
|
337
337
|
end
|
338
338
|
else
|
339
339
|
daten = data.css('PublishingDate').find { |d| d.at_css("PublishingDateRole") && d.at_css("PublishingDateRole").text == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::OUT_OF_PRINT_DATE }
|
340
340
|
if daten
|
341
341
|
date = daten.at_css('Date').text
|
342
342
|
@licence_limited_to_before_type_cast = date
|
343
|
-
@licence_limited_to =
|
343
|
+
@licence_limited_to = _parse_date(date)
|
344
344
|
@unlimited_licence = false
|
345
345
|
else
|
346
346
|
@unlimited_licence = true
|
@@ -387,7 +387,7 @@ module Elibri
|
|
387
387
|
end
|
388
388
|
|
389
389
|
end
|
390
|
-
if classification = data.css('ProductClassification').find { |cl|
|
390
|
+
if classification = data.css('ProductClassification').find { |cl|
|
391
391
|
cl.at_css('ProductClassificationType').text == Elibri::ONIX::Dict::Release_3_0::ProductClassificationType::PKWIU }
|
392
392
|
@pkwiu = classification.at_css('ProductClassificationCode').text
|
393
393
|
end
|
@@ -401,7 +401,7 @@ module Elibri
|
|
401
401
|
|
402
402
|
@publisher_subjects = data.css('Subject').find_all { |sd|
|
403
403
|
%w{24}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| PublisherSubject.new(sd) }
|
404
|
-
@thema_subjects = data.css('Subject').find_all { |sd|
|
404
|
+
@thema_subjects = data.css('Subject').find_all { |sd|
|
405
405
|
%w{93 94 95 96 97 98 99}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| ThemaSubject.new(sd) }
|
406
406
|
@audience_ranges = data.css('AudienceRange').map { |audience_data| AudienceRange.new(audience_data) }
|
407
407
|
|
@@ -436,7 +436,7 @@ module Elibri
|
|
436
436
|
preorder_embargo_date_as_object = publication_dates.find { |date| date.role == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::PREORDER_EMBARGO_DATE }
|
437
437
|
@preorder_embargo_date = Date.new(*preorder_embargo_date_as_object.parsed) if preorder_embargo_date_as_object
|
438
438
|
|
439
|
-
@sales_restrictions = data.css('SalesRestriction').map { |restriction_data| SalesRestriction.new(restriction_data) }
|
439
|
+
@sales_restrictions = data.css('SalesRestriction').map { |restriction_data| SalesRestriction.new(restriction_data) }
|
440
440
|
#ograniczenia terytorialne
|
441
441
|
if data.at_css("CountriesIncluded").try(:text) == "PL"
|
442
442
|
@sale_restricted_to_poland = true
|
@@ -462,7 +462,7 @@ module Elibri
|
|
462
462
|
|
463
463
|
#flaga - true, jeśli produkt nie ma żadnego autora
|
464
464
|
def no_contributor?
|
465
|
-
@no_contributor
|
465
|
+
@no_contributor
|
466
466
|
end
|
467
467
|
|
468
468
|
#flaga, czy książka to praca zbiorowa?
|
@@ -479,7 +479,7 @@ module Elibri
|
|
479
479
|
unnamed_persons? ? ["praca zbiorowa"] : @contributors.find_all { |c| c.role_name == "author" }.map(&:person_name)
|
480
480
|
end
|
481
481
|
|
482
|
-
[:ghostwriter, :scenarist, :originator, :illustrator, :photographer, :author_of_preface, :drawer, :cover_designer,
|
482
|
+
[:ghostwriter, :scenarist, :originator, :illustrator, :photographer, :author_of_preface, :drawer, :cover_designer,
|
483
483
|
:inked_or_colored_by, :editor, :revisor, :translator, :editor_in_chief, :read_by].each do |role|
|
484
484
|
define_method "#{role}s" do
|
485
485
|
@contributors.find_all { |c| c.role_name == role.to_s }.map(&:person_name)
|
@@ -514,7 +514,7 @@ module Elibri
|
|
514
514
|
end
|
515
515
|
|
516
516
|
#:nodoc:
|
517
|
-
def proprietary_identifiers
|
517
|
+
def proprietary_identifiers
|
518
518
|
@identifiers.find_all { |i| i.identifier_type == "proprietary" }.inject({}) { |res, ident| res[ident.type_name] = ident.value; res }
|
519
519
|
end
|
520
520
|
|
@@ -598,6 +598,12 @@ module Elibri
|
|
598
598
|
end
|
599
599
|
end
|
600
600
|
end
|
601
|
+
|
602
|
+
def _parse_date(string)
|
603
|
+
Date.new(string[0...4].to_i, string[4...6].to_i, string[6...8].to_i)
|
604
|
+
rescue ArgumentError
|
605
|
+
raise "Invalid date '#{string}' when parsing date for #{@record_reference}"
|
606
|
+
end
|
601
607
|
end
|
602
608
|
|
603
609
|
end
|
data/lib/elibri_onix/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elibri_onix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Urbanski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0'
|
290
290
|
requirements: []
|
291
|
-
rubygems_version: 3.
|
291
|
+
rubygems_version: 3.0.6
|
292
292
|
signing_key:
|
293
293
|
specification_version: 4
|
294
294
|
summary: EDItEUR ONIX format subset implementation used in Elibri publication system
|