elibri_onix_generator 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: 06524624ed33e5e6ee783f5ba9a22055f3125ed2
4
- data.tar.gz: 552cd00f2facc30203a26e0db9d71edec5728d43
3
+ metadata.gz: 71115f37bcde9eda5eebb3b355c90fc81753edf7
4
+ data.tar.gz: f45550badba24f0d037cf30bb601582e63e7e51a
5
5
  SHA512:
6
- metadata.gz: ed30de577ef41dcea573fd3f172865ff85d5f97703e99dd0bc39a1e6033870f9e93206df30df7affeb461797f051108bd13b2e41717c2fcbaff483a5815ea479
7
- data.tar.gz: edc1631e8d4a3f493f890366f411776146782503ee90848ffe471f23350e6ad6ae23185765c93476602bbcc55deb3b5206c057ad6474c4c5760723657ae837ba
6
+ metadata.gz: 3ea02de5f3868a36a6bad48d85f7d8bd059a676e9e0c7fcc6ee9d6826be853366587ad7414cacfacf9a96645b0cf43f9030bd03df5828b5be26b35eeed66918e
7
+ data.tar.gz: d1784ced28c754a6b9cd217306f742f5727fa46f927f63e974e5d849687d4617dff85af73668bd79f49538c4d9290a896a9d8d85269f9e5b00494e32a493a3bf
@@ -165,7 +165,12 @@ module Elibri
165
165
  end
166
166
 
167
167
  def field_exists?(object, method_name)
168
- object.respond_to?(method_name) && object.send(method_name) && object.send(method_name).size > 0
168
+ if object.respond_to?(method_name)
169
+ v = object.send(method_name)
170
+ v && (v.respond_to?(:size) ? v.size > 0 : true)
171
+ else
172
+ false
173
+ end
169
174
  end
170
175
 
171
176
 
@@ -678,6 +683,26 @@ module Elibri
678
683
  end
679
684
  end
680
685
 
686
+ if product.respond_to?(:thema_codes_for_onix)
687
+ product.thema_codes_for_onix.each do |code|
688
+
689
+ scheme_id = {
690
+ "1" => 94, #Thema place qualifier
691
+ "2" => 95, #Thema language qualifier
692
+ "3" => 96, #Thema time period qualifier
693
+ "4" => 97, #Thema educational purpose qualifier
694
+ "5" => 98, #Thema interest age / special interest qualifier
695
+ "6" => 99, #Thema style qualifier
696
+ }[code[0]] || 93
697
+
698
+ tag(:Subject) do
699
+ tag(:SubjectSchemeIdentifier, scheme_id)
700
+ tag(:SubjectSchemeVersion, "1.3")
701
+ tag(:SubjectCode, code)
702
+ end
703
+ end
704
+ end
705
+
681
706
  # Kategorie wg. wydawnictwa
682
707
  if product.respond_to?(:publisher_product_categories)
683
708
  product.publisher_product_categories.each do |product_category|
@@ -1,3 +1,3 @@
1
1
  module ElibriOnixGenerator
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_onix_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Urbański