elibri_onix 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 268ca1ab2c2b63e995f2aa816d90c0b947ccdb8aafe6996952a7f9b51c0adf1a
4
- data.tar.gz: 887617be809254210ed43320c55c4a471466e9d2c8cd03407825754eb13a27f1
3
+ metadata.gz: 695f587e6eee6ea9804909889dc9a61cf108e6fbc79564d9178e6b39873f13c9
4
+ data.tar.gz: 460af7593bfa60baa5984118125680f459ea64e17fda35e9cc1a1a955589b0ce
5
5
  SHA512:
6
- metadata.gz: 3f78fcd552c578ca293647738d8c3cad126e49e96eac2092df91124e9e365ff34f2f1cd9c4c348a4246c22a7a27286c1c846af289a10baab2131e5b6204feefc
7
- data.tar.gz: dacec693e3a2ff45d2ae30c3cf78578d7158c58c08c60b8d88bc4bde143dca5907131cfa519487fb5257149e2e9268a7ac50f2e3266612a464792237394218c2
6
+ metadata.gz: af51afa939aa24e5712fce8b56ba1a3bfd04e102c116ff035e6974c68c9e925fbe45cf093a7d10b9a29d06b407ad0d2009d65126fafee223b0418403af690add
7
+ data.tar.gz: 041378df54dd07234a7cdf975e6d5c469e943bf4116fa14b9e4332d869c931d2d03eea36cc4f4c2ce8d8e586f8e39118c115b4aceeea05f114ecde0cc3ddd392
@@ -22,17 +22,17 @@ module Elibri
22
22
 
23
23
  def initialize(data)
24
24
  @to_xml = data.to_s
25
- @type = data.css('ExtentType').try(:text)
26
- @value = data.css('ExtentValue').try(:text).try(:to_i)
27
- @unit = data.css('ExtentUnit').try(:text)
25
+ @type = data.css('ExtentType').try(:text).try(:strip)
26
+ @value = data.css('ExtentValue').try(:text).try(:strip).try(:to_i)
27
+ @unit = data.css('ExtentUnit').try(:text).try(:strip)
28
28
  end
29
29
 
30
30
  def type_name
31
- Elibri::ONIX::Dict::Release_3_0::ExtentType.find_by_onix_code(@type).const_name.downcase
31
+ Elibri::ONIX::Dict::Release_3_0::ExtentType.find_by_onix_code(@type).try(:const_name).try(:downcase)
32
32
  end
33
33
 
34
34
  def unit_name
35
- Elibri::ONIX::Dict::Release_3_0::ExtentUnit.find_by_onix_code(@unit).const_name.downcase
35
+ Elibri::ONIX::Dict::Release_3_0::ExtentUnit.find_by_onix_code(@unit).try(:const_name).try(:downcase)
36
36
  end
37
37
 
38
38
  def inspect_include_fields
@@ -355,7 +355,7 @@ module Elibri
355
355
  @audience_ranges = data.css('AudienceRange').map { |audience_data| AudienceRange.new(audience_data) }
356
356
 
357
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).digital?
358
+ if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(simplified_product_form).try!(:digital?)
359
359
  @digital_formats = []
360
360
  data.css("ProductFormDetail").each do |format|
361
361
  @digital_formats << Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::find_by_onix_code(format.text).name.upcase.gsub("MOBIPOCKET", "MOBI")
@@ -364,7 +364,7 @@ module Elibri
364
364
 
365
365
  #zabezpiecznie pliku
366
366
  if protection = data.at_css("EpubTechnicalProtection").try(:text)
367
- @technical_protection = Elibri::ONIX::Dict::Release_3_0::EpubTechnicalProtection::find_by_onix_code(protection).name
367
+ @technical_protection = Elibri::ONIX::Dict::Release_3_0::EpubTechnicalProtection::find_by_onix_code(protection).try(:name)
368
368
  @technical_protection_onix_code = protection
369
369
  end
370
370
 
@@ -544,6 +544,8 @@ module Elibri
544
544
  @current_state = :published
545
545
  elsif @publishing_status == "07"
546
546
  @current_state = :out_of_print
547
+ elsif @notification_type == "03"
548
+ @current_state = :published
547
549
  else
548
550
  raise "cannot determine the state of the product #{@record_reference}"
549
551
  end
@@ -39,7 +39,7 @@ module Elibri
39
39
 
40
40
  #returs the string name of value type
41
41
  def identifier_type
42
- Elibri::ONIX::Dict::Release_3_0::ProductIDType.find_by_onix_code(@type).const_name.downcase
42
+ Elibri::ONIX::Dict::Release_3_0::ProductIDType.find_by_onix_code(@type).try(:const_name).try(:downcase)
43
43
  end
44
44
 
45
45
  #:nodoc:
@@ -37,7 +37,7 @@ module Elibri
37
37
  end
38
38
 
39
39
  def type_name
40
- Elibri::ONIX::Dict::Release_3_0::OtherTextType.find_by_onix_code(@type).const_name.downcase
40
+ Elibri::ONIX::Dict::Release_3_0::OtherTextType.find_by_onix_code(@type).try(:const_name).try(:downcase)
41
41
  end
42
42
 
43
43
 
@@ -2,7 +2,7 @@ module Elibri
2
2
  module ONIX
3
3
  z = $VERBOSE
4
4
  $VERBOSE = nil
5
- VERSION = "0.5.4"
5
+ VERSION = "0.5.5"
6
6
  Version = VERSION
7
7
  $VERBOSE = z
8
8
  end
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
4
+ version: 0.5.5
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: 2019-12-06 00:00:00.000000000 Z
12
+ date: 2019-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport