elibri_onix 0.5.6 → 0.5.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff669eaa352e69ad1d7bc7e8261db9a2f478793a2f9fc0a2c9bd07efc665ccd2
|
4
|
+
data.tar.gz: f7a6a113cf206e37fbf8e135d3fc8367c6959a1c93f60c1c2a4d0db99f25c814
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d76b9732944ec1e3835e12cc4f8ffff8c9e988d9105b45d6fd3d1982bc0935b22db900e595a492330149c144a41570ca5baeebd1220bb4710e0d4554041a21
|
7
|
+
data.tar.gz: efa8683c0d127665652caa2abc96d4091c2653267125796d2c3d066e4b2d9d1f85adfc43e2d4ad55621e78ead2925ae9d8c1dc36f73b9d7db0576b79893751d8
|
@@ -6,7 +6,7 @@ module Elibri
|
|
6
6
|
#class representing whole ONIX response from eLibri server
|
7
7
|
class ONIXMessage
|
8
8
|
include Inspector
|
9
|
-
|
9
|
+
|
10
10
|
#list of all products returned in this mnessage
|
11
11
|
attr_accessor :products
|
12
12
|
|
@@ -18,14 +18,17 @@ module Elibri
|
|
18
18
|
|
19
19
|
#returned message header - Elibri::ONIX::Release_3_0::Header
|
20
20
|
attr_accessor :header
|
21
|
-
|
21
|
+
|
22
|
+
# attributes of root ONIXMessage node
|
23
|
+
attr_reader :attributes
|
24
|
+
|
22
25
|
include HashId
|
23
|
-
|
26
|
+
|
24
27
|
#:nodoc:
|
25
28
|
ATTRIBUTES = [
|
26
29
|
:release, :header
|
27
30
|
]
|
28
|
-
|
31
|
+
|
29
32
|
#:nodoc:
|
30
33
|
RELATIONS = [
|
31
34
|
:products
|
@@ -34,15 +37,31 @@ module Elibri
|
|
34
37
|
def inspect_include_fields
|
35
38
|
[:header, :release, :products]
|
36
39
|
end
|
37
|
-
|
40
|
+
|
38
41
|
def initialize(xml, *initialization_args)
|
39
42
|
@to_xml = xml.to_s
|
40
43
|
xml = Nokogiri::XML(xml) unless xml.is_a?(Nokogiri::XML::Document)
|
41
44
|
onix_message = xml.children.first
|
45
|
+
@attributes = extract_attributes(onix_message.attribute_nodes)
|
42
46
|
@release = onix_message['release']
|
43
47
|
@header = Header.new(onix_message.at_css('Header')) if onix_message.at_css('Header')
|
44
48
|
@products = onix_message.css('Product').map { |product_node| Product.new(product_node) }
|
45
49
|
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def extract_attributes(attr_nodes)
|
54
|
+
attr_nodes.each_with_object({}) do |attr, memo|
|
55
|
+
memo.merge! attribute_to_hash(attr)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def attribute_to_hash(attr)
|
60
|
+
name = attr.name
|
61
|
+
namespace = attr.namespace.prefix if attr.namespace
|
62
|
+
key = [namespace, name].compact.join(":")
|
63
|
+
{ key => attr.to_s }
|
64
|
+
end
|
46
65
|
end
|
47
66
|
|
48
67
|
end
|
data/lib/elibri_onix/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
|
5
|
+
describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
6
|
+
|
7
|
+
it "should be able to parse all attributes supported in Elibri" do
|
8
|
+
xml_string = File.read File.join(File.dirname(__FILE__), "..", "test", "fixtures", "eisbn-pl-sample.xml")
|
9
|
+
|
10
|
+
onix = Elibri::ONIX::Release_3_0::ONIXMessage.new(xml_string)
|
11
|
+
assert_equal '3.0', onix.release
|
12
|
+
assert_equal({
|
13
|
+
'release' => '3.0',
|
14
|
+
'eisbn:nextPage' => 'https://e-isbn.pl/IsbnWeb/api.xml?idFrom=1401255&max=1'}, onix.attributes)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ONIXMessage release="3.0"
|
3
|
+
eisbn:nextPage="https://e-isbn.pl/IsbnWeb/api.xml?idFrom=1401255&max=1"
|
4
|
+
xmlns:schemaLocation="http://ns.editeur.org/onix/3.0/reference https://e-isbn.pl/IsbnWeb/schemas/ONIX_BookProduct_3.0_reference.xsd"
|
5
|
+
xmlns:eisbn="http://e-isbn.pl"
|
6
|
+
xmlns="http://ns.editeur.org/onix/3.0/reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
7
|
+
<Header>
|
8
|
+
<Sender>
|
9
|
+
<SenderName>Serwis e-ISBN</SenderName>
|
10
|
+
<ContactName>Dorota Cymer, tel. +4822608608241</ContactName>
|
11
|
+
<EmailAddress>d.cymer@e-isbn.pl</EmailAddress>
|
12
|
+
</Sender>
|
13
|
+
<MessageNumber>2099</MessageNumber>
|
14
|
+
<SentDateTime>20191230T1222+0100</SentDateTime>
|
15
|
+
<MessageNote>API e-ISBN</MessageNote>
|
16
|
+
<DefaultLanguageOfText>pol</DefaultLanguageOfText>
|
17
|
+
</Header>
|
18
|
+
<Product datestamp="20161025">
|
19
|
+
<RecordReference>pl-eisbn-1401255</RecordReference>
|
20
|
+
<NotificationType>03</NotificationType>
|
21
|
+
<RecordSourceType>01</RecordSourceType>
|
22
|
+
<RecordSourceName>Stowarzyszenie Historyczno-Kulturalne TERRA INCOGNITA w Chojnie</RecordSourceName>
|
23
|
+
<ProductIdentifier>
|
24
|
+
<ProductIDType>15</ProductIDType>
|
25
|
+
<IDValue>9788394063641</IDValue>
|
26
|
+
</ProductIdentifier>
|
27
|
+
<ProductIdentifier>
|
28
|
+
<ProductIDType>01</ProductIDType>
|
29
|
+
<IDTypeName>numer rekordu Biblioteki Narodowej</IDTypeName>
|
30
|
+
<IDValue>b38370232</IDValue>
|
31
|
+
</ProductIdentifier>
|
32
|
+
<DescriptiveDetail>
|
33
|
+
<ProductComposition>00</ProductComposition>
|
34
|
+
<ProductForm>BA</ProductForm>
|
35
|
+
<TitleDetail>
|
36
|
+
<TitleType>01</TitleType>
|
37
|
+
<TitleElement>
|
38
|
+
<TitleElementLevel>01</TitleElementLevel>
|
39
|
+
<TitleText>Innowacja i tradycja</TitleText>
|
40
|
+
<Subtitle>Henryk Brunsberg i późnogotycka architektura ceglana Pomorza i Brandenburgii /</Subtitle>
|
41
|
+
</TitleElement>
|
42
|
+
</TitleDetail>
|
43
|
+
<Contributor>
|
44
|
+
<SequenceNumber>1</SequenceNumber>
|
45
|
+
<ContributorRole>A01</ContributorRole>
|
46
|
+
<PersonNameInverted>Stowarzyszenie Historyczno-Kulturalne "Terra Incognita" (Chojna)</PersonNameInverted>
|
47
|
+
</Contributor>
|
48
|
+
<Contributor>
|
49
|
+
<SequenceNumber>2</SequenceNumber>
|
50
|
+
<ContributorRole>B06</ContributorRole>
|
51
|
+
<PersonNameInverted>Lindenhayn, Agnieszka</PersonNameInverted>
|
52
|
+
</Contributor>
|
53
|
+
<Contributor>
|
54
|
+
<SequenceNumber>3</SequenceNumber>
|
55
|
+
<ContributorRole>B01</ContributorRole>
|
56
|
+
<PersonNameInverted>Gierke, Michał</PersonNameInverted>
|
57
|
+
</Contributor>
|
58
|
+
<EditionType>NED</EditionType>
|
59
|
+
<EditionNumber>1</EditionNumber>
|
60
|
+
<Language>
|
61
|
+
<LanguageRole>01</LanguageRole>
|
62
|
+
<LanguageCode>pol</LanguageCode>
|
63
|
+
</Language>
|
64
|
+
<Subject>
|
65
|
+
<SubjectSchemeIdentifier>09</SubjectSchemeIdentifier>
|
66
|
+
<SubjectCode>72.033.5(438)</SubjectCode>
|
67
|
+
</Subject>
|
68
|
+
<Subject>
|
69
|
+
<SubjectSchemeIdentifier>09</SubjectSchemeIdentifier>
|
70
|
+
<SubjectCode>72.033.5(430)</SubjectCode>
|
71
|
+
</Subject>
|
72
|
+
<Subject>
|
73
|
+
<SubjectSchemeIdentifier>20</SubjectSchemeIdentifier>
|
74
|
+
<SubjectCode>Architektura niemiecka</SubjectCode>
|
75
|
+
</Subject>
|
76
|
+
<Subject>
|
77
|
+
<SubjectSchemeIdentifier>20</SubjectSchemeIdentifier>
|
78
|
+
<SubjectCode>Brandenburgia (Niemcy)</SubjectCode>
|
79
|
+
</Subject>
|
80
|
+
<Subject>
|
81
|
+
<SubjectSchemeIdentifier>20</SubjectSchemeIdentifier>
|
82
|
+
<SubjectCode>Pomorze Zachodnie</SubjectCode>
|
83
|
+
</Subject>
|
84
|
+
</DescriptiveDetail>
|
85
|
+
<PublishingDetail>
|
86
|
+
<Imprint>
|
87
|
+
<ImprintName>Stowarzyszenie Historyczno-Kulturalne Terra Incognita ;</ImprintName>
|
88
|
+
</Imprint>
|
89
|
+
<Publisher>
|
90
|
+
<PublishingRole>01</PublishingRole>
|
91
|
+
<PublisherName>Stowarzyszenie Historyczno-Kulturalne TERRA INCOGNITA w Chojnie</PublisherName>
|
92
|
+
</Publisher>
|
93
|
+
<CityOfPublication>Chojna :</CityOfPublication>
|
94
|
+
<CountryOfPublication>PL</CountryOfPublication>
|
95
|
+
<PublishingDate>
|
96
|
+
<PublishingDateRole>01</PublishingDateRole>
|
97
|
+
<Date>20151230</Date>
|
98
|
+
</PublishingDate>
|
99
|
+
<PublishingDate>
|
100
|
+
<PublishingDateRole>09</PublishingDateRole>
|
101
|
+
<Date>20151230</Date>
|
102
|
+
</PublishingDate>
|
103
|
+
</PublishingDetail>
|
104
|
+
</Product>
|
105
|
+
</ONIXMessage>
|
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.7
|
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-
|
12
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- test/elibri_languages_test.rb
|
215
215
|
- test/elibri_licence_information_test.rb
|
216
216
|
- test/elibri_measurement_test.rb
|
217
|
+
- test/elibri_onix_message_attributes_test.rb
|
217
218
|
- test/elibri_onix_release_3_0_onix_message_test.rb
|
218
219
|
- test/elibri_onix_test.rb
|
219
220
|
- test/elibri_product_form_test.rb
|
@@ -229,6 +230,7 @@ files:
|
|
229
230
|
- test/elibri_texts_test.rb
|
230
231
|
- test/elibri_titles_test.rb
|
231
232
|
- test/fixtures/all_possible_tags.xml
|
233
|
+
- test/fixtures/eisbn-pl-sample.xml
|
232
234
|
- test/fixtures/old_dialect.xml
|
233
235
|
- test/fixtures/onix_announced_product_example.xml
|
234
236
|
- test/fixtures/onix_audience_range_example.xml
|
@@ -282,8 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
284
|
- !ruby/object:Gem::Version
|
283
285
|
version: '0'
|
284
286
|
requirements: []
|
285
|
-
|
286
|
-
rubygems_version: 2.7.9
|
287
|
+
rubygems_version: 3.0.3
|
287
288
|
signing_key:
|
288
289
|
specification_version: 4
|
289
290
|
summary: EDItEUR ONIX format subset implementation used in Elibri publication system
|