elibri_onix_dict 0.0.81 → 0.1.4
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 +4 -4
- data/lib/elibri_onix_dict/cover_type.rb +5 -13
- data/lib/elibri_onix_dict/onix_3_0/serialized/EpubTechnicalProtection.yml +8 -0
- data/lib/elibri_onix_dict/onix_3_0/serialized/NameType.yml +16 -0
- data/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormDetail.yml +8 -1
- data/lib/elibri_onix_dict/onix_3_0/serialized/PublishingStatusCode.yml +8 -1
- data/lib/elibri_onix_dict/onix_3_0/serialized/UnnamedPersons.yml +29 -1
- data/lib/elibri_onix_dict/version.rb +1 -1
- data/lib/elibri_onix_dict.rb +10 -5
- data/test/elibri_onix_dict_release_3_0_test.rb +0 -4
- metadata +9 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76b71ef7b46e12eef3ac3afffdb4ecf3cfd028e1780c5726a0db3547e32caa98
|
4
|
+
data.tar.gz: 98f5ddad33ec7287eeccaf3703d027a1cf4e57046f1f4569653d56e9008e73ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7806b7ec0af6e1528c32a213d224ea5bc2ba37769c5af8d6b96d0fa9c3e0ce5a45cf229d6570322462addabe4caf940809cb3d63a61331ca56f512f0e3f9605
|
7
|
+
data.tar.gz: 9a33281b53b0e935ba8c941bd005c10d648bd7225bb9127ff95d5ae24fff36b4779c36a14efc8631761efe7ba481609722c4ae76364ac2558471a343f2ff42d2
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'yaml'
|
2
|
-
require 'amatch'
|
3
2
|
|
4
3
|
module Elibri
|
5
4
|
module ONIX
|
@@ -12,7 +11,11 @@ module Elibri
|
|
12
11
|
|
13
12
|
|
14
13
|
conf = File.expand_path(File.join(File.dirname(__FILE__), "cover_types.yml"))
|
15
|
-
|
14
|
+
if RUBY_VERSION[0] == "2"
|
15
|
+
ALL = YAML::load_file(conf)
|
16
|
+
else
|
17
|
+
ALL = YAML::load_file(conf, permitted_classes: [Elibri::ONIX::Dict::CoverType])
|
18
|
+
end
|
16
19
|
|
17
20
|
HARDBACK = 8
|
18
21
|
PLASTIC = 6
|
@@ -31,21 +34,10 @@ module Elibri
|
|
31
34
|
I18n::t("products.cover_type.#{matching_cover.key}") if matching_cover
|
32
35
|
end
|
33
36
|
|
34
|
-
# Znajdź w słowniku typ okładki, którego nazwa jest najbardziej podobna do podanego stringu.
|
35
|
-
def self.most_similar_to(cover_name)
|
36
|
-
if cover_name =~ /karton/
|
37
|
-
return all.find { |c| c.name == "twarda" }
|
38
|
-
else
|
39
|
-
all.sort_by {|cover_type| cover_type.name.downcase.levenshtein_similar(cover_name.downcase) }.last
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
37
|
def self.all
|
45
38
|
ALL
|
46
39
|
end
|
47
40
|
|
48
|
-
|
49
41
|
end
|
50
42
|
end
|
51
43
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
---
|
3
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::NameType
|
4
|
+
onix_code: '04'
|
5
|
+
const_name: REAL_NAME
|
6
|
+
name:
|
7
|
+
en: real name
|
8
|
+
pl: prawdziwe imię i nazwisko
|
9
|
+
|
10
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::NameType
|
11
|
+
onix_code: '07'
|
12
|
+
const_name: FICTIONAL_NAME
|
13
|
+
name:
|
14
|
+
en: fictional character name
|
15
|
+
pl: imię i nazwisko postaci fikcyjnej
|
16
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
---
|
2
|
+
---
|
3
3
|
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductFormDetail
|
4
4
|
onix_code: 'E101'
|
5
5
|
const_name: EPUB
|
@@ -28,3 +28,10 @@
|
|
28
28
|
en: MP3
|
29
29
|
pl: MP3
|
30
30
|
|
31
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::ProductFormDetail
|
32
|
+
onix_code: 'A113'
|
33
|
+
const_name: LPF
|
34
|
+
name:
|
35
|
+
en: LPF
|
36
|
+
pl: LPF
|
37
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
---
|
2
|
+
---
|
3
3
|
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode
|
4
4
|
onix_code: '00'
|
5
5
|
const_name: UNSPECIFIED
|
@@ -21,6 +21,13 @@
|
|
21
21
|
en: forthcoming
|
22
22
|
pl: nadchodzący
|
23
23
|
|
24
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode
|
25
|
+
onix_code: '03'
|
26
|
+
const_name: POSTPONED_INDEFINITELY
|
27
|
+
name:
|
28
|
+
en: postponed indefinitely
|
29
|
+
pl: publikacja wstrzymana
|
30
|
+
|
24
31
|
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode
|
25
32
|
onix_code: '04'
|
26
33
|
const_name: ACTIVE
|
@@ -1,8 +1,36 @@
|
|
1
1
|
|
2
|
-
---
|
2
|
+
---
|
3
3
|
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnnamedPersons
|
4
4
|
onix_code: '04'
|
5
5
|
const_name: VARIOUS_AUTHORS
|
6
6
|
name:
|
7
7
|
en: various authors
|
8
8
|
pl: opracowanie zbiorowe
|
9
|
+
|
10
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnnamedPersons
|
11
|
+
onix_code: '05'
|
12
|
+
const_name: SYNTHESISED_VOICE_MALE
|
13
|
+
name:
|
14
|
+
en: "Synthesised voice – male"
|
15
|
+
pl: "Głos syntetyzowany - męski"
|
16
|
+
|
17
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnnamedPersons
|
18
|
+
onix_code: '06'
|
19
|
+
const_name: SYNTHESISED_VOICE_FEMALE
|
20
|
+
name:
|
21
|
+
en: "Synthesised voice – female"
|
22
|
+
pl: "Głos syntetyzowany - kobiecy"
|
23
|
+
|
24
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnnamedPersons
|
25
|
+
onix_code: '07'
|
26
|
+
const_name: SYNTHESISED_VOICE_UNSPECIFIED
|
27
|
+
name:
|
28
|
+
en: "Synthesised voice – female"
|
29
|
+
pl: "Głos syntetyzowany"
|
30
|
+
|
31
|
+
- !ruby/object:Elibri::ONIX::Dict::Release_3_0::UnnamedPersons
|
32
|
+
onix_code: '08'
|
33
|
+
const_name: SYNTHESISED_VOICE_BASED_ON_REAL_VOICE
|
34
|
+
name:
|
35
|
+
en: "Synthesised voice – based on real voice"
|
36
|
+
pl: "Głos syntetyzowany - bazujący na głosie aktora"
|
data/lib/elibri_onix_dict.rb
CHANGED
@@ -20,18 +20,23 @@ module Elibri
|
|
20
20
|
klass = Class.new(Elibri::ONIX::Dict::Release_3_0::Base)
|
21
21
|
# Elibri::ONIX::Dict::Release_3_0::ResourceMode
|
22
22
|
const_set(klass_name, klass)
|
23
|
-
|
23
|
+
|
24
|
+
if RUBY_VERSION[0] == "2"
|
25
|
+
klass.const_set(:ALL, YAML::load_file(file))
|
26
|
+
else
|
27
|
+
klass.const_set(:ALL, YAML::load_file(file, permitted_classes: [klass]))
|
28
|
+
end
|
24
29
|
|
25
30
|
klass::ALL.each do |dict_item|
|
26
31
|
klass.const_set(dict_item.const_name, dict_item.onix_code) if dict_item.const_name
|
27
|
-
end
|
28
|
-
end
|
32
|
+
end
|
33
|
+
end
|
29
34
|
end
|
30
|
-
|
35
|
+
|
31
36
|
end
|
32
37
|
|
33
38
|
Release_3_0.load_dictionaries!
|
34
|
-
|
39
|
+
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
@@ -9,10 +9,6 @@ describe Elibri::ONIX::Dict::Release_3_0 do
|
|
9
9
|
assert_equal 19, Elibri::ONIX::Dict::Release_3_0::ProductFormCode::ALL.size
|
10
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
|
-
assert_equal '02', Elibri::ONIX::Dict::Release_3_0::EpubUsageStatus::LIMITED
|
13
|
-
assert_equal '01', Elibri::ONIX::Dict::Release_3_0::EpubUsageType::PREVIEW
|
14
|
-
assert_equal '05', Elibri::ONIX::Dict::Release_3_0::EpubUsageUnit::PERCENTAGE
|
15
|
-
|
16
12
|
assert_equal '27', Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::PREORDER_EMBARGO_DATE
|
17
13
|
|
18
14
|
form = Elibri::ONIX::Dict::Release_3_0::ProductFormCode.find_by_onix_code('BA')
|
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Urbanski
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2012-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: amatch
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: pry
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +44,28 @@ dependencies:
|
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: jeweler
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '0'
|
83
69
|
description: EDItEUR ONIX format dictionary helpers used in eLibri publication system
|
84
70
|
email:
|
85
71
|
- marcin@urbanski.vdl.pl
|
@@ -115,6 +101,7 @@ files:
|
|
115
101
|
- lib/elibri_onix_dict/onix_3_0/serialized/LanguageRole.yml
|
116
102
|
- lib/elibri_onix_dict/onix_3_0/serialized/MeasureType.yml
|
117
103
|
- lib/elibri_onix_dict/onix_3_0/serialized/NameIdentifier.yml
|
104
|
+
- lib/elibri_onix_dict/onix_3_0/serialized/NameType.yml
|
118
105
|
- lib/elibri_onix_dict/onix_3_0/serialized/NotificationType.yml
|
119
106
|
- lib/elibri_onix_dict/onix_3_0/serialized/OtherTextType.yml
|
120
107
|
- lib/elibri_onix_dict/onix_3_0/serialized/PriceDateRole.yml
|
@@ -175,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
162
|
- !ruby/object:Gem::Version
|
176
163
|
version: '0'
|
177
164
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
165
|
+
rubygems_version: 3.1.6
|
179
166
|
signing_key:
|
180
167
|
specification_version: 4
|
181
168
|
summary: EDItEUR ONIX format dictionary helpers used in eLibri publication system
|