elibri_onix_dict 0.0.66 → 0.0.75

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: 130236ec78522912c651c18cfb7d71d0fe19c68896f5a23eaa4c064010c89b07
4
- data.tar.gz: 5eb1062efaae76628f79828e397a9e5843bd9e1b1ddd70d98f3af34cb77c2112
3
+ metadata.gz: a57f85ebe14f4fc5c65326b56d3a76d513db78565967d17563b976a41d461625
4
+ data.tar.gz: 82b6c5706307c15895d046e618c7d8c7e7b07274d9cbc3599e1fd8cf14913214
5
5
  SHA512:
6
- metadata.gz: 1c109bc6b2e55188e23fca526a85ca5b6256f2465f8ed31b389ec6d07c824a61285afe9c088af49690955d390367d7109c9f81a0fe51acf0c9eb5eacec4dec03
7
- data.tar.gz: 41308c3249f9140d7ecc8242c860f25bd8ff9604a7d79793181ede01f00870022b96f1bfac532d938752fece730ed6811826404e2e04e72e91ac8bd5c75e70f5
6
+ metadata.gz: 16ddd260b01dfddafd9ebd6bbf5d0229cb8b13221118aa30df26677ae465e65c70392550ea64989a35b2434065148a23515ece62c71588f2796149d7c71b6da3
7
+ data.tar.gz: dace9df6589c15d8f8ccbae57425081a134d3dd1585f3bacf54028e35be36432b515a78a1071c5bb6bbca06e74c185a8f3b2ee141104843ebb720476b5b0f632
@@ -8,23 +8,27 @@ module Elibri
8
8
 
9
9
  # id to wartość jaka będzie zapisana w polu cover_type_id dla produktu.
10
10
  # name to nazwa w obrębie Elibri
11
- attr_reader :id, :name, :product_form, :product_form_detail
11
+ attr_reader :id, :key, :product_form, :product_form_detail
12
12
 
13
13
 
14
14
  conf = File.expand_path(File.join(File.dirname(__FILE__), "cover_types.yml"))
15
- ALL = YAML::load_file(conf).sort_by(&:name)
15
+ ALL = YAML::load_file(conf)
16
16
 
17
17
  HARDBACK = 8
18
18
  PLASTIC = 6
19
19
  PAPERBACK = 4
20
20
 
21
+ def name
22
+ I18n::t("products.cover_type.#{key}")
23
+ end
24
+
21
25
  def self.find(cover_type_id)
22
26
  self.all.find {|cover_type| cover_type.id == cover_type_id }
23
27
  end
24
28
 
25
29
  def self.determine_cover_type(product_form, product_form_detail)
26
30
  matching_cover = all.find { |cover| cover.product_form == product_form && cover.product_form_detail == product_form_detail }
27
- matching_cover.name if matching_cover
31
+ I18n::t("products.cover_type.#{matching_cover.key}") if matching_cover
28
32
  end
29
33
 
30
34
  # Znajdź w słowniku typ okładki, którego nazwa jest najbardziej podobna do podanego stringu.
@@ -1,47 +1,47 @@
1
1
 
2
- ---
2
+ ---
3
3
  - !ruby/object:Elibri::ONIX::Dict::CoverType
4
4
  id: 1
5
- name: gąbka
5
+ key: foam
6
6
  product_form: BP
7
- product_form_detail:
7
+ product_form_detail:
8
8
  - !ruby/object:Elibri::ONIX::Dict::CoverType
9
9
  id: 4
10
- name: miękka
10
+ key: paperback
11
11
  product_form: BC
12
12
  product_form_detail:
13
13
  - !ruby/object:Elibri::ONIX::Dict::CoverType
14
14
  id: 5
15
- name: miękka ze skrzydełkami
15
+ key: paperback_with_flaps
16
16
  product_form: BC
17
17
  product_form_detail: B504
18
18
  - !ruby/object:Elibri::ONIX::Dict::CoverType
19
19
  id: 6
20
- name: plastikowa
20
+ key: plastic
21
21
  product_form: BB
22
22
  product_form_detail: B413
23
23
  - !ruby/object:Elibri::ONIX::Dict::CoverType
24
24
  id: 7
25
- name: skórzana
25
+ key: leather
26
26
  product_form: BG
27
27
  product_form_detail:
28
28
  - !ruby/object:Elibri::ONIX::Dict::CoverType
29
29
  id: 8
30
- name: twarda
30
+ key: hardcover
31
31
  product_form: BB
32
32
  product_form_detail:
33
33
  - !ruby/object:Elibri::ONIX::Dict::CoverType
34
34
  id: 9
35
- name: twarda z obwolutą
35
+ key: hardcover_with_dust_jacket
36
36
  product_form: BB
37
37
  product_form_detail: B501
38
38
  - !ruby/object:Elibri::ONIX::Dict::CoverType
39
39
  id: 10
40
- name: twarda lakierowana
40
+ key: laminated_hardcover
41
41
  product_form: BB
42
42
  product_form_detail: B415
43
43
  - !ruby/object:Elibri::ONIX::Dict::CoverType
44
44
  id: 11
45
- name: zintegrowana
45
+ key: flexibound
46
46
  product_form: BC
47
47
  product_form_detail: B412
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeType
4
+ onix_code: '01'
5
+ const_name: ONIX
6
+ name:
7
+ en: ONIX audience codes
8
+ pl: kody ONIX
@@ -0,0 +1,64 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
4
+ onix_code: '01'
5
+ const_name: GENERAL
6
+ name:
7
+ en: general
8
+ pl: książka jest skierowana do ogólnego odbiorcy
9
+
10
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
11
+ onix_code: '02'
12
+ const_name: CHILDREN
13
+ name:
14
+ en: children
15
+ pl: książka jest skierowana do dzieci
16
+
17
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
18
+ onix_code: '03'
19
+ const_name: YOUNG_ADULT
20
+ name:
21
+ en: young adult
22
+ pl: książka jest skierowana do młodzieży
23
+
24
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
25
+ onix_code: '04'
26
+ const_name: EDUCATION
27
+ name:
28
+ en: education
29
+ pl: książka edukacyjna (szkoły podstawowe i średnie)
30
+
31
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
32
+ onix_code: '05'
33
+ const_name: HIGHER_EDUCATION
34
+ name:
35
+ en: higher education
36
+ pl: podręcznik akademicki
37
+
38
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
39
+ onix_code: '06'
40
+ const_name: EXPERTS
41
+ name:
42
+ en: experts
43
+ pl: książka dla profesjonalistów
44
+
45
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
46
+ onix_code: '08'
47
+ const_name: ADULT_EDUCATION
48
+ name:
49
+ en: adult education
50
+ pl: edukacja dla dorosłych
51
+
52
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::AudienceCodeValue
53
+ onix_code: '09'
54
+ const_name: SECOND_LANGUAGE_TEACHING
55
+ name:
56
+ en: second language teaching
57
+ pl: nauka języka obcego
58
+
59
+
60
+
61
+
62
+
63
+
64
+
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::EpubLicenseExpressionType
4
+ onix_code: '01'
5
+ const_name: HUMAN_READABLE
6
+ name:
7
+ en: human readable
8
+ pl: ogólnodostępny dokument
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::NameIdentifier
4
+ onix_code: '21'
5
+ const_name: ORCID
6
+ name:
7
+ en: ORCID
8
+ pl: ORCID
@@ -43,3 +43,17 @@
43
43
  en: short collection description
44
44
  pl: krótki opis cyklu (max. 350 znaków)
45
45
 
46
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::OtherTextType
47
+ onix_code: '20'
48
+ const_name: OPEN_ACCESS_STATEMENT
49
+ name:
50
+ en: open access statement
51
+ pl: deklaracja open access
52
+
53
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::OtherTextType
54
+ onix_code: '32'
55
+ const_name: LIST_OF_CONTENTS
56
+ name:
57
+ en: list of contents
58
+ pl: zawartość pudełka
59
+
@@ -1,5 +1,12 @@
1
1
 
2
- ---
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductClassificationType
4
+ onix_code: '01'
5
+ const_name: CN
6
+ name:
7
+ en: WCO Harmonized System
8
+ pl: System WCO
9
+
3
10
  - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductClassificationType
4
11
  onix_code: '12'
5
12
  const_name: PKWIU
@@ -182,3 +182,13 @@
182
182
  digital: false
183
183
  carrier: druk
184
184
  mandatory_isbn: true
185
+
186
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductFormCode
187
+ onix_code: 'OPEN_ACCESS'
188
+ const_name: OPEN_ACCESS
189
+ name:
190
+ en: e-book open access
191
+ pl: e-book open access
192
+ digital: false
193
+ carrier: plik
194
+ mandatory_isbn: true
@@ -20,4 +20,10 @@
20
20
  en: ISBN-13
21
21
  pl: ISBN-13
22
22
 
23
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductIDType
24
+ onix_code: '06'
25
+ const_name: DOI
26
+ name:
27
+ en: DOI
28
+ pl: DOI
23
29
 
@@ -0,0 +1,15 @@
1
+ #lista 253
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ResourceFileFeatureType
4
+ onix_code: '06'
5
+ const_name: MD5
6
+ name:
7
+ en: md5
8
+ pl: md5
9
+
10
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ResourceFileFeatureType
11
+ onix_code: '07'
12
+ const_name: EXACT_FILE_SIZE
13
+ name:
14
+ en: exact file size
15
+ pl: dokładny rozmiar pliku
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::ResourceIDType
4
+ onix_code: '01'
5
+ const_name: PROPRIETARY
6
+ name:
7
+ en: proprietary
8
+ pl: wewnętrzny identyfikator
@@ -1,5 +1,13 @@
1
1
 
2
2
  ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::SubjectSchemeIdentifier
4
+ onix_code: '20'
5
+ const_name: KEYWORDS
6
+ name:
7
+ en: keywords
8
+ pl: słowa kluczowe
9
+
10
+
3
11
  - !ruby/object:Elibri::ONIX::Dict::Release_3_0::SubjectSchemeIdentifier
4
12
  onix_code: '24'
5
13
  const_name: PROPRIETARY
@@ -24,3 +24,11 @@
24
24
  name:
25
25
  en: Wholesaler
26
26
  pl: hurtownia książek
27
+
28
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::SupplierRole
29
+ onix_code: '11'
30
+ const_name: RETAIL_NON_EXL_DIST
31
+ name:
32
+ en: Non-exclusive distributor to end-customers
33
+ pl: Dystrybutor do klientów końcowych
34
+
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnpricedItemType
4
+ onix_code: '01'
5
+ const_name: FREE_OF_CHARGE
6
+ name:
7
+ en: free of charge
8
+ pl: bezpłatnie
@@ -0,0 +1,16 @@
1
+
2
+ ---
3
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::WebsiteRole
4
+ onix_code: '01'
5
+ const_name: PUBLISHER_WEBPAGE
6
+ name:
7
+ en: publisher's webpage
8
+ pl: strona www wydawnictwa
9
+
10
+ - !ruby/object:Elibri::ONIX::Dict::Release_3_0::WebsiteRole
11
+ onix_code: '29'
12
+ const_name: FULL_CONTENT_LINK
13
+ name:
14
+ en: full content link
15
+ pl: link do pełnej treści książki
16
+
@@ -1,7 +1,7 @@
1
1
  module Elibri
2
2
  module ONIX
3
3
  module Dict
4
- VERSION = "0.0.66"
4
+ VERSION = "0.0.75"
5
5
  Version = VERSION
6
6
  end
7
7
  end
@@ -6,8 +6,8 @@ require 'helper'
6
6
  describe Elibri::ONIX::Dict::Release_3_0 do
7
7
 
8
8
  it "should be able to build classes on the fly from .yml files" do
9
- assert_equal 18, Elibri::ONIX::Dict::Release_3_0::ProductFormCode::ALL.size
10
- assert_equal 16, Elibri::ONIX::Dict::Release_3_0::ProductFormCode.all_except('BA', 'EA').size
9
+ assert_equal 19, Elibri::ONIX::Dict::Release_3_0::ProductFormCode::ALL.size
10
+ assert_equal 17, Elibri::ONIX::Dict::Release_3_0::ProductFormCode.all_except('BA', 'EA').size
11
11
  assert_equal 'BA', Elibri::ONIX::Dict::Release_3_0::ProductFormCode::BOOK
12
12
  assert_equal '02', Elibri::ONIX::Dict::Release_3_0::EpubUsageStatus::LIMITED
13
13
  assert_equal '01', Elibri::ONIX::Dict::Release_3_0::EpubUsageType::PREVIEW
@@ -25,6 +25,10 @@ describe Elibri::ONIX::Dict::Release_3_0 do
25
25
  assert !form.digital
26
26
  assert !form.digital?
27
27
 
28
+ form = Elibri::ONIX::Dict::Release_3_0::ProductFormCode.find_by_onix_code('OPEN_ACCESS')
29
+
30
+ assert !form.digital?
31
+
28
32
  assert_raises NoMethodError do
29
33
  form.physical
30
34
  end
@@ -4,34 +4,34 @@ require 'helper'
4
4
  describe Elibri::ONIX::Dict::CoverType do
5
5
 
6
6
  it "should be able to find most similar dict entry with specified string" do
7
- assert_equal 'miękka', Elibri::ONIX::Dict::CoverType.most_similar_to('mietka').name
8
- assert_equal 'miękka ze skrzydełkami', Elibri::ONIX::Dict::CoverType.most_similar_to('skrzydełkowa').name
9
- assert_equal 'skórzana', Elibri::ONIX::Dict::CoverType.most_similar_to('skórkowa').name
10
- assert_equal 'twarda', Elibri::ONIX::Dict::CoverType.most_similar_to('karton').name
7
+ #assert_equal 'miękka', Elibri::ONIX::Dict::CoverType.most_similar_to('mietka').name
8
+ #assert_equal 'miękka ze skrzydełkami', Elibri::ONIX::Dict::CoverType.most_similar_to('skrzydełkowa').name
9
+ #assert_equal 'skórzana', Elibri::ONIX::Dict::CoverType.most_similar_to('skórkowa').name
10
+ #assert_equal 'twarda', Elibri::ONIX::Dict::CoverType.most_similar_to('karton').name
11
11
  end
12
12
 
13
13
  it "should be able to return product_form and product_form_detail" do
14
14
  c1 = Elibri::ONIX::Dict::CoverType.find(1)
15
- assert_equal "gąbka", c1.name
15
+ assert_equal "foam", c1.key
16
16
  assert_equal "BP", c1.product_form
17
17
  assert_nil c1.product_form_detail
18
18
 
19
19
  c2 = Elibri::ONIX::Dict::CoverType.find(9)
20
- assert_equal "twarda z obwolutą", c2.name
20
+ assert_equal "hardcover_with_dust_jacket", c2.key
21
21
  assert_equal "BB", c2.product_form
22
22
  assert_equal "B501", c2.product_form_detail
23
23
  end
24
-
24
+
25
25
  it "should properly recognize cover types" do
26
- assert_equal "gąbka", Elibri::ONIX::Dict::CoverType.determine_cover_type("BP", nil)
27
- assert_equal "miękka", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", nil)
28
- assert_equal "miękka ze skrzydełkami", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", "B504")
29
- assert_equal "plastikowa", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B413")
30
- assert_equal "skórzana", Elibri::ONIX::Dict::CoverType.determine_cover_type("BG", nil)
31
- assert_equal "twarda", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", nil)
32
- assert_equal "twarda lakierowana", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B415")
33
- assert_equal "twarda z obwolutą", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B501")
34
- assert_equal "zintegrowana", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", "B412")
26
+ assert_equal "foam", Elibri::ONIX::Dict::CoverType.determine_cover_type("BP", nil)
27
+ assert_equal "paperback", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", nil)
28
+ assert_equal "paperback_with_flaps", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", "B504")
29
+ assert_equal "plastic", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B413")
30
+ assert_equal "leather", Elibri::ONIX::Dict::CoverType.determine_cover_type("BG", nil)
31
+ assert_equal "hardcover", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", nil)
32
+ assert_equal "laminated_hardcover", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B415")
33
+ assert_equal "hardcover_with_dust_jacket", Elibri::ONIX::Dict::CoverType.determine_cover_type("BB", "B501")
34
+ assert_equal "flexibound", Elibri::ONIX::Dict::CoverType.determine_cover_type("BC", "B412")
35
35
 
36
36
  #nieznana kombinacja
37
37
  assert_nil Elibri::ONIX::Dict::CoverType.determine_cover_type("BF", nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_onix_dict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.66
4
+ version: 0.0.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Urbanski
@@ -96,6 +96,8 @@ files:
96
96
  - lib/elibri_onix_dict/cover_type.rb
97
97
  - lib/elibri_onix_dict/cover_types.yml
98
98
  - lib/elibri_onix_dict/onix_3_0/base.rb
99
+ - lib/elibri_onix_dict/onix_3_0/serialized/AudienceCodeType.yml
100
+ - lib/elibri_onix_dict/onix_3_0/serialized/AudienceCodeValue.yml
99
101
  - lib/elibri_onix_dict/onix_3_0/serialized/AudienceRangePrecision.yml
100
102
  - lib/elibri_onix_dict/onix_3_0/serialized/AudienceRangeQualifier.yml
101
103
  - lib/elibri_onix_dict/onix_3_0/serialized/Availability.yml
@@ -106,6 +108,7 @@ files:
106
108
  - lib/elibri_onix_dict/onix_3_0/serialized/ContributorRole.yml
107
109
  - lib/elibri_onix_dict/onix_3_0/serialized/DateFormat.yml
108
110
  - lib/elibri_onix_dict/onix_3_0/serialized/EditionType.yml
111
+ - lib/elibri_onix_dict/onix_3_0/serialized/EpubLicenseExpressionType.yml
109
112
  - lib/elibri_onix_dict/onix_3_0/serialized/EpubTechnicalProtection.yml
110
113
  - lib/elibri_onix_dict/onix_3_0/serialized/EpubUsageStatus.yml
111
114
  - lib/elibri_onix_dict/onix_3_0/serialized/EpubUsageType.yml
@@ -115,6 +118,7 @@ files:
115
118
  - lib/elibri_onix_dict/onix_3_0/serialized/LanguageCode.yml
116
119
  - lib/elibri_onix_dict/onix_3_0/serialized/LanguageRole.yml
117
120
  - lib/elibri_onix_dict/onix_3_0/serialized/MeasureType.yml
121
+ - lib/elibri_onix_dict/onix_3_0/serialized/NameIdentifier.yml
118
122
  - lib/elibri_onix_dict/onix_3_0/serialized/NotificationType.yml
119
123
  - lib/elibri_onix_dict/onix_3_0/serialized/OtherTextType.yml
120
124
  - lib/elibri_onix_dict/onix_3_0/serialized/PricePositionOnProduct.yml
@@ -132,7 +136,9 @@ files:
132
136
  - lib/elibri_onix_dict/onix_3_0/serialized/PublishingDateRole.yml
133
137
  - lib/elibri_onix_dict/onix_3_0/serialized/PublishingStatusCode.yml
134
138
  - lib/elibri_onix_dict/onix_3_0/serialized/ResourceContentType.yml
139
+ - lib/elibri_onix_dict/onix_3_0/serialized/ResourceFileFeatureType.yml
135
140
  - lib/elibri_onix_dict/onix_3_0/serialized/ResourceForm.yml
141
+ - lib/elibri_onix_dict/onix_3_0/serialized/ResourceIDType.yml
136
142
  - lib/elibri_onix_dict/onix_3_0/serialized/ResourceMode.yml
137
143
  - lib/elibri_onix_dict/onix_3_0/serialized/ResourceVersionFeatureType.yml
138
144
  - lib/elibri_onix_dict/onix_3_0/serialized/SalesRestrictionType.yml
@@ -145,6 +151,8 @@ files:
145
151
  - lib/elibri_onix_dict/onix_3_0/serialized/TitleElementLevel.yml
146
152
  - lib/elibri_onix_dict/onix_3_0/serialized/TitleType.yml
147
153
  - lib/elibri_onix_dict/onix_3_0/serialized/UnnamedPersons.yml
154
+ - lib/elibri_onix_dict/onix_3_0/serialized/UnpricedItemType.yml
155
+ - lib/elibri_onix_dict/onix_3_0/serialized/WebsiteRole.yml
148
156
  - lib/elibri_onix_dict/releases.rb
149
157
  - lib/elibri_onix_dict/version.rb
150
158
  - test/elibri_onix_dict_release_3_0_test.rb
@@ -170,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
178
  - !ruby/object:Gem::Version
171
179
  version: '0'
172
180
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.7.9
181
+ rubygems_version: 3.0.8
175
182
  signing_key:
176
183
  specification_version: 4
177
184
  summary: EDItEUR ONIX format dictionary helpers used in eLibri publication system