openbd_api 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/openbd/resources/onix/collateral_detail.rb +80 -0
- data/lib/openbd/resources/onix/contributor.rb +40 -0
- data/lib/openbd/resources/onix/descriptive_detail.rb +240 -0
- data/lib/openbd/resources/onix/product_supply.rb +81 -0
- data/lib/openbd/resources/onix/publisher.rb +29 -0
- data/lib/openbd/resources/onix/publishing_detail.rb +107 -0
- data/lib/openbd/resources/onix.rb +134 -0
- data/lib/openbd/version.rb +1 -1
- data/lib/openbd_api.rb +6 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dcca7a82ee9b8b2ba9bfbd76a1b9785a6e4985d
|
4
|
+
data.tar.gz: bcea664ccbf4800c6f90102bad3e3702bf4d7c99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e19d7bf8991ecbf94338e68094010305f1174a0073cc8dbbc435bde64d0ebf2d01c33a0c83e84486ab5de0b606dcc14f32532de390b84e4d2e997ca95bc24b2d
|
7
|
+
data.tar.gz: a884e6c12e3bc1baaec2f9c6be240e127e4904c104442a5517c8b7b7509b5b1d1ed2e5602b09eea65b44007d6b756881a7c881810d1fcf00ffbf38a0c3853566
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.5.0
|
2
|
+
|
3
|
+
- Add `OpenBD::Resources::Onix::CollateralDetail`
|
4
|
+
- Add `OpenBD::Resources::Onix::Contributor`
|
5
|
+
- Add `OpenBD::Resources::Onix::DescriptiveDetail`
|
6
|
+
- Add `OpenBD::Resources::Onix::ProductSupply`
|
7
|
+
- Add `OpenBD::Resources::Onix::Publisher`
|
8
|
+
- Add `OpenBD::Resources::Onix::PublishingDetail`
|
9
|
+
|
1
10
|
## 0.4.5
|
2
11
|
|
3
12
|
- normalize_isbns() should be used only once
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Block 2: Marketing collateral detail
|
7
|
+
#
|
8
|
+
# 商品の付帯項目について記述する。
|
9
|
+
#
|
10
|
+
class CollateralDetail < BaseResource
|
11
|
+
|
12
|
+
# Short description/annotation (内容紹介1(取次広報誌(書店向)用))
|
13
|
+
attr_reader :short_description
|
14
|
+
|
15
|
+
# Description (内容紹介2(読者/仕入参考用))
|
16
|
+
attr_reader :description
|
17
|
+
|
18
|
+
# Table of Contents (目次)
|
19
|
+
attr_reader :toc
|
20
|
+
|
21
|
+
# Front cover (書影)
|
22
|
+
attr_reader :cover
|
23
|
+
|
24
|
+
# Product image / Artwork (付録、商品イメージ)
|
25
|
+
attr_reader :image
|
26
|
+
|
27
|
+
def initialize(source)
|
28
|
+
super
|
29
|
+
@short_description = nil
|
30
|
+
@description = nil
|
31
|
+
@toc = nil
|
32
|
+
@cover = []
|
33
|
+
@image = []
|
34
|
+
parse(source)
|
35
|
+
end
|
36
|
+
|
37
|
+
def parse(cd)
|
38
|
+
if cd["TextContent"]
|
39
|
+
cd["TextContent"].each do |text|
|
40
|
+
|
41
|
+
# ONIX Code Lists: List 153: Text type
|
42
|
+
# https://onix-codelists.io/codelist/153
|
43
|
+
case text["TextType"]
|
44
|
+
when "02" ## Short Description/annotation
|
45
|
+
@short_description = text["Text"]
|
46
|
+
when "03" ## Description
|
47
|
+
@description = text["Text"]
|
48
|
+
when "04" ## TableOfContents
|
49
|
+
@toc = text["Text"]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if cd["SupportingResource"] # 書影や付録などの画像ファイル
|
55
|
+
cover = []
|
56
|
+
image = []
|
57
|
+
# 画像ファイルは3つまで指定可能
|
58
|
+
cd["SupportingResource"].each do |sr|
|
59
|
+
|
60
|
+
# Onix codelists List 158: Resource content type
|
61
|
+
# https://onix-codelists.io/codelist/158
|
62
|
+
if sr["ResourceContentType"] == "01" # Front cover
|
63
|
+
cover.push(sr["ResourceVersion"][0]["ResourceLink"])
|
64
|
+
end
|
65
|
+
if sr["ResourceContentType"] == "07" # Product image / artwork
|
66
|
+
image.push(sr["ResourceVersion"][0]["ResourceLink"])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if cover.length > 0
|
70
|
+
@cover = cover
|
71
|
+
end
|
72
|
+
if image.length > 0
|
73
|
+
@image = image
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Authorship (Contributor)
|
7
|
+
#
|
8
|
+
# This class is used in DescriptiveDetail as Contributor
|
9
|
+
#
|
10
|
+
class Contributor < BaseResource
|
11
|
+
|
12
|
+
# Contributor's Role (著者区分)
|
13
|
+
# @return [Array<String>]
|
14
|
+
attr_reader :role
|
15
|
+
|
16
|
+
# Contributor's Name (著者名)
|
17
|
+
attr_reader :name
|
18
|
+
|
19
|
+
# Collationkey of Contributor's Name (著者名読み)
|
20
|
+
attr_reader :name_colationkey
|
21
|
+
|
22
|
+
# Sequence number of Contributor (著者順序)
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :seqence_number
|
25
|
+
|
26
|
+
# Biographical Note (著者略歴)
|
27
|
+
attr_reader :biographical_note
|
28
|
+
|
29
|
+
def initialize(source)
|
30
|
+
super
|
31
|
+
@role = source["ContributorRole"]
|
32
|
+
@name = source["PersonName"]["content"] rescue nil
|
33
|
+
@name_collationkey = source["PersonName"]["collationkey"] rescue nil
|
34
|
+
@seqence_number = source["SequenceNumber"]
|
35
|
+
@biographical_note = source["BiographicalNote"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,240 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Block 1: Product description
|
7
|
+
#
|
8
|
+
class DescriptiveDetail < BaseResource
|
9
|
+
|
10
|
+
# Product Composition (分売可否)
|
11
|
+
attr_reader :product_composition
|
12
|
+
alias_method :bunbai, :product_composition
|
13
|
+
|
14
|
+
# Product Form Code
|
15
|
+
attr_reader :product_form
|
16
|
+
|
17
|
+
# Product Form Detail (判型)
|
18
|
+
#
|
19
|
+
# Onix codelists List 175: Product form detail
|
20
|
+
# https://onix-codelists.io/codelist/175
|
21
|
+
attr_reader :product_form_detail
|
22
|
+
alias_method :hankei, :product_form_detail
|
23
|
+
|
24
|
+
# Height (サイズ・タテ)
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :height
|
27
|
+
|
28
|
+
# Width (サイズ・ヨコ)
|
29
|
+
# @return [String]
|
30
|
+
attr_reader :width
|
31
|
+
|
32
|
+
# Product Parts (付録)
|
33
|
+
attr_reader :product_parts
|
34
|
+
|
35
|
+
# Collection Sequence/Publication order (配本回数)
|
36
|
+
attr_reader :collection_sequence
|
37
|
+
|
38
|
+
# Number of Series (シリーズ巻次)
|
39
|
+
# @return [String]
|
40
|
+
attr_reader :series_num
|
41
|
+
|
42
|
+
# Subcollection / Series (シリーズ名)
|
43
|
+
attr_reader :series
|
44
|
+
|
45
|
+
# Collationkey of Series (シリーズ読み)
|
46
|
+
attr_reader :series_collationkey
|
47
|
+
|
48
|
+
# Collection level / Label (レーベル)
|
49
|
+
attr_reader :label
|
50
|
+
|
51
|
+
# Collationkey of Label (レーベル読み)
|
52
|
+
attr_reader :label_collationkey
|
53
|
+
|
54
|
+
# Title (書名)
|
55
|
+
attr_reader :title
|
56
|
+
|
57
|
+
# Collationkey of Title (書名読み)
|
58
|
+
attr_reader :title_collationkey
|
59
|
+
|
60
|
+
# Subtitle (サブタイトル)
|
61
|
+
attr_reader :subtitle
|
62
|
+
|
63
|
+
# Collationkey of Subtitle (サブタイトル読み)
|
64
|
+
attr_reader :subtitle_collationkey
|
65
|
+
|
66
|
+
# Contributors / Authors (著者)
|
67
|
+
# @return [Array<OpenBD::Resources::Onix::Contributor>]
|
68
|
+
attr_reader :authors
|
69
|
+
|
70
|
+
# Languages (言語設定)
|
71
|
+
# @return [Array<String>]
|
72
|
+
attr_reader :languages
|
73
|
+
|
74
|
+
# Pages (ページ数)
|
75
|
+
# @return [String]
|
76
|
+
attr_reader :pages
|
77
|
+
|
78
|
+
# Keywords (キーワード)
|
79
|
+
# @return [String]
|
80
|
+
attr_reader :subject_heading_text
|
81
|
+
alias_method :keywords, :subject_heading_text
|
82
|
+
|
83
|
+
# Japanese book trade C-Code (Cコード)
|
84
|
+
# @return [String]
|
85
|
+
attr_reader :ccode
|
86
|
+
|
87
|
+
# Japanese book trade Genre Code (ジャンルコード)
|
88
|
+
# @return [String]
|
89
|
+
attr_reader :genre_code
|
90
|
+
|
91
|
+
# Japanese Chidren's audience code (児童書読者コード)
|
92
|
+
attr_reader :jp_childrens_audience_code
|
93
|
+
|
94
|
+
# ONIX Adult audience rating (成人指定)
|
95
|
+
# https://onix-codelists.io/codelist/203
|
96
|
+
attr_reader :onix_adult_audience_rating
|
97
|
+
|
98
|
+
def initialize(source)
|
99
|
+
super
|
100
|
+
@product_composition = nil
|
101
|
+
@product_form = nil
|
102
|
+
@product_form_detail = nil
|
103
|
+
@height = nil
|
104
|
+
@width = nil
|
105
|
+
@product_parts = nil
|
106
|
+
@collection_sequence = nil
|
107
|
+
@series_number = nil
|
108
|
+
@series = nil
|
109
|
+
@series_collationkey = nil
|
110
|
+
@label = nil
|
111
|
+
@label_collationkey = nil
|
112
|
+
@title = nil
|
113
|
+
@title_collationkey = nil
|
114
|
+
@subtitle = nil
|
115
|
+
@subtitle_collationkey = nil
|
116
|
+
@authors = []
|
117
|
+
@languages = []
|
118
|
+
@pages = nil
|
119
|
+
@subject_heading_text = nil
|
120
|
+
@ccode = nil
|
121
|
+
@genre_code = nil
|
122
|
+
@jp_childrens_audience_code = nil
|
123
|
+
@onix_adult_audience_rating = nil
|
124
|
+
parse(source)
|
125
|
+
end
|
126
|
+
|
127
|
+
def parse(dd)
|
128
|
+
@product_composition = dd["ProductComposition"]
|
129
|
+
|
130
|
+
# Onix codelists, List 150: Product form
|
131
|
+
# https://onix-codelists.io/codelist/150
|
132
|
+
# Value: "BA" (Book), "BZ" (Other book format) or "ZA" (General merchandise, not recommended)
|
133
|
+
@product_form = dd["ProductForm"]
|
134
|
+
if @product_form == "BA"
|
135
|
+
|
136
|
+
# Onix codelists List 175: Product form detail
|
137
|
+
# https://onix-codelists.io/codelist/175
|
138
|
+
@product_form_detail = dd["ProductFormDetail"]
|
139
|
+
end
|
140
|
+
|
141
|
+
if dd["Measure"]
|
142
|
+
dd["Measure"].each do |m|
|
143
|
+
|
144
|
+
# Onix codelists, List 48: Measure type code
|
145
|
+
# https://onix-codelists.io/codelist/48
|
146
|
+
case m["MeasureType"]
|
147
|
+
when "01"
|
148
|
+
@height = m["Measurement"] + m["MeasureUnitCode"]
|
149
|
+
when "02"
|
150
|
+
@width = m["Measurement"] + m["MeasureUnitCode"]
|
151
|
+
else
|
152
|
+
nil
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
if dd["ProductPart"]
|
158
|
+
@product_parts = dd["ProductPart"].map do |part|
|
159
|
+
part["ProductFormDescription"]
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
if dd["Collection"]
|
164
|
+
if dd["Collection"]["CollectionSequence"]
|
165
|
+
@collection_sequence = dd["Collection"]["CollectionSequence"]["CollectionSequenceNumber"]
|
166
|
+
end
|
167
|
+
if dd["Collection"]["TitleDetail"] && dd["Collection"]["TitleDetail"]["TitleElement"]
|
168
|
+
|
169
|
+
# Onix codelists, List 149: Title element level
|
170
|
+
# https://onix-codelists.io/codelist/149
|
171
|
+
dd["Collection"]["TitleDetail"]["TitleElement"].each do |te|
|
172
|
+
if te["TitleElementLevel"] == "03" ## Subcollection
|
173
|
+
if te["PartNumber"]
|
174
|
+
@series_number = te["PartNumber"]
|
175
|
+
end
|
176
|
+
@series = te["TitleText"]["content"]
|
177
|
+
@series_collationkey = te["TitleText"]["collationkey"]
|
178
|
+
elsif te["TitleElementLevel"] == "02" ## Collection level
|
179
|
+
@label = te["TitleText"]["content"]
|
180
|
+
@label_collationkey = te["TitleText"]["collationkey"]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
if dd["TitleDetail"]
|
187
|
+
@title = dd["TitleDetail"]["TitleElement"]["TitleText"]["content"]
|
188
|
+
@title_collationkey = dd["TitleDetail"]["TitleElement"]["TitleText"]["collationkey"]
|
189
|
+
if dd["TitleDetail"]["TitleElement"]["Subtitle"]
|
190
|
+
@subtitle = dd["TitleDetail"]["TitleElement"]["Subtitle"]["content"]
|
191
|
+
@subtitle_collationkey = dd["TitleDetail"]["TitleElement"]["Subtitle"]["collationkey"]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
if dd["Contributor"]
|
196
|
+
@authors = dd["Contributor"].map do |author|
|
197
|
+
OpenBD::Resources::Onix::Contributor.new(author)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
if dd["Language"]
|
202
|
+
@languages = dd["Language"].map{|lang| lang["LanguageCode"]}
|
203
|
+
end
|
204
|
+
|
205
|
+
if dd["Extent"] && dd["Extent"][0]
|
206
|
+
@pages = dd["Extent"][0]["ExtentValue"]
|
207
|
+
end
|
208
|
+
|
209
|
+
if dd["Subject"]
|
210
|
+
dd["Subject"].each do |sbj|
|
211
|
+
|
212
|
+
# Onix codelists, List 27: Subject scheme identifier code
|
213
|
+
# https://onix-codelists.io/codelist/27
|
214
|
+
case sbj["SubjectSchemeIdentifier"]
|
215
|
+
when "20"
|
216
|
+
@subject_heading_text = sbj["SubjectHeadingText"] ## keywords
|
217
|
+
when "78"
|
218
|
+
@ccode = sbj["SubjectCode"]
|
219
|
+
when "79"
|
220
|
+
@genre_code = sbj["SubjectCode"]
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# ONIX Code Lists, List 29: Audience code type
|
226
|
+
# https://onix-codelists.io/codelist/29
|
227
|
+
if dd["Audience"]
|
228
|
+
dd["Audience"].each do |aud|
|
229
|
+
if aud["AudienceCodeType"] == "21" ## JapaneseChildrensAudienceCode
|
230
|
+
@jp_childrens_audience_code = aud["AudienceCodeValue"]
|
231
|
+
elsif aud["AudienceCodeType"] == "22" ## OnixAdultAudienceRating
|
232
|
+
@onix_adult_audience_rating = aud["AudienceCodeValue"]
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Block 6: Product supply
|
7
|
+
#
|
8
|
+
# 市場における商品の出版状況、供給等について記述する。
|
9
|
+
#
|
10
|
+
class ProductSupply < BaseResource
|
11
|
+
|
12
|
+
# Returns conditions (販売条件)
|
13
|
+
#
|
14
|
+
# Onix codelists, List 204: ONIX Returns conditions code
|
15
|
+
# https://onix-codelists.io/codelist/204
|
16
|
+
attr_reader :returns_conditions_code
|
17
|
+
|
18
|
+
# Price Excluding Tax, JPY (希望小売価格, 定価)
|
19
|
+
attr_reader :price
|
20
|
+
|
21
|
+
# Special Price Excluding Tax, JPY (特価)
|
22
|
+
attr_reader :special_price
|
23
|
+
|
24
|
+
# Special Price From Date (特価開始日)
|
25
|
+
attr_reader :special_price_from_date
|
26
|
+
|
27
|
+
# Special Price Until Date (特価終了日)
|
28
|
+
attr_reader :special_price_until_date
|
29
|
+
|
30
|
+
def initialize(source)
|
31
|
+
super
|
32
|
+
@returns_conditions_code = nil
|
33
|
+
@price = nil
|
34
|
+
@special_price = nil
|
35
|
+
@special_price_from_date = nil
|
36
|
+
@special_price_until_date = nil
|
37
|
+
parse(source)
|
38
|
+
end
|
39
|
+
|
40
|
+
def parse(ps)
|
41
|
+
if ps["SupplyDetail"]
|
42
|
+
if ps["SupplyDetail"]["ReturnsConditions"]
|
43
|
+
@returns_conditions_code = ps["SupplyDetail"]["ReturnsConditions"]["ReturnsCode"]
|
44
|
+
end
|
45
|
+
if ps["SupplyDetail"]["Price"]
|
46
|
+
ps["SupplyDetail"]["Price"].each do |pr|
|
47
|
+
price = price_mode = nil
|
48
|
+
|
49
|
+
# Onix codelists, List 58: Price type code
|
50
|
+
# https://onix-codelists.io/codelist/58
|
51
|
+
case pr["PriceType"]
|
52
|
+
when "01", "03" ## RRP(Recommended Retail Price) Excluding Tax, Fixed Retail Price Excluding Tax
|
53
|
+
@price = pr["PriceAmount"]
|
54
|
+
price_mode = :normal
|
55
|
+
when "11", "13" ## Special sale RRP excluding tax, Special sale fixed retail price excluding tax
|
56
|
+
@special_price = pr["PriceAmount"]
|
57
|
+
price_mode = :special
|
58
|
+
else
|
59
|
+
next
|
60
|
+
end
|
61
|
+
if pr["PriceDate"]
|
62
|
+
pr["PriceDate"].each do |pdi|
|
63
|
+
|
64
|
+
# Onix codelists, List 173: Price date role
|
65
|
+
# https://onix-codelists.io/codelist/173
|
66
|
+
case pdi["PriceDateRole"]
|
67
|
+
when "14" ## FromDate
|
68
|
+
@special_price_from_date = pdi["Date"]
|
69
|
+
when "15" ## UntilDate
|
70
|
+
@special_price_until_date = pdi["Date"]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Publisher / Imprint
|
7
|
+
#
|
8
|
+
# This class is used in PublishingDetail
|
9
|
+
#
|
10
|
+
class Publisher
|
11
|
+
|
12
|
+
# Publisher Name (出版社名)
|
13
|
+
attr_reader :name
|
14
|
+
|
15
|
+
# Japanese Publisher identifier (ISBN出版者記号)
|
16
|
+
attr_reader :publisher_id
|
17
|
+
|
18
|
+
# JP Distribution Identifier (取引コード)
|
19
|
+
attr_reader :distribution_id
|
20
|
+
|
21
|
+
def initialize(name, publisher_id, distribution_id)
|
22
|
+
@name = name
|
23
|
+
@publisher_id = publisher_id
|
24
|
+
@distribution_id = distribution_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module OpenBD
|
2
|
+
module Resources
|
3
|
+
class Onix
|
4
|
+
|
5
|
+
##
|
6
|
+
# Block 4: Publishing detail
|
7
|
+
#
|
8
|
+
# 出版社に関する情報を記述する。
|
9
|
+
#
|
10
|
+
class PublishingDetail < BaseResource
|
11
|
+
|
12
|
+
# Imprint (発行出版社)
|
13
|
+
# @return [OpenBD::Resources::Onix::Publisher]
|
14
|
+
attr_reader :imprint
|
15
|
+
|
16
|
+
# Publisher (発売出版社)
|
17
|
+
# @return [OpenBD::Resources::Onix::Publisher]
|
18
|
+
attr_reader :publisher
|
19
|
+
|
20
|
+
# Publishing Date (発売予定日)
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :publishing_date
|
23
|
+
|
24
|
+
# Publishing Embargo Date (発売協定日)
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :publishing_embargo_date
|
27
|
+
|
28
|
+
# Public Announcement Date (発売情報解禁日)
|
29
|
+
# @return [String]
|
30
|
+
attr_reader :public_announcement_date
|
31
|
+
|
32
|
+
# Publishers Reservation Order Deadline (注文・申込締切(事前予約注文締切日))
|
33
|
+
# @return [String]
|
34
|
+
attr_reader :publishers_reservation_order_deadline
|
35
|
+
|
36
|
+
def initialize(source)
|
37
|
+
super
|
38
|
+
@imprint = nil
|
39
|
+
@publisher = nil
|
40
|
+
@publishing_date = nil
|
41
|
+
@publishing_embargo_date = nil
|
42
|
+
@public_announcement_date = nil
|
43
|
+
@publishers_reservation_order_deadline = nil
|
44
|
+
parse(source)
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse(pd)
|
48
|
+
if pd["Imprint"]
|
49
|
+
publisher_id = distribution_id = nil
|
50
|
+
pd["Imprint"]["ImprintIdentifier"].each do |ii|
|
51
|
+
|
52
|
+
# Onix codelists, List 44: Name code type
|
53
|
+
# https://onix-codelists.io/codelist/44
|
54
|
+
case ii["ImprintIDType"]
|
55
|
+
when "19" ## JapanesePublisherIdentifier, 発行出版社コード
|
56
|
+
publisher_id = ii["IDValue"]
|
57
|
+
when "24" ## JpDistributionIdentifier, 発行取引コード
|
58
|
+
distribution_id = ii["IDValue"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
name = pd["Imprint"]["ImprintName"] ## 発行出版社名
|
62
|
+
@imprint = OpenBD::Resources::Onix::Publisher.new(name,
|
63
|
+
publisher_id,
|
64
|
+
distribution_id)
|
65
|
+
end
|
66
|
+
|
67
|
+
if pd["Publisher"]
|
68
|
+
publisher_id = distribution_id = nil
|
69
|
+
pd["Publisher"]["PublisherIdentifier"].each do |pi|
|
70
|
+
|
71
|
+
# Onix codelists, List 44: Name code type
|
72
|
+
# https://onix-codelists.io/codelist/44
|
73
|
+
case pi["PublisherIDType"]
|
74
|
+
when "19" ## JapanesePublisherIdentifier, 発売出版社コード
|
75
|
+
publisher_id = pi["IDValue"]
|
76
|
+
when "24" ## JpDistributionIdentifier, 発売取引コード
|
77
|
+
distribution_id = pi["IDValue"]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
name = pd["Publisher"]["PublisherName"] ## 発売出版社名
|
81
|
+
@publisher = OpenBD::Resources::Onix::Publisher.new(name,
|
82
|
+
publisher_id,
|
83
|
+
distribution_id)
|
84
|
+
end
|
85
|
+
|
86
|
+
if pd["PublishingDate"]
|
87
|
+
pd["PublishingDate"].each do |pdi|
|
88
|
+
|
89
|
+
# Onix Codelists, List 163: Publishing date role
|
90
|
+
# https://onix-codelists.io/codelist/163
|
91
|
+
case pdi["PublishingDateRole"]
|
92
|
+
when "01" ## PublicationDate
|
93
|
+
@publishing_date = pdi["Date"]
|
94
|
+
when "02" ## EmbargoDate
|
95
|
+
@publishing_embargo_date = pdi["Date"]
|
96
|
+
when "09" ## PublicAnnouncementDate
|
97
|
+
@public_announcement_date = pdi["Date"]
|
98
|
+
when "25" ## PublishersReservationOrderDeadline
|
99
|
+
@publishers_reservation_order_deadline = pdi["Date"]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -1,6 +1,140 @@
|
|
1
1
|
module OpenBD
|
2
2
|
module Resources
|
3
|
+
|
4
|
+
##
|
5
|
+
# Bibliographic Information of JPRO-onix specification (based ONIX for Books 3.0.x)
|
6
|
+
# http://www.editeur.org/83/Overview/
|
7
|
+
# https://jpro.jpo.or.jp/
|
8
|
+
#
|
9
|
+
# 出版情報登録センター「データ仕様 第3版」(ONIX for Books 3.0.x準拠)
|
10
|
+
# http://www.jpo.or.jp/topics/data/20160113a_jpoinfo.pdf
|
11
|
+
#
|
3
12
|
class Onix < BaseResource
|
13
|
+
|
14
|
+
attr_reader :record_reference ## ISBN
|
15
|
+
attr_reader :descriptive_detail
|
16
|
+
attr_reader :collateral_detail
|
17
|
+
attr_reader :publishing_detail
|
18
|
+
attr_reader :product_supply
|
19
|
+
|
20
|
+
alias_method :isbn, :record_reference
|
21
|
+
|
22
|
+
GENRE = {
|
23
|
+
"01" => "文芸",
|
24
|
+
"02" => "新書",
|
25
|
+
"03" => "社会一般",
|
26
|
+
"04" => "資格・試験",
|
27
|
+
"05" => "ビジネス",
|
28
|
+
"06" => "スポーツ・健康",
|
29
|
+
"07" => "趣味・実用",
|
30
|
+
"09" => "ゲーム",
|
31
|
+
"10" => "芸能・タレント",
|
32
|
+
"11" => "テレビ・映画化",
|
33
|
+
"12" => "芸術",
|
34
|
+
"13" => "哲学・宗教",
|
35
|
+
"14" => "歴史・地理",
|
36
|
+
"15" => "社会科学",
|
37
|
+
"16" => "教育",
|
38
|
+
"17" => "自然科学",
|
39
|
+
"18" => "医学",
|
40
|
+
"19" => "工業・工学",
|
41
|
+
"20" => "コンピュータ",
|
42
|
+
"21" => "語学・辞事典",
|
43
|
+
"22" => "学参",
|
44
|
+
"23" => "児童図書",
|
45
|
+
"24" => "ヤングアダルト",
|
46
|
+
"29" => "新刊セット",
|
47
|
+
"30" => "全集",
|
48
|
+
"31" => "文庫",
|
49
|
+
"36" => "コミック文庫",
|
50
|
+
"41" => "コミックス(欠番扱)",
|
51
|
+
"42" => "コミックス(雑誌扱)",
|
52
|
+
"43" => "コミックス(書籍)",
|
53
|
+
"44" => "コミックス(廉価版)",
|
54
|
+
"51" => "ムック",
|
55
|
+
"71" => "雑誌",
|
56
|
+
"81" => "増刊",
|
57
|
+
"86" => "別冊"
|
58
|
+
}
|
59
|
+
|
60
|
+
CONTRIBUTOR_ROLE = {
|
61
|
+
"A01" => "著",
|
62
|
+
"B01" => "編",
|
63
|
+
"B20" => "監修",
|
64
|
+
"B06" => "翻訳",
|
65
|
+
"A12" => "画、イラスト",
|
66
|
+
"A08" => "写真",
|
67
|
+
"A38" => "原作",
|
68
|
+
"A10" => "原案",
|
69
|
+
"A21" => "解説",
|
70
|
+
"E07" => "朗読",
|
71
|
+
}
|
72
|
+
|
73
|
+
FORMAT = {
|
74
|
+
"B108" => "A5",
|
75
|
+
"B109" => "B5",
|
76
|
+
"B110" => "B6",
|
77
|
+
"B111" => "文庫",
|
78
|
+
"B112" => "新書",
|
79
|
+
"B119" => "46",
|
80
|
+
"B120" => "46変形",
|
81
|
+
"B121" => "A4",
|
82
|
+
"B122" => "A4変形",
|
83
|
+
"B123" => "A5変形",
|
84
|
+
"B124" => "B5変形",
|
85
|
+
"B125" => "B6変形",
|
86
|
+
"B126" => "AB",
|
87
|
+
"B127" => "B7",
|
88
|
+
"B128" => "菊",
|
89
|
+
"B129" => "菊変形",
|
90
|
+
"B130" => "B4",
|
91
|
+
}
|
92
|
+
|
93
|
+
JP_CHILDRENS_AUDIENCE_CODE = {
|
94
|
+
"01" => "0~2歳",
|
95
|
+
"02" => "3~5歳",
|
96
|
+
"03" => "小学低学年",
|
97
|
+
"04" => "小学中学年",
|
98
|
+
"05" => "小学高学年",
|
99
|
+
"06" => "小学全般",
|
100
|
+
"07" => "中学以上",
|
101
|
+
"08" => "高校",
|
102
|
+
}
|
103
|
+
|
104
|
+
ONIX_ADULT_AUDIENCE_RATING = {
|
105
|
+
"00" => "指定なし",
|
106
|
+
"01" => "成人指定(理由明記なし)",
|
107
|
+
"02" => "成人向け",
|
108
|
+
"03" => "成人向け(性)",
|
109
|
+
"04" => "成人向け(暴力)",
|
110
|
+
"05" => "成人向け(薬物)",
|
111
|
+
"06" => "成人向け(言語)",
|
112
|
+
}
|
113
|
+
|
114
|
+
def initialize(source)
|
115
|
+
super
|
116
|
+
@record_reference = source["RecordReference"] ## ISBN
|
117
|
+
@descriptive_detail = nil
|
118
|
+
@collateral_detail = nil
|
119
|
+
@publishing_detail = nil
|
120
|
+
@product_supply = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
def descriptive_detail
|
124
|
+
@descriptive_detail ||= OpenBD::Resources::Onix::DescriptiveDetail.new(source["DescriptiveDetail"])
|
125
|
+
end
|
126
|
+
|
127
|
+
def collateral_detail
|
128
|
+
@collateral_detail ||= OpenBD::Resources::Onix::CollateralDetail.new(source["CollateralDetail"])
|
129
|
+
end
|
130
|
+
|
131
|
+
def publishing_detail
|
132
|
+
@publishing_detail ||= OpenBD::Resources::Onix::PublishingDetail.new(source["PublishingDetail"])
|
133
|
+
end
|
134
|
+
|
135
|
+
def product_supply
|
136
|
+
@product_supply ||= OpenBD::Resources::Onix::ProductSupply.new(source["ProductSupply"])
|
137
|
+
end
|
4
138
|
end
|
5
139
|
end
|
6
140
|
end
|
data/lib/openbd/version.rb
CHANGED
data/lib/openbd_api.rb
CHANGED
@@ -5,6 +5,12 @@ require 'slop'
|
|
5
5
|
require 'openbd/resources/base_resource'
|
6
6
|
require 'openbd/resources/hanmoto'
|
7
7
|
require 'openbd/resources/onix'
|
8
|
+
require 'openbd/resources/onix/contributor'
|
9
|
+
require 'openbd/resources/onix/collateral_detail'
|
10
|
+
require 'openbd/resources/onix/descriptive_detail'
|
11
|
+
require 'openbd/resources/onix/product_supply'
|
12
|
+
require 'openbd/resources/onix/publisher'
|
13
|
+
require 'openbd/resources/onix/publishing_detail'
|
8
14
|
require 'openbd/resources/summary'
|
9
15
|
require 'openbd/resources/openbd_item'
|
10
16
|
require 'openbd/responses/base_response'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openbd_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nasum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,6 +118,12 @@ files:
|
|
118
118
|
- lib/openbd/resources/base_resource.rb
|
119
119
|
- lib/openbd/resources/hanmoto.rb
|
120
120
|
- lib/openbd/resources/onix.rb
|
121
|
+
- lib/openbd/resources/onix/collateral_detail.rb
|
122
|
+
- lib/openbd/resources/onix/contributor.rb
|
123
|
+
- lib/openbd/resources/onix/descriptive_detail.rb
|
124
|
+
- lib/openbd/resources/onix/product_supply.rb
|
125
|
+
- lib/openbd/resources/onix/publisher.rb
|
126
|
+
- lib/openbd/resources/onix/publishing_detail.rb
|
121
127
|
- lib/openbd/resources/openbd_item.rb
|
122
128
|
- lib/openbd/resources/summary.rb
|
123
129
|
- lib/openbd/responses/base_response.rb
|