elibri_onix 0.2.4 → 0.2.5
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.
- data/Gemfile.lock +1 -2
- data/lib/elibri_onix/hash_id.rb +2 -2
- data/lib/elibri_onix/inspector.rb +8 -7
- data/lib/elibri_onix/onix_3_0/audience_range.rb +4 -2
- data/lib/elibri_onix/onix_3_0/product.rb +10 -28
- data/lib/elibri_onix/onix_3_0/publisher.rb +7 -0
- data/lib/elibri_onix/onix_3_0/supporting_resource.rb +1 -0
- data/lib/elibri_onix/onix_3_0/text_content.rb +3 -1
- data/lib/elibri_onix/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elibri_onix (0.2.
|
4
|
+
elibri_onix (0.2.4)
|
5
5
|
activesupport (>= 2.3.5)
|
6
6
|
elibri_onix_dict (>= 0.0.5)
|
7
7
|
i18n
|
@@ -24,7 +24,6 @@ GEM
|
|
24
24
|
mocha (0.11.4)
|
25
25
|
metaclass (~> 0.0.1)
|
26
26
|
multi_json (1.5.0)
|
27
|
-
nokogiri (1.5.6)
|
28
27
|
nokogiri (1.5.6-java)
|
29
28
|
pry (0.9.9.6)
|
30
29
|
coderay (~> 1.0.5)
|
data/lib/elibri_onix/hash_id.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module HashId
|
2
2
|
|
3
|
-
SKIPPED_ATTRIBS = ["@opts", "@default_namespace", "@instance"
|
3
|
+
SKIPPED_ATTRIBS = ["@opts", "@default_namespace", "@instance"]
|
4
4
|
SKIPPED_2 = ["@id", "@id_before_type_cast"]
|
5
5
|
|
6
6
|
def eid
|
@@ -34,4 +34,4 @@ module HashId
|
|
34
34
|
return Digest::SHA1.hexdigest(result.join("-"))
|
35
35
|
end
|
36
36
|
|
37
|
-
end
|
37
|
+
end
|
@@ -7,19 +7,20 @@ module Inspector
|
|
7
7
|
"#{value[0..50]}...".inspect
|
8
8
|
elsif value.is_a?(Date) || value.is_a?(Time)
|
9
9
|
%("#{value.to_s(:db)}")
|
10
|
-
#elsif value.is_a?(Array)
|
11
|
-
# "\n [" + value.map(&:inspect).join(",\n ") + "]"
|
12
10
|
else
|
13
11
|
value.inspect
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
15
|
def inspect
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
if self.respond_to?(:inspect_include_fields)
|
17
|
+
attributes_as_nice_string = self.inspect_include_fields.collect { |name|
|
18
|
+
"#{name}: #{attribute_for_inspect(name)}"
|
19
|
+
}.compact.join(", ")
|
20
|
+
"#<#{self.class} #{attributes_as_nice_string}>"
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -8,14 +8,16 @@ module Elibri
|
|
8
8
|
#from ONIX documentation:
|
9
9
|
#An optional and repeatable group of data elements which together describe an audience or readership range for which a product
|
10
10
|
#is intended.
|
11
|
-
|
11
|
+
|
12
|
+
#:nodoc:
|
12
13
|
ATTRIBUTES = [
|
13
14
|
:qualifier, :precision, :value
|
14
15
|
]
|
15
16
|
|
17
|
+
#:nodoc:
|
16
18
|
RELATIONS = []
|
17
19
|
|
18
|
-
|
20
|
+
attr_reader :qualifier, :precision, :value, :to_xml
|
19
21
|
|
20
22
|
def initialize(data)
|
21
23
|
@old_xml = data.to_s
|
@@ -6,6 +6,8 @@ module Elibri
|
|
6
6
|
#Niektóre pola mogą pozostać bez wartości - zależy to od formy produktu
|
7
7
|
class Product
|
8
8
|
|
9
|
+
include Inspector
|
10
|
+
|
9
11
|
#:nodoc:
|
10
12
|
ATTRIBUTES =
|
11
13
|
[
|
@@ -32,6 +34,11 @@ module Elibri
|
|
32
34
|
:cover_designers, :inked_or_colored_bys, :editors, :revisors, :translators, :editor_in_chiefs, :read_bys
|
33
35
|
]
|
34
36
|
|
37
|
+
def inspect_include_fields
|
38
|
+
[:record_reference, :full_title, :front_cover, :publisher, :isbn13, :ean, :premiere]
|
39
|
+
end
|
40
|
+
|
41
|
+
|
35
42
|
#:doc:
|
36
43
|
#wysokość w milimetrach
|
37
44
|
attr_reader :height
|
@@ -76,10 +83,10 @@ module Elibri
|
|
76
83
|
#Wiek czytelnika - do
|
77
84
|
attr_reader :reading_age_to
|
78
85
|
|
79
|
-
#Spis treści - jeśli wydawca takowy
|
86
|
+
#Spis treści - jeśli wydawca takowy umieścił, instancja TextContent
|
80
87
|
attr_reader :table_of_contents
|
81
88
|
|
82
|
-
#Opis produktu
|
89
|
+
#Opis produktu, instancja TextContent
|
83
90
|
attr_reader :description
|
84
91
|
|
85
92
|
#lista serii, w postaci [nazwa serii, numer w serii]
|
@@ -103,7 +110,7 @@ module Elibri
|
|
103
110
|
#tytuł oryginału
|
104
111
|
attr_reader :original_title
|
105
112
|
|
106
|
-
#krótki opis, jeśli wydawca takowy zamieści
|
113
|
+
#krótki opis, jeśli wydawca takowy zamieści, instancja TextContent
|
107
114
|
attr_reader :short_description
|
108
115
|
|
109
116
|
#id kategorii elibri (1)
|
@@ -374,31 +381,6 @@ module Elibri
|
|
374
381
|
@identifiers.find_all { |i| i.identifier_type == "proprietary" }.inject({}) { |res, ident| res[ident.type_name] = ident.value; res }
|
375
382
|
end
|
376
383
|
|
377
|
-
#:nodoc:
|
378
|
-
def pretty_print_instance_variables
|
379
|
-
(instance_variables - ["@roxml_references", "@measures", "@identifiers", "@notification_type", "@publishing_status",
|
380
|
-
"@elibri_dialect", "@product_composition", "@extents", "@publisher", "@imprint",
|
381
|
-
"@audience_ranges", "@text_contents", "@collections", "@title_details", "@publishing_date"]).find_all { |varname|
|
382
|
-
instance_variable_get(varname).present?
|
383
|
-
}.sort
|
384
|
-
end
|
385
|
-
|
386
|
-
#:nodoc:
|
387
|
-
def pretty_print(pp)
|
388
|
-
pp.object_address_group(self) {
|
389
|
-
pp.seplist(self.pretty_print_instance_variables, lambda { pp.text ',' }) {|v|
|
390
|
-
pp.breakable
|
391
|
-
v = v.to_s if Symbol === v
|
392
|
-
pp.text v
|
393
|
-
pp.text '='
|
394
|
-
pp.group(1) {
|
395
|
-
pp.breakable ''
|
396
|
-
pp.pp(self.instance_eval(v))
|
397
|
-
}
|
398
|
-
}
|
399
|
-
}
|
400
|
-
end
|
401
|
-
|
402
384
|
#data premiery w postaci listy [rok, miesiąc, dzień], [rok, miesiąc], [rok], lub pustej listy - jeśli data premiery nie jest znana
|
403
385
|
#(data premiery może nie być znana w przypadku backlisty)
|
404
386
|
def parsed_publishing_date
|
@@ -12,6 +12,9 @@ module Elibri
|
|
12
12
|
#The composite allows additional publishing roles to be introduced without adding new fields.
|
13
13
|
#Each occurrence of the composite must carry a publishing role code and either a name identifier code or a name or both.
|
14
14
|
|
15
|
+
|
16
|
+
include Inspector
|
17
|
+
|
15
18
|
ATTRIBUTES = [
|
16
19
|
:role, :name, :eid
|
17
20
|
]
|
@@ -30,6 +33,10 @@ module Elibri
|
|
30
33
|
@eid = data.at_xpath('xmlns:PublisherIdentifier').at_xpath('xmlns:IDValue').try(:text).try(:to_i)
|
31
34
|
end
|
32
35
|
end
|
36
|
+
|
37
|
+
def inspect_include_fields
|
38
|
+
[:eid, :name]
|
39
|
+
end
|
33
40
|
|
34
41
|
def id
|
35
42
|
Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead."
|
@@ -9,11 +9,13 @@ module Elibri
|
|
9
9
|
|
10
10
|
#from ONIX documentation:
|
11
11
|
#An optional and repeatable group of data elements which together carry text related to the product.
|
12
|
-
|
12
|
+
|
13
|
+
#:nodoc:
|
13
14
|
ATTRIBUTES = [
|
14
15
|
:type, :author, :source_title, :text, :source_url, :type_name
|
15
16
|
]
|
16
17
|
|
18
|
+
#:nodoc:
|
17
19
|
RELATIONS = [
|
18
20
|
:inspect_include_fields
|
19
21
|
]
|
data/lib/elibri_onix/version.rb
CHANGED