elibri_onix 0.5.17 → 0.5.18

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: d06b0bd4bdbb02d2ff2383d0bbda53df5053c5cb72cb05239751be6333a35d12
4
- data.tar.gz: 6e8e96e0555ff9b9121159342dcdbf38f75fc6d62d468ab16ddbfabe10b9ecff
3
+ metadata.gz: ca0645c584580d719c89e9b25ff1908512fe60640860f8db37d1a9f38e27f46f
4
+ data.tar.gz: ee00d482ce6d81af64b2d0298dad3246defe9a95e254b3f98b6c07b3641b1545
5
5
  SHA512:
6
- metadata.gz: cbfebade21b11fc42a93b821617eca9a435b14a3dc1a032597c4296a588b2813ef025ac1e5f39738083052ed93041be5378c4acda4490cde209cc8f02f5e6b97
7
- data.tar.gz: ec612758dbcaa6d29f24c782978de4a91a33fb899081a0e766bae7c3ab4d3e49426a68d4609361386773281bebce2d2d5535fb3678a3cf2877d12402e93cae3e
6
+ metadata.gz: 5d9f3bc6101130b9dba2636d17513d46333e178cb565a3bd241bfd54452ee0fad96f1e64a1cf1e079ad0bdfcddb07a1cc878804991663498f9c5bfc2f7be263d
7
+ data.tar.gz: 62a3deb1650b9fbee4e97a471db03737a1d0c992b6cc14318c82742d088624419d13cdc06d154a80034782ea6c156dbdf805c3e0886cfb31651d8a885648cb58
@@ -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?
@@ -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
@@ -2,7 +2,7 @@ module Elibri
2
2
  module ONIX
3
3
  z = $VERBOSE
4
4
  $VERBOSE = nil
5
- VERSION = "0.5.17"
5
+ VERSION = "0.5.18"
6
6
  Version = VERSION
7
7
  $VERBOSE = z
8
8
  end
@@ -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 "DRM", product.technical_protection
11
- assert_equal "01", product.technical_protection_onix_code
10
+ assert_equal "watermark", product.technical_protection
11
+ assert_equal "02", product.technical_protection_onix_code
12
12
  end
13
13
  end
@@ -21,7 +21,7 @@
21
21
  <ProductForm>EA</ProductForm>
22
22
  <ProductFormDetail>E101</ProductFormDetail>
23
23
  <ProductFormDetail>E127</ProductFormDetail>
24
- <EpubTechnicalProtection>01</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.17
4
+ version: 0.5.18
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: 2022-05-23 00:00:00.000000000 Z
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.0.1
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