elibri_onix 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/FIELDS.rdoc +2 -2
  3. data/lib/elibri_onix.rb +0 -1
  4. data/lib/elibri_onix/external_id.rb +0 -10
  5. data/lib/elibri_onix/onix_3_0/audience_range.rb +3 -12
  6. data/lib/elibri_onix/onix_3_0/collection.rb +0 -0
  7. data/lib/elibri_onix/onix_3_0/contributor.rb +11 -11
  8. data/lib/elibri_onix/onix_3_0/excerpt_info.rb +29 -10
  9. data/lib/elibri_onix/onix_3_0/extent.rb +3 -12
  10. data/lib/elibri_onix/onix_3_0/file_info.rb +0 -5
  11. data/lib/elibri_onix/onix_3_0/header.rb +2 -2
  12. data/lib/elibri_onix/onix_3_0/imprint.rb +1 -1
  13. data/lib/elibri_onix/onix_3_0/language.rb +2 -13
  14. data/lib/elibri_onix/onix_3_0/measure.rb +3 -12
  15. data/lib/elibri_onix/onix_3_0/onix_message.rb +4 -16
  16. data/lib/elibri_onix/onix_3_0/price.rb +11 -11
  17. data/lib/elibri_onix/onix_3_0/product.rb +137 -69
  18. data/lib/elibri_onix/onix_3_0/product_identifier.rb +3 -3
  19. data/lib/elibri_onix/onix_3_0/publisher.rb +4 -11
  20. data/lib/elibri_onix/onix_3_0/publishing_date.rb +3 -3
  21. data/lib/elibri_onix/onix_3_0/related_product.rb +2 -2
  22. data/lib/elibri_onix/onix_3_0/sales_restriction.rb +4 -4
  23. data/lib/elibri_onix/onix_3_0/sender.rb +3 -3
  24. data/lib/elibri_onix/onix_3_0/stock_quantity_coded.rb +2 -2
  25. data/lib/elibri_onix/onix_3_0/supplier.rb +7 -7
  26. data/lib/elibri_onix/onix_3_0/supplier_identifier.rb +3 -3
  27. data/lib/elibri_onix/onix_3_0/supply_detail.rb +15 -10
  28. data/lib/elibri_onix/onix_3_0/supporting_resource.rb +6 -5
  29. data/lib/elibri_onix/onix_3_0/text_content.rb +6 -6
  30. data/lib/elibri_onix/onix_3_0/thema_subject.rb +33 -0
  31. data/lib/elibri_onix/onix_3_0/title_detail.rb +2 -11
  32. data/lib/elibri_onix/onix_3_0/title_element.rb +4 -4
  33. data/lib/elibri_onix/releases.rb +2 -2
  34. data/lib/elibri_onix/version.rb +1 -1
  35. data/test/cover_test.rb +18 -0
  36. data/test/elibri_audiobook_test.rb +33 -0
  37. data/test/elibri_extensions_test.rb +9 -0
  38. data/test/elibri_onix_release_3_0_onix_message_test.rb +4 -18
  39. data/test/elibri_subjects_test.rb +30 -0
  40. data/test/elibri_supporting_resources_test.rb +4 -2
  41. data/test/fixtures/all_possible_tags.xml +1 -1
  42. data/test/fixtures/onix_audiobook_example.xml +261 -0
  43. data/test/fixtures/onix_removed_elibri_extensions.xml +81 -0
  44. data/test/fixtures/onix_subjects_example.xml +110 -0
  45. data/test/fixtures/onix_supporting_resources_example.xml +15 -5
  46. metadata +9 -6
  47. data/lib/elibri_onix/nokogiri_patch.rb +0 -17
  48. data/lib/elibri_onix/onix_3_0/subject.rb +0 -50
  49. data/test/elibri_categories_test.rb +0 -18
  50. data/test/fixtures/onix_categories_example.xml +0 -59
@@ -37,13 +37,24 @@
37
37
  <ResourceLink>http://elibri.com.pl/sciezka/do/pliku.png</ResourceLink>
38
38
  </ResourceVersion>
39
39
  </SupportingResource>
40
- <SupportingResource sourcename="resourceid:668" datestamp="20111201T1809">
41
- <ResourceContentType>15</ResourceContentType>
40
+ <SupportingResource>
41
+ <!--ResourceContentType: WIDGET-->
42
+ <ResourceContentType>16</ResourceContentType>
43
+
44
+ <!--ContentAudience: UNRESTRICTED-->
42
45
  <ContentAudience>00</ContentAudience>
46
+
47
+ <!--ResourceMode: TEXT-->
43
48
  <ResourceMode>04</ResourceMode>
44
49
  <ResourceVersion>
45
- <ResourceForm>02</ResourceForm>
46
- <ResourceLink>http://elibri.com.pl/sciezka/do/pliku.pdf</ResourceLink>
50
+ <!--ResourceForm: EMBEDDABLE_APPLICATION-->
51
+ <ResourceForm>03</ResourceForm>
52
+ <ResourceLink>https://p.elibri.com.pl/book.js?record_reference=0d713d0bc445f63c2c73</ResourceLink>
53
+ <ContentDate>
54
+ <!--ContentDateRole: LAST_UPDATED-->
55
+ <ContentDateRole>17</ContentDateRole>
56
+ <Date dateformat="13">20150715T0755Z</Date>
57
+ </ContentDate>
47
58
  </ResourceVersion>
48
59
  </SupportingResource>
49
60
  </CollateralDetail>
@@ -66,6 +77,5 @@
66
77
  </Territory>
67
78
  </SalesRights>
68
79
  </PublishingDetail>
69
- <elibri:preview_exists>false</elibri:preview_exists>
70
80
  </Product>
71
81
  </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.4.4
4
+ version: 0.5.0
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-04-24 00:00:00.000000000 Z
12
+ date: 2019-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -172,7 +172,6 @@ files:
172
172
  - lib/elibri_onix/external_timestamp.rb
173
173
  - lib/elibri_onix/hash_id.rb
174
174
  - lib/elibri_onix/inspector.rb
175
- - lib/elibri_onix/nokogiri_patch.rb
176
175
  - lib/elibri_onix/onix_3_0/audience_range.rb
177
176
  - lib/elibri_onix/onix_3_0/collection.rb
178
177
  - lib/elibri_onix/onix_3_0/contributor.rb
@@ -193,18 +192,19 @@ files:
193
192
  - lib/elibri_onix/onix_3_0/sales_restriction.rb
194
193
  - lib/elibri_onix/onix_3_0/sender.rb
195
194
  - lib/elibri_onix/onix_3_0/stock_quantity_coded.rb
196
- - lib/elibri_onix/onix_3_0/subject.rb
197
195
  - lib/elibri_onix/onix_3_0/supplier.rb
198
196
  - lib/elibri_onix/onix_3_0/supplier_identifier.rb
199
197
  - lib/elibri_onix/onix_3_0/supply_detail.rb
200
198
  - lib/elibri_onix/onix_3_0/supporting_resource.rb
201
199
  - lib/elibri_onix/onix_3_0/text_content.rb
200
+ - lib/elibri_onix/onix_3_0/thema_subject.rb
202
201
  - lib/elibri_onix/onix_3_0/title_detail.rb
203
202
  - lib/elibri_onix/onix_3_0/title_element.rb
204
203
  - lib/elibri_onix/releases.rb
205
204
  - lib/elibri_onix/version.rb
205
+ - test/cover_test.rb
206
206
  - test/elibri_audience_range_test.rb
207
- - test/elibri_categories_test.rb
207
+ - test/elibri_audiobook_test.rb
208
208
  - test/elibri_contributors_test.rb
209
209
  - test/elibri_ebook_files_test.rb
210
210
  - test/elibri_edition_test.rb
@@ -224,6 +224,7 @@ files:
224
224
  - test/elibri_related_products_test.rb
225
225
  - test/elibri_sale_restrictions_test.rb
226
226
  - test/elibri_series_memberships_test.rb
227
+ - test/elibri_subjects_test.rb
227
228
  - test/elibri_supporting_resources_test.rb
228
229
  - test/elibri_territorial_rights_test.rb
229
230
  - test/elibri_texts_test.rb
@@ -232,8 +233,8 @@ files:
232
233
  - test/fixtures/old_dialect.xml
233
234
  - test/fixtures/onix_announced_product_example.xml
234
235
  - test/fixtures/onix_audience_range_example.xml
236
+ - test/fixtures/onix_audiobook_example.xml
235
237
  - test/fixtures/onix_audiobook_extent_example.xml
236
- - test/fixtures/onix_categories_example.xml
237
238
  - test/fixtures/onix_collective_work_example.xml
238
239
  - test/fixtures/onix_contributors_example.xml
239
240
  - test/fixtures/onix_ebook_extent_example.xml
@@ -252,8 +253,10 @@ files:
252
253
  - test/fixtures/onix_publisher_info_example.xml
253
254
  - test/fixtures/onix_record_identifiers_example.xml
254
255
  - test/fixtures/onix_related_products_example.xml
256
+ - test/fixtures/onix_removed_elibri_extensions.xml
255
257
  - test/fixtures/onix_sale_restrictions_example.xml
256
258
  - test/fixtures/onix_series_memberships_example.xml
259
+ - test/fixtures/onix_subjects_example.xml
257
260
  - test/fixtures/onix_supporting_resources_example.xml
258
261
  - test/fixtures/onix_territorial_rights_example.xml
259
262
  - test/fixtures/onix_texts_example.xml
@@ -1,17 +0,0 @@
1
- module Nokogiri
2
- module XML
3
- class Node
4
- alias_method :orig_xpath, :xpath
5
-
6
- def xpath(*paths)
7
- unless Nokogiri.uses_libxml?
8
- paths.each do |path|
9
- path.gsub!(/xmlns:/, ' :') if path.is_a?(String)
10
- end
11
- end
12
- orig_xpath(*paths)
13
- end
14
-
15
- end
16
- end
17
- end
@@ -1,50 +0,0 @@
1
-
2
-
3
- module Elibri
4
- module ONIX
5
- module Release_3_0
6
-
7
- class Subject
8
-
9
- #from ONIX documentation:
10
- #An optional and repeatable group of data elements which together specify a subject classification or subject heading.
11
-
12
- include HashId
13
-
14
-
15
- ATTRIBUTES = [
16
- :scheme_identifier, :scheme_name, :scheme_version, :code, :heading_text, :main_subject
17
- ]
18
-
19
- attr_accessor :scheme_identifier, :scheme_name, :scheme_version, :code, :heading_text, :main_subject, :to_xml
20
-
21
- RELATIONS = []
22
-
23
- def initialize(data)
24
- @to_xml = data.to_s
25
- @scheme_identifier = data.xpath('xmlns:SubjectSchemeIdentifier').try(:text).try(:to_i)
26
- @scheme_name = data.xpath('xmlns:SubjectSchemeName').try(:text)
27
- @scheme_version = data.xpath('xmlns:SubjectSchemeVersion').try(:text)
28
- @code = data.xpath('xmlns:SubjectCode').try(:text)
29
- @heading_text = data.xpath('xmlns:SubjectHeadingText').try(:text)
30
- @main_subject = data.xpath('xmlns:MainSubject').blank? ? nil : ''
31
- end
32
-
33
- def main_subject?
34
- @main_subject == ''
35
- end
36
-
37
- # def eid
38
- # @code
39
- # end
40
-
41
- def id
42
- Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead."
43
- eid
44
- end
45
-
46
- end
47
-
48
- end
49
- end
50
- end
@@ -1,18 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'helper'
4
-
5
- describe Elibri::ONIX::Release_3_0::ONIXMessage do
6
-
7
- it "should be able to parse categories informations stored in Elibri" do
8
- product = load_fixture("onix_categories_example.xml")
9
- assert_equal 2, product.subjects.size
10
-
11
- assert_equal "1110", product.subjects[0].code
12
- assert_equal "1110", product.elibri_product_category1_id
13
- assert_equal "Historia / II Wojna Światowa / Ruch oporu", product.subjects[0].heading_text
14
-
15
- assert_equal "491", product.elibri_product_category2_id
16
- end
17
-
18
- end
@@ -1,59 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <ONIXMessage release="3.0" xmlns:elibri="http://elibri.com.pl/ns/extensions" xmlns="http://ns.editeur.org/onix/3.0/reference">
3
- <elibri:Dialect>3.0.1</elibri:Dialect>
4
- <Header>
5
- <Sender>
6
- <SenderName>Elibri.com.pl</SenderName>
7
- <ContactName>Tomasz Meka</ContactName>
8
- <EmailAddress>kontakt@elibri.com.pl</EmailAddress>
9
- </Sender>
10
- <SentDateTime>20120501</SentDateTime>
11
- </Header>
12
- <Product>
13
- <RecordReference>fdb8fa072be774d97a97</RecordReference>
14
- <NotificationType>03</NotificationType>
15
- <ProductIdentifier>
16
- <ProductIDType>15</ProductIDType>
17
- <IDValue>9788324799992</IDValue>
18
- </ProductIdentifier>
19
- <DescriptiveDetail>
20
- <ProductComposition>00</ProductComposition>
21
- <ProductForm>BA</ProductForm>
22
- <TitleDetail>
23
- <TitleType>01</TitleType>
24
- <TitleElement>
25
- <TitleElementLevel>01</TitleElementLevel>
26
- <TitleText>Nielegalni</TitleText>
27
- </TitleElement>
28
- </TitleDetail>
29
- <Subject>
30
- <MainSubject/>
31
- <SubjectSchemeIdentifier>24</SubjectSchemeIdentifier>
32
- <SubjectSchemeName>elibri.com.pl</SubjectSchemeName>
33
- <SubjectSchemeVersion>1.0</SubjectSchemeVersion>
34
- <SubjectCode>1110</SubjectCode>
35
- <SubjectHeadingText>Historia / II Wojna Światowa / Ruch oporu</SubjectHeadingText>
36
- </Subject>
37
- <Subject>
38
- <SubjectSchemeIdentifier>24</SubjectSchemeIdentifier>
39
- <SubjectSchemeName>elibri.com.pl</SubjectSchemeName>
40
- <SubjectSchemeVersion>1.0</SubjectSchemeVersion>
41
- <SubjectCode>491</SubjectCode>
42
- <SubjectHeadingText>Szkoła i nauczanie / Lektury szkolne z opracowaniami</SubjectHeadingText>
43
- </Subject>
44
- </DescriptiveDetail>
45
- <PublishingDetail>
46
- <Publisher>
47
- <PublishingRole>01</PublishingRole>
48
- <PublisherIdentifier>
49
- <PublisherIDType>01</PublisherIDType>
50
- <IDTypeName>ElibriPublisherCode</IDTypeName>
51
- <IDValue>11</IDValue>
52
- </PublisherIdentifier>
53
- <PublisherName>GREG</PublisherName>
54
- </Publisher>
55
- <PublishingStatus>04</PublishingStatus>
56
- </PublishingDetail>
57
- <elibri:preview_exists>false</elibri:preview_exists>
58
- </Product>
59
- </ONIXMessage>