elibri_onix 0.5.17 → 0.5.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elibri_onix/onix_3_0/product.rb +6 -4
- data/lib/elibri_onix/onix_3_0/sales_restriction.rb +10 -6
- data/lib/elibri_onix/version.rb +1 -1
- data/test/elibri_exclusive_distributor_test.rb +11 -0
- data/test/elibri_formats_and_protection_test.rb +2 -2
- data/test/elibri_sale_restrictions_test.rb +1 -1
- data/test/fixtures/onix_epub_details_example.xml +1 -1
- data/test/fixtures/onix_exclusive_distributor_example.xml +62 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37003b2ae4622d77476776909412cc7a9d48b4e25363244a8d3c45fcd6aaffe3
|
4
|
+
data.tar.gz: 65ba9e79b43513d0d26840ec1599f0f605faf66a3ec8df58882ff7a7e4e5a49c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9964327c8934259778d663562bf814f39248877cf4b2eb97cdf85680d3306100664d8822ca8b754e1866b8d8db889c8ef11db4b90b97cc53562b52397b57127
|
7
|
+
data.tar.gz: b10744c7de5f78ae9e7b57dd3fd835949fc8b0a5fc2c772618650e910e8e92f4cca5ac6e97e2eb77fc5c088f8c8f4e86e1f3d0a96baf674015b2404e12b5c8d2
|
@@ -454,7 +454,12 @@ module Elibri
|
|
454
454
|
else
|
455
455
|
@sale_restricted_to_poland = false
|
456
456
|
end
|
457
|
+
end
|
457
458
|
|
459
|
+
def exclusive_distributor_onix_code
|
460
|
+
if @sales_restrictions.size > 0
|
461
|
+
@sales_restrictions[0].outlet_code
|
462
|
+
end
|
458
463
|
end
|
459
464
|
|
460
465
|
def sales_restrictions?
|
@@ -532,10 +537,7 @@ module Elibri
|
|
532
537
|
#data premiery w postaci listy [rok, miesiąc, dzień], [rok, miesiąc], [rok], lub pustej listy - jeśli data premiery nie jest znana
|
533
538
|
#(data premiery może nie być znana w przypadku backlisty)
|
534
539
|
def parsed_publishing_date
|
535
|
-
if
|
536
|
-
date = sales_restrictions[0].end_date
|
537
|
-
[date.year, date.month, date.day]
|
538
|
-
elsif publishing_date
|
540
|
+
if publishing_date
|
539
541
|
publishing_date.parsed
|
540
542
|
else
|
541
543
|
[]
|
@@ -7,25 +7,29 @@ module Elibri
|
|
7
7
|
|
8
8
|
class SalesRestriction
|
9
9
|
|
10
|
-
#from ONIX documentation:
|
10
|
+
#from ONIX documentation:
|
11
11
|
#A group of data elements which together identify a non-territorial sales restriction which a publisher applies to a product.
|
12
12
|
#Optional and repeatable.
|
13
13
|
|
14
14
|
include HashId
|
15
|
-
|
15
|
+
|
16
16
|
ATTRIBUTES = [
|
17
17
|
:type, :outlet_name, :end_date
|
18
18
|
]
|
19
|
-
|
19
|
+
|
20
20
|
RELATIONS = []
|
21
|
-
|
22
|
-
attr_accessor :type, :outlet_name, :end_date, :to_xml
|
23
|
-
|
21
|
+
|
22
|
+
attr_accessor :type, :outlet_name, :outlet_code, :end_date, :to_xml
|
23
|
+
|
24
24
|
def initialize(data)
|
25
25
|
@to_xml = data.to_s
|
26
26
|
@type = data.at_css('SalesRestrictionType').try(:text).try(:to_i)
|
27
27
|
if data.at_css('SalesOutlet')
|
28
28
|
@outlet_name = data.at_css('SalesOutlet').at_css('SalesOutletName').try(:text)
|
29
|
+
outlet_id_struct = data.at_css('SalesOutlet').at_css('SalesOutletIdentifier')
|
30
|
+
if outlet_id_struct && outlet_id_struct.at_css("SalesOutletIDType").try(:text) == "03"
|
31
|
+
@outlet_code = outlet_id_struct.at_css("IDValue").try(:text)
|
32
|
+
end
|
29
33
|
end
|
30
34
|
@end_date = Date.parse(data.at_css('EndDate').try(:text)) if data.at_css('EndDate')
|
31
35
|
end
|
data/lib/elibri_onix/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
4
|
+
|
5
|
+
it "should be able to parse information about exclusive distrubution restriction" do
|
6
|
+
product = load_fixture("onix_exclusive_distributor_example.xml")
|
7
|
+
assert product.sales_restrictions?
|
8
|
+
assert_equal "EMP", product.exclusive_distributor_onix_code
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -7,7 +7,7 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
|
7
7
|
|
8
8
|
product = load_fixture("onix_epub_details_example.xml")
|
9
9
|
assert_equal ["EPUB", "MOBI"], product.digital_formats
|
10
|
-
assert_equal "
|
11
|
-
assert_equal "
|
10
|
+
assert_equal "watermark", product.technical_protection
|
11
|
+
assert_equal "02", product.technical_protection_onix_code
|
12
12
|
end
|
13
13
|
end
|
@@ -5,7 +5,7 @@ describe Elibri::ONIX::Release_3_0::ONIXMessage do
|
|
5
5
|
it "should be able to parse information about sales restrictions" do
|
6
6
|
product = load_fixture("onix_sale_restrictions_example.xml")
|
7
7
|
assert product.sales_restrictions?
|
8
|
-
assert_equal
|
8
|
+
assert_equal Date.new(2012, 7, 22), product.sales_restrictions[0].end_date
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<ProductForm>EA</ProductForm>
|
22
22
|
<ProductFormDetail>E101</ProductFormDetail>
|
23
23
|
<ProductFormDetail>E127</ProductFormDetail>
|
24
|
-
<EpubTechnicalProtection>
|
24
|
+
<EpubTechnicalProtection>02</EpubTechnicalProtection>
|
25
25
|
<TitleDetail>
|
26
26
|
<TitleType>01</TitleType>
|
27
27
|
<TitleElement>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ONIXMessage release="3.0" xmlns="http://ns.editeur.org/onix/3.0/reference">
|
3
|
+
<Header>
|
4
|
+
<Sender>
|
5
|
+
<SenderName>Elibri.com.pl</SenderName>
|
6
|
+
<ContactName>Tomasz Meka</ContactName>
|
7
|
+
<EmailAddress>kontakt@elibri.com.pl</EmailAddress>
|
8
|
+
</Sender>
|
9
|
+
<SentDateTime>20111111</SentDateTime>
|
10
|
+
</Header>
|
11
|
+
<Product>
|
12
|
+
<RecordReference>fdb8fa072be774d97a97</RecordReference>
|
13
|
+
<NotificationType>03</NotificationType>
|
14
|
+
<ProductIdentifier>
|
15
|
+
<ProductIDType>15</ProductIDType>
|
16
|
+
<IDValue>9788324799992</IDValue>
|
17
|
+
</ProductIdentifier>
|
18
|
+
<DescriptiveDetail>
|
19
|
+
<ProductComposition>00</ProductComposition>
|
20
|
+
<ProductForm>EA</ProductForm>
|
21
|
+
<TitleDetail>
|
22
|
+
<TitleType>01</TitleType>
|
23
|
+
<TitleElement>
|
24
|
+
<TitleElementLevel>01</TitleElementLevel>
|
25
|
+
<TitleText>Nielegalni</TitleText>
|
26
|
+
</TitleElement>
|
27
|
+
</TitleDetail>
|
28
|
+
</DescriptiveDetail>
|
29
|
+
<PublishingDetail>
|
30
|
+
<Publisher>
|
31
|
+
<PublishingRole>01</PublishingRole>
|
32
|
+
<PublisherIdentifier>
|
33
|
+
<PublisherIDType>01</PublisherIDType>
|
34
|
+
<IDTypeName>ElibriPublisherCode</IDTypeName>
|
35
|
+
<IDValue>11</IDValue>
|
36
|
+
</PublisherIdentifier>
|
37
|
+
<PublisherName>GREG</PublisherName>
|
38
|
+
</Publisher>
|
39
|
+
<CityOfPublication>Warszawa</CityOfPublication>
|
40
|
+
<PublishingStatus>04</PublishingStatus>
|
41
|
+
<PublishingDate>
|
42
|
+
<PublishingDateRole>01</PublishingDateRole>
|
43
|
+
<Date dateformat="00">20120712</Date>
|
44
|
+
</PublishingDate>
|
45
|
+
<SalesRights>
|
46
|
+
<SalesRightsType>01</SalesRightsType>
|
47
|
+
<Territory>
|
48
|
+
<RegionsIncluded>WORLD</RegionsIncluded>
|
49
|
+
</Territory>
|
50
|
+
</SalesRights>
|
51
|
+
<SalesRestriction>
|
52
|
+
<SalesRestrictionType>04</SalesRestrictionType>
|
53
|
+
<SalesOutlet>
|
54
|
+
<SalesOutletIdentifier>
|
55
|
+
<SalesOutletIDType>03</SalesOutletIDType>
|
56
|
+
<IDValue>EMP</IDValue>
|
57
|
+
</SalesOutletIdentifier>
|
58
|
+
</SalesOutlet>
|
59
|
+
</SalesRestriction>
|
60
|
+
</PublishingDetail>
|
61
|
+
</Product>
|
62
|
+
</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.19
|
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:
|
12
|
+
date: 2024-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- test/elibri_contributors_test.rb
|
209
209
|
- test/elibri_ebook_files_test.rb
|
210
210
|
- test/elibri_edition_test.rb
|
211
|
+
- test/elibri_exclusive_distributor_test.rb
|
211
212
|
- test/elibri_extensions_test.rb
|
212
213
|
- test/elibri_extent_test.rb
|
213
214
|
- test/elibri_formats_and_protection_test.rb
|
@@ -248,6 +249,7 @@ files:
|
|
248
249
|
- test/fixtures/onix_edition_example.xml
|
249
250
|
- test/fixtures/onix_elibri_extensions_example.xml
|
250
251
|
- test/fixtures/onix_epub_details_example.xml
|
252
|
+
- test/fixtures/onix_exclusive_distributor_example.xml
|
251
253
|
- test/fixtures/onix_languages_example.xml
|
252
254
|
- test/fixtures/onix_measurement_example.xml
|
253
255
|
- test/fixtures/onix_no_contributors_example.xml
|
@@ -290,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
292
|
- !ruby/object:Gem::Version
|
291
293
|
version: '0'
|
292
294
|
requirements: []
|
293
|
-
rubygems_version: 3.
|
295
|
+
rubygems_version: 3.1.6
|
294
296
|
signing_key:
|
295
297
|
specification_version: 4
|
296
298
|
summary: EDItEUR ONIX format subset implementation used in Elibri publication system
|