elibri_onix_dict 0.0.81 → 0.1.5
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_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/ProductContactRole.yml +8 -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 +10 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf0495990d62187cc4b311852f8be5fc8645ee7870e01265411e6e1e59fd006
|
4
|
+
data.tar.gz: 20c8a7930d3b4a6c0ee5f96da87196f0e6d6c3dbb847df079c5fe35eb84f37e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff558c40d255c38f21353f91b584d8b15a63496aa3c782ab179eaff9b3690af00078cb213ff31f439ed4d056462f5971407db080f16624ceb1bb690116cb0e0d
|
7
|
+
data.tar.gz: 321bf4fdc5c095076b5aa9cce641d3b72db7df4e64b210e3bdba8cefb84286596d00d3fca8c5044acf91a8486e97c84948fe3eaba6cd13f61ba2feca9eb81deb
|
@@ -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.5
|
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
|
@@ -124,6 +111,7 @@ files:
|
|
124
111
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductAvailabilityType.yml
|
125
112
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductClassificationType.yml
|
126
113
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductComposition.yml
|
114
|
+
- lib/elibri_onix_dict/onix_3_0/serialized/ProductContactRole.yml
|
127
115
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
|
128
116
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductFormDetail.yml
|
129
117
|
- lib/elibri_onix_dict/onix_3_0/serialized/ProductFormFeatureType.yml
|
@@ -175,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
163
|
- !ruby/object:Gem::Version
|
176
164
|
version: '0'
|
177
165
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.1.6
|
179
167
|
signing_key:
|
180
168
|
specification_version: 4
|
181
169
|
summary: EDItEUR ONIX format dictionary helpers used in eLibri publication system
|