elibri_onix 0.5.12 → 0.5.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f35ee1e0afa694d9272a217403c3488b2d35d14c28889f8c620786677bb2b000
4
- data.tar.gz: e50e806f0567738b47de7cc6a61d9b17eec95f266d0e775be416b87ef2a7e565
3
+ metadata.gz: d1470af5c74c8fda6805cccdc0d929fd6f967f5c596b1f66e01b533a3f148231
4
+ data.tar.gz: 2294442912e9f973455bf5b92dc8b38c6c604acdc032bc37b3f9b604fd1e603a
5
5
  SHA512:
6
- metadata.gz: 29bca94cd3b107116505511104fd14d6c2d8efa278862788e97f67cb1460e247827a54436058a375280e027ca28dce5de1d918c14ee063f4315f8d357b8d33db
7
- data.tar.gz: eafe7a05a5c8fae9ce0af84619822cf8d1733fecbb44a3a31d1b3f87e0cc8a3c16166faca177a57b701f9994bea37ef68beeef9a921f69f3b59ed9abf9df1cbf
6
+ metadata.gz: a0988a96fe595cb3db38bab08f3553a5e194211f2aeae1b11d1e700910891673c91d5bd76642db4f2fed2fa61d55d9a884abf2c83d49cb03aafb9ff4c35be7fb
7
+ data.tar.gz: e711486fc1a2e2c4b8b201ced29b8cd456f17846cd6fec45db23b49a12965cd893744bfffa79456c1e084bc6678d6129b34f0472aa4cfd52b216a4ff43a24e90
@@ -29,7 +29,7 @@ module Elibri
29
29
  [
30
30
  :contributors, #IMPORTANT
31
31
  :related_products, :languages, :measures, :supply_details, :measures, :title_details,
32
- :collections, :extents, :thema_subjects, :audience_ranges,
32
+ :collections, :extents, :thema_subjects, :publisher_subjects, :audience_ranges,
33
33
  :text_contents, #IMPORTANT
34
34
  :supporting_resources, #for example: cover
35
35
  :sales_restrictions, :authors,
@@ -224,6 +224,7 @@ module Elibri
224
224
  attr_reader :collections
225
225
  attr_reader :extents
226
226
  attr_reader :thema_subjects
227
+ attr_reader :publisher_subjects
227
228
  attr_reader :audience_ranges
228
229
  attr_reader :supply_details
229
230
  attr_reader :identifiers
@@ -251,6 +252,7 @@ module Elibri
251
252
  @languages = []
252
253
  @extents = []
253
254
  @thema_subjects = []
255
+ @publisher_subjects = []
254
256
  @audience_ranges = []
255
257
  ##publishing_details
256
258
  @sales_restrictions = []
@@ -396,6 +398,9 @@ module Elibri
396
398
  @no_contributor = !!data.at_css('NoContributor')
397
399
  @languages = data.css('Language').map { |language_data| Language.new(language_data) }
398
400
  @extents = data.css('Extent').map { |extent_data| Extent.new(extent_data) }
401
+
402
+ @publisher_subjects = data.css('Subject').find_all { |sd|
403
+ %w{24}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| PublisherSubject.new(sd) }
399
404
  @thema_subjects = data.css('Subject').find_all { |sd|
400
405
  %w{93 94 95 96 97 98 99}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| ThemaSubject.new(sd) }
401
406
  @audience_ranges = data.css('AudienceRange').map { |audience_data| AudienceRange.new(audience_data) }
@@ -0,0 +1,32 @@
1
+
2
+ module Elibri
3
+ module ONIX
4
+ module Release_3_0
5
+
6
+ class PublisherSubject
7
+
8
+ include HashId
9
+
10
+ ATTRIBUTES = [
11
+ :code, :heading_text
12
+ ]
13
+
14
+ RELATIONS = [
15
+ :inspect_include_fields
16
+ ]
17
+
18
+ attr_accessor :code, :heading_text, :to_xml
19
+
20
+ def initialize(data)
21
+ @to_xml = data.to_s
22
+ @code = data.at_css('SubjectCode').try(:text)
23
+ @heading_text = data.at_css('SubjectHeadingText').try(:text)
24
+ end
25
+
26
+ def inspect_include_fields
27
+ [:code]
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -4,7 +4,7 @@
4
4
  sender header product_identifier measure title_element title_detail collection contributor
5
5
  language extent audience_range text_content supporting_resource imprint publisher publishing_date
6
6
  sales_restriction related_product supplier_identifier stock_quantity_coded price supplier supply_detail
7
- product onix_message excerpt_info file_info thema_subject
7
+ product onix_message excerpt_info file_info thema_subject publisher_subject
8
8
  }.each do |file_name|
9
9
  require File.join(File.dirname(__FILE__), "onix_3_0", file_name)
10
10
  end
@@ -2,7 +2,7 @@ module Elibri
2
2
  module ONIX
3
3
  z = $VERBOSE
4
4
  $VERBOSE = nil
5
- VERSION = "0.5.12"
5
+ VERSION = "0.5.13"
6
6
  Version = VERSION
7
7
  $VERBOSE = z
8
8
  end
@@ -25,6 +25,12 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
25
25
  assert_equal "Kwalifikatory chronologiczne / od ok. 1500 do dzisiaj / XX wiek (ok. 1900–1999) " +
26
26
  "/ 1. poł. XX wieku (ok. 1900–1950) / Dwudziestolecie międzywojenne (ok. 1919–1939) / ok. 1920–1929", s3.heading_text
27
27
 
28
+ assert_equal 1, product.publisher_subjects.count
29
+
30
+ p1 = product.publisher_subjects[0]
31
+
32
+ assert_equal "191", p1.code
33
+ assert_equal "Beletrystyka: Horror", p1.heading_text
28
34
  end
29
35
 
30
36
  end
@@ -25,21 +25,6 @@
25
25
  <TitleText>Nielegalni</TitleText>
26
26
  </TitleElement>
27
27
  </TitleDetail>
28
- <Subject>
29
- <MainSubject/>
30
- <SubjectSchemeIdentifier>24</SubjectSchemeIdentifier>
31
- <SubjectSchemeName>elibri.com.pl</SubjectSchemeName>
32
- <SubjectSchemeVersion>1.0</SubjectSchemeVersion>
33
- <SubjectCode>1110</SubjectCode>
34
- <SubjectHeadingText>Historia / II Wojna Światowa / Ruch oporu</SubjectHeadingText>
35
- </Subject>
36
- <Subject>
37
- <SubjectSchemeIdentifier>24</SubjectSchemeIdentifier>
38
- <SubjectSchemeName>elibri.com.pl</SubjectSchemeName>
39
- <SubjectSchemeVersion>1.0</SubjectSchemeVersion>
40
- <SubjectCode>491</SubjectCode>
41
- <SubjectHeadingText>Szkoła i nauczanie / Lektury szkolne z opracowaniami</SubjectHeadingText>
42
- </Subject>
43
28
  <Subject>
44
29
  <SubjectSchemeIdentifier>93</SubjectSchemeIdentifier>
45
30
  <SubjectSchemeVersion>1.3</SubjectSchemeVersion>
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.12
4
+ version: 0.5.13
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: 2020-01-18 00:00:00.000000000 Z
12
+ date: 2020-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -187,6 +187,7 @@ files:
187
187
  - lib/elibri_onix/onix_3_0/product.rb
188
188
  - lib/elibri_onix/onix_3_0/product_identifier.rb
189
189
  - lib/elibri_onix/onix_3_0/publisher.rb
190
+ - lib/elibri_onix/onix_3_0/publisher_subject.rb
190
191
  - lib/elibri_onix/onix_3_0/publishing_date.rb
191
192
  - lib/elibri_onix/onix_3_0/related_product.rb
192
193
  - lib/elibri_onix/onix_3_0/sales_restriction.rb
@@ -287,8 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
288
  - !ruby/object:Gem::Version
288
289
  version: '0'
289
290
  requirements: []
290
- rubyforge_project:
291
- rubygems_version: 2.7.9
291
+ rubygems_version: 3.1.2
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: EDItEUR ONIX format subset implementation used in Elibri publication system