elibri_onix 0.5.7 → 0.5.8
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/measure.rb +1 -1
- data/lib/elibri_onix/onix_3_0/product.rb +36 -32
- data/lib/elibri_onix/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5ea523876f8d6c3592cb2a0db236799034257c23b8e2b7a66ee9b1554138348
|
4
|
+
data.tar.gz: 75d75d545d5a86401dd99152e56dc8dfcc8215aa6e6073c9c3695d00cac5d7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b5248d7dbb0b983bf2e58fa8debd020a8157645e979c8311c8d1c817c12dda7efeecc135d9b2fc07bd4cabc6a5bc1cce7007c47749766a4a7ac5e58191df32
|
7
|
+
data.tar.gz: 18602e1caa0e78b55ea9f541aa4dc67500ae28bf311d5e03be459731b78a54cd9c3000e38ef88d1622ec2870d2d4a8b0f77b1410d1e027cd0337c941fd0580d4
|
@@ -27,7 +27,7 @@ module Elibri
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def type_name
|
30
|
-
Elibri::ONIX::Dict::Release_3_0::MeasureType.find_by_onix_code(@type).const_name.downcase
|
30
|
+
Elibri::ONIX::Dict::Release_3_0::MeasureType.find_by_onix_code(@type).try(:const_name).try(:downcase)
|
31
31
|
end
|
32
32
|
|
33
33
|
def inspect_include_fields
|
@@ -269,7 +269,7 @@ module Elibri
|
|
269
269
|
@cover_price = BigDecimal(data.at_xpath('elibri:CoverPrice').try(:text)) if data.at_xpath('elibri:CoverPrice')
|
270
270
|
@vat = data.at_xpath('elibri:Vat').try(:text).try(:to_i)
|
271
271
|
else
|
272
|
-
price_sd = @supply_details.find { |sd| sd.supplier.role == Elibri::ONIX::Dict::Release_3_0::SupplierRole::PUB_TO_RET }
|
272
|
+
price_sd = @supply_details.find { |sd| sd.supplier && sd.supplier.role == Elibri::ONIX::Dict::Release_3_0::SupplierRole::PUB_TO_RET }
|
273
273
|
if price_sd && price_sd.price && price_sd.price && price_sd.price.type == Elibri::ONIX::Dict::Release_3_0::PriceTypeCode::RRP_WITH_TAX
|
274
274
|
@vat = price_sd.price.tax_rate_percent.to_i
|
275
275
|
@cover_price = price_sd.price.amount
|
@@ -316,9 +316,8 @@ module Elibri
|
|
316
316
|
@licence_limited_to = Date.new(date[0...4].to_i, date[4...6].to_i, date[6...8].to_i)
|
317
317
|
end
|
318
318
|
else
|
319
|
-
daten = data.css('PublishingDate').find { |d| d.at_css("PublishingDateRole").text == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::OUT_OF_PRINT_DATE }
|
319
|
+
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 }
|
320
320
|
if daten
|
321
|
-
|
322
321
|
date = daten.at_css('Date').text
|
323
322
|
@licence_limited_to_before_type_cast = date
|
324
323
|
@licence_limited_to = Date.new(date[0...4].to_i, date[4...6].to_i, date[6...8].to_i)
|
@@ -332,12 +331,24 @@ module Elibri
|
|
332
331
|
|
333
332
|
def descriptive_details_setup(data)
|
334
333
|
@product_composition = data.at_css('ProductComposition').try(:text)
|
335
|
-
@product_form = data.at_css('ProductForm').text
|
336
|
-
if @product_form
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
334
|
+
@product_form = data.at_css('ProductForm').try(:text)
|
335
|
+
if @product_form
|
336
|
+
if @product_form.starts_with?("B") && !@cover_type
|
337
|
+
@cover_type = Elibri::ONIX::Dict::CoverType.determine_cover_type(@product_form, data.at_css('ProductFormDetail').try(:text))
|
338
|
+
end
|
339
|
+
if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(@product_form)
|
340
|
+
@product_form_name = Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(@product_form).name(:en).downcase
|
341
|
+
end
|
342
|
+
|
343
|
+
simplified_product_form = @product_form.starts_with?("B") ? "BA" : @product_form
|
344
|
+
if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(simplified_product_form).try!(:digital?)
|
345
|
+
@digital_formats = []
|
346
|
+
data.css("ProductFormDetail").each do |format|
|
347
|
+
format_name = Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::find_by_onix_code(format.text).try(:name)
|
348
|
+
@digital_formats << format_name.upcase.gsub("MOBIPOCKET", "MOBI") if format_name
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
341
352
|
end
|
342
353
|
if classification = data.css('ProductClassification').find { |cl|
|
343
354
|
cl.at_css('ProductClassificationType').text == Elibri::ONIX::Dict::Release_3_0::ProductClassificationType::PKWIU }
|
@@ -354,15 +365,6 @@ module Elibri
|
|
354
365
|
%w{93 94 95 96 97 98 99}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| ThemaSubject.new(sd) }
|
355
366
|
@audience_ranges = data.css('AudienceRange').map { |audience_data| AudienceRange.new(audience_data) }
|
356
367
|
|
357
|
-
simplified_product_form = @product_form.starts_with?("B") ? "BA" : @product_form
|
358
|
-
if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(simplified_product_form).try!(:digital?)
|
359
|
-
@digital_formats = []
|
360
|
-
data.css("ProductFormDetail").each do |format|
|
361
|
-
format_name = Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::find_by_onix_code(format.text).try(:name)
|
362
|
-
@digital_formats << format_name.upcase.gsub("MOBIPOCKET", "MOBI") if format_name
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
368
|
#zabezpiecznie pliku
|
367
369
|
if protection = data.at_css("EpubTechnicalProtection").try(:text)
|
368
370
|
@technical_protection = Elibri::ONIX::Dict::Release_3_0::EpubTechnicalProtection::find_by_onix_code(protection).try(:name)
|
@@ -534,21 +536,23 @@ module Elibri
|
|
534
536
|
|
535
537
|
|
536
538
|
def compute_state!
|
537
|
-
if @notification_type
|
538
|
-
@
|
539
|
-
|
540
|
-
@
|
541
|
-
|
542
|
-
@
|
543
|
-
|
544
|
-
if @publishing_status == "04"
|
545
|
-
@current_state = :published
|
546
|
-
elsif @publishing_status == "07"
|
547
|
-
@current_state = :out_of_print
|
548
|
-
elsif @notification_type == "03"
|
549
|
-
@current_state = :published
|
539
|
+
if @notification_type || @publishing_status
|
540
|
+
if @notification_type == "01"
|
541
|
+
@current_state = :announced
|
542
|
+
elsif @notification_type == "02"
|
543
|
+
@current_state = :preorder
|
544
|
+
elsif @notification_type == "05"
|
545
|
+
@current_state = :deleted
|
550
546
|
else
|
551
|
-
|
547
|
+
if @publishing_status == "04"
|
548
|
+
@current_state = :published
|
549
|
+
elsif @publishing_status == "07"
|
550
|
+
@current_state = :out_of_print
|
551
|
+
elsif @notification_type == "03"
|
552
|
+
@current_state = :published
|
553
|
+
else
|
554
|
+
raise "cannot determine the state of the product #{@record_reference}"
|
555
|
+
end
|
552
556
|
end
|
553
557
|
end
|
554
558
|
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.8
|
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: 2020-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -284,7 +284,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
- !ruby/object:Gem::Version
|
285
285
|
version: '0'
|
286
286
|
requirements: []
|
287
|
-
|
287
|
+
rubyforge_project:
|
288
|
+
rubygems_version: 2.7.9
|
288
289
|
signing_key:
|
289
290
|
specification_version: 4
|
290
291
|
summary: EDItEUR ONIX format subset implementation used in Elibri publication system
|