onix 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/onix/audience_range.rb +26 -0
- data/lib/onix/language.rb +14 -0
- data/lib/onix/lists/audience_code.rb +17 -0
- data/lib/onix/lists/country_code.rb +257 -0
- data/lib/onix/lists/language_code.rb +498 -0
- data/lib/onix/lists/language_role.rb +18 -0
- data/lib/onix/lists/notification_type.rb +19 -0
- data/lib/onix/lists/product_form_detail.rb +157 -0
- data/lib/onix/product.rb +10 -2
- data/lib/onix/series.rb +18 -0
- data/lib/onix/series_identifier.rb +13 -0
- data/lib/onix.rb +12 -3
- data/spec/audience_range_spec.rb +46 -0
- data/spec/language_spec.rb +42 -0
- data/spec/series_identifier_spec.rb +38 -0
- data/spec/series_spec.rb +34 -0
- metadata +20 -2
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module ONIX
|
4
|
+
class AudienceRange
|
5
|
+
include ROXML
|
6
|
+
include ONIX::Common
|
7
|
+
|
8
|
+
xml_name "AudienceRange"
|
9
|
+
|
10
|
+
xml_accessor :audience_range_qualifier, :from => "AudienceRangeQualifier", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
|
11
|
+
xml_accessor :audience_range_precisions, :from => "AudienceRangePrecision", :as => [Fixnum], :to_xml => [ONIX::Formatters.two_digit] # TODO: two_digit isn't working on the array items
|
12
|
+
xml_accessor :audience_range_values, :from => "AudienceRangeValue", :as => [Integer]
|
13
|
+
|
14
|
+
# TODO: element AudienceRange: validity error :
|
15
|
+
# Element AudienceRange content does not follow the DTD, expecting
|
16
|
+
# (AudienceRangeQualifier , AudienceRangePrecision , AudienceRangeValue ,
|
17
|
+
# (AudienceRangePrecision , AudienceRangeValue)?),
|
18
|
+
# got
|
19
|
+
# (AudienceRangeQualifier AudienceRangePrecision AudienceRangePrecision
|
20
|
+
# AudienceRangeValue AudienceRangeValue )
|
21
|
+
def initialize
|
22
|
+
self.audience_range_precisions = []
|
23
|
+
self.audience_range_values = []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module ONIX
|
4
|
+
class Language
|
5
|
+
include ROXML
|
6
|
+
include ONIX::Common
|
7
|
+
|
8
|
+
xml_name "Language"
|
9
|
+
|
10
|
+
xml_accessor :language_role, :from => "LanguageRole", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
|
11
|
+
xml_accessor :language_code, :from => "LanguageCode"
|
12
|
+
xml_accessor :country_code, :from => "CountryCode"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module ONIX
|
4
|
+
module Lists
|
5
|
+
# Code list 91
|
6
|
+
COUNTRY_CODE = {
|
7
|
+
1 => "General/trade",
|
8
|
+
2 => "Children/juvenile",
|
9
|
+
3 => "Young adult",
|
10
|
+
4 => "Primary & secondary/elementary & high school",
|
11
|
+
5 => "College/higher education",
|
12
|
+
6 => "Professional and scholarly",
|
13
|
+
7 => "ELT/ESL",
|
14
|
+
8 => "Adult education",
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module ONIX
|
4
|
+
module Lists
|
5
|
+
# Code list 91
|
6
|
+
COUNTRY_CODE = {
|
7
|
+
"AD" => "Andorra",
|
8
|
+
"AE" => "United Arab Emirates",
|
9
|
+
"AF" => "Afghanistan",
|
10
|
+
"AG" => "Antigua and Barbuda",
|
11
|
+
"AI" => "Anguilla",
|
12
|
+
"AL" => "Albania",
|
13
|
+
"AM" => "Armenia",
|
14
|
+
"AN" => "Netherlands Antilles",
|
15
|
+
"AO" => "Angola",
|
16
|
+
"AQ" => "Antarctica",
|
17
|
+
"AR" => "Argentina",
|
18
|
+
"AS" => "American Samoa",
|
19
|
+
"AT" => "Austria",
|
20
|
+
"AU" => "Australia",
|
21
|
+
"AW" => "Aruba",
|
22
|
+
"AX" => "Aland Islands",
|
23
|
+
"AZ" => "Azerbaijan",
|
24
|
+
"BA" => "Bosnia and Herzegovina",
|
25
|
+
"BB" => "Barbados",
|
26
|
+
"BD" => "Bangladesh",
|
27
|
+
"BE" => "Belgium",
|
28
|
+
"BF" => "Burkina Faso",
|
29
|
+
"BG" => "Bulgaria",
|
30
|
+
"BH" => "Bahrain",
|
31
|
+
"BI" => "Burundi",
|
32
|
+
"BJ" => "Benin",
|
33
|
+
"BL" => "Saint Barthelemy",
|
34
|
+
"BM" => "Bermuda",
|
35
|
+
"BN" => "Brunei Darussalam",
|
36
|
+
"BO" => "Bolivia",
|
37
|
+
"BR" => "Brazil",
|
38
|
+
"BS" => "Bahamas",
|
39
|
+
"BT" => "Bhutan",
|
40
|
+
"BV" => "Bouvet Island",
|
41
|
+
"BW" => "Botswana",
|
42
|
+
"BY" => "Belarus",
|
43
|
+
"BZ" => "Belize",
|
44
|
+
"CA" => "Canada",
|
45
|
+
"CC" => "Cocos (Keeling) Islands",
|
46
|
+
"CD" => "Congo, Democratic Republic of the",
|
47
|
+
"CF" => "Central African Republic",
|
48
|
+
"CG" => "Congo",
|
49
|
+
"CH" => "Switzerland",
|
50
|
+
"CI" => "Cote D'Ivoire",
|
51
|
+
"CK" => "Cook Islands",
|
52
|
+
"CL" => "Chile",
|
53
|
+
"CM" => "Cameroon",
|
54
|
+
"CN" => "China",
|
55
|
+
"CO" => "Colombia",
|
56
|
+
"CR" => "Costa Rica",
|
57
|
+
"CS" => "Serbia and Montenegro",
|
58
|
+
"CU" => "Cuba",
|
59
|
+
"CV" => "Cape Verde",
|
60
|
+
"CX" => "Christmas Island",
|
61
|
+
"CY" => "Cyprus",
|
62
|
+
"CZ" => "Czech Republic",
|
63
|
+
"DE" => "Germany",
|
64
|
+
"DJ" => "Djibouti",
|
65
|
+
"DK" => "Denmark",
|
66
|
+
"DM" => "Dominica",
|
67
|
+
"DO" => "Dominican Republic",
|
68
|
+
"DZ" => "Algeria",
|
69
|
+
"EC" => "Ecuador",
|
70
|
+
"EE" => "Estonia",
|
71
|
+
"EG" => "Egypt",
|
72
|
+
"EH" => "Western Sahara",
|
73
|
+
"ER" => "Eritrea",
|
74
|
+
"ES" => "Spain",
|
75
|
+
"ET" => "Ethiopia",
|
76
|
+
"FI" => "Finland",
|
77
|
+
"FJ" => "Fiji",
|
78
|
+
"FK" => "Falkland Islands (Malvinas)",
|
79
|
+
"FM" => "Micronesia, Federated States of",
|
80
|
+
"FO" => "Faroe Islands",
|
81
|
+
"FR" => "France",
|
82
|
+
"GA" => "Gabon",
|
83
|
+
"GB" => "United Kingdom",
|
84
|
+
"GD" => "Grenada",
|
85
|
+
"GE" => "Georgia",
|
86
|
+
"GF" => "French Guiana",
|
87
|
+
"GG" => "Guernsey",
|
88
|
+
"GH" => "Ghana",
|
89
|
+
"GI" => "Gibraltar",
|
90
|
+
"GL" => "Greenland",
|
91
|
+
"GM" => "Gambia",
|
92
|
+
"GN" => "Guinea",
|
93
|
+
"GP" => "Guadeloupe",
|
94
|
+
"GQ" => "Equatorial Guinea",
|
95
|
+
"GR" => "Greece",
|
96
|
+
"GS" => "South Georgia and the South Sandwich Islands",
|
97
|
+
"GT" => "Guatemala",
|
98
|
+
"GU" => "Guam",
|
99
|
+
"GW" => "Guinea-Bissau",
|
100
|
+
"GY" => "Guyana",
|
101
|
+
"HK" => "Hong Kong",
|
102
|
+
"HM" => "Heard Island and McDonald Islands",
|
103
|
+
"HN" => "Honduras",
|
104
|
+
"HR" => "Croatia",
|
105
|
+
"HT" => "Haiti",
|
106
|
+
"HU" => "Hungary",
|
107
|
+
"ID" => "Indonesia",
|
108
|
+
"IE" => "Ireland",
|
109
|
+
"IL" => "Israel",
|
110
|
+
"IM" => "Isle of Man",
|
111
|
+
"IN" => "India",
|
112
|
+
"IO" => "British Indian Ocean Territory",
|
113
|
+
"IQ" => "Iraq",
|
114
|
+
"IR" => "Iran, Islamic Republic of",
|
115
|
+
"IS" => "Iceland",
|
116
|
+
"IT" => "Italy",
|
117
|
+
"JE" => "Jersey",
|
118
|
+
"JM" => "Jamaica",
|
119
|
+
"JO" => "Jordan",
|
120
|
+
"JP" => "Japan",
|
121
|
+
"KE" => "Kenya",
|
122
|
+
"KG" => "Kyrgyzstan",
|
123
|
+
"KH" => "Cambodia",
|
124
|
+
"KI" => "Kiribati",
|
125
|
+
"KM" => "Comoros",
|
126
|
+
"KN" => "Saint Kitts and Nevis",
|
127
|
+
"KP" => "Korea, Democratic People's Republic of",
|
128
|
+
"KR" => "Korea, Republic of",
|
129
|
+
"KW" => "Kuwait",
|
130
|
+
"KY" => "Cayman Islands",
|
131
|
+
"KZ" => "Kazakhstan",
|
132
|
+
"LA" => "Lao People's Democratic Republic",
|
133
|
+
"LB" => "Lebanon",
|
134
|
+
"LC" => "Saint Lucia",
|
135
|
+
"LI" => "Liechtenstein",
|
136
|
+
"LK" => "Sri Lanka",
|
137
|
+
"LR" => "Liberia",
|
138
|
+
"LS" => "Lesotho",
|
139
|
+
"LT" => "Lithuania",
|
140
|
+
"LU" => "Luxembourg",
|
141
|
+
"LV" => "Latvia",
|
142
|
+
"LY" => "Libyan Arab Jamahiriya",
|
143
|
+
"MA" => "Morocco",
|
144
|
+
"MC" => "Monaco",
|
145
|
+
"MD" => "Moldova, Republic of",
|
146
|
+
"ME" => "Montenegro",
|
147
|
+
"MF" => "Saint Martin, French part",
|
148
|
+
"MG" => "Madagascar",
|
149
|
+
"MH" => "Marshall Islands",
|
150
|
+
"MK" => "Macedonia, the former Yugoslav Republic of",
|
151
|
+
"ML" => "Mali",
|
152
|
+
"MM" => "Myanmar",
|
153
|
+
"MN" => "Mongolia",
|
154
|
+
"MO" => "Macao",
|
155
|
+
"MP" => "Northern Mariana Islands",
|
156
|
+
"MQ" => "Martinique",
|
157
|
+
"MR" => "Mauritania",
|
158
|
+
"MS" => "Montserrat",
|
159
|
+
"MT" => "Malta",
|
160
|
+
"MU" => "Mauritius",
|
161
|
+
"MV" => "Maldives",
|
162
|
+
"MW" => "Malawi",
|
163
|
+
"MX" => "Mexico",
|
164
|
+
"MY" => "Malaysia",
|
165
|
+
"MZ" => "Mozambique",
|
166
|
+
"NA" => "Namibia",
|
167
|
+
"NC" => "New Caledonia",
|
168
|
+
"NE" => "Niger",
|
169
|
+
"NF" => "Norfolk Island",
|
170
|
+
"NG" => "Nigeria",
|
171
|
+
"NI" => "Nicaragua",
|
172
|
+
"NL" => "Netherlands",
|
173
|
+
"NO" => "Norway",
|
174
|
+
"NP" => "Nepal",
|
175
|
+
"NR" => "Nauru",
|
176
|
+
"NU" => "Niue",
|
177
|
+
"NZ" => "New Zealand",
|
178
|
+
"OM" => "Oman",
|
179
|
+
"PA" => "Panama",
|
180
|
+
"PE" => "Peru",
|
181
|
+
"PF" => "French Polynesia",
|
182
|
+
"PG" => "Papua New Guinea",
|
183
|
+
"PH" => "Philippines",
|
184
|
+
"PK" => "Pakistan",
|
185
|
+
"PL" => "Poland",
|
186
|
+
"PM" => "Saint Pierre and Miquelon",
|
187
|
+
"PN" => "Pitcairn",
|
188
|
+
"PR" => "Puerto Rico",
|
189
|
+
"PS" => "Palestinian Territory, Occupied",
|
190
|
+
"PT" => "Portugal",
|
191
|
+
"PW" => "Palau",
|
192
|
+
"PY" => "Paraguay",
|
193
|
+
"QA" => "Qatar",
|
194
|
+
"RE" => "Reunion",
|
195
|
+
"RO" => "Romania",
|
196
|
+
"RS" => "Serbia",
|
197
|
+
"RU" => "Russian Federation",
|
198
|
+
"RW" => "Rwanda",
|
199
|
+
"SA" => "Saudi Arabia",
|
200
|
+
"SB" => "Solomon Islands",
|
201
|
+
"SC" => "Seychelles",
|
202
|
+
"SD" => "Sudan",
|
203
|
+
"SE" => "Sweden",
|
204
|
+
"SG" => "Singapore",
|
205
|
+
"SH" => "Saint Helena",
|
206
|
+
"SI" => "Slovenia",
|
207
|
+
"SJ" => "Svalbard and Jan Mayen",
|
208
|
+
"SK" => "Slovakia",
|
209
|
+
"SL" => "Sierra Leone",
|
210
|
+
"SM" => "San Marino",
|
211
|
+
"SN" => "Senegal",
|
212
|
+
"SO" => "Somalia",
|
213
|
+
"SR" => "Suriname",
|
214
|
+
"ST" => "Sao Tome and Principe",
|
215
|
+
"SV" => "El Salvador",
|
216
|
+
"SY" => "Syrian Arab Republic",
|
217
|
+
"SZ" => "Swaziland",
|
218
|
+
"TC" => "Turks and Caicos Islands",
|
219
|
+
"TD" => "Chad",
|
220
|
+
"TF" => "French Southern Territories",
|
221
|
+
"TG" => "Togo",
|
222
|
+
"TH" => "Thailand",
|
223
|
+
"TJ" => "Tajikistan",
|
224
|
+
"TK" => "Tokelau",
|
225
|
+
"TL" => "Timor-Leste",
|
226
|
+
"TM" => "Turkmenistan",
|
227
|
+
"TN" => "Tunisia",
|
228
|
+
"TO" => "Tonga",
|
229
|
+
"TR" => "Turkey",
|
230
|
+
"TT" => "Trinidad and Tobago",
|
231
|
+
"TV" => "Tuvalu",
|
232
|
+
"TW" => "Taiwan, Province of China",
|
233
|
+
"TZ" => "Tanzania, United Republic of",
|
234
|
+
"UA" => "Ukraine",
|
235
|
+
"UG" => "Uganda",
|
236
|
+
"UM" => "United States Minor Outlying Islands",
|
237
|
+
"US" => "United States",
|
238
|
+
"UY" => "Uruguay",
|
239
|
+
"UZ" => "Uzbekistan",
|
240
|
+
"VA" => "Holy See (Vatican City State)",
|
241
|
+
"VC" => "Saint Vincent and the Grenadines",
|
242
|
+
"VE" => "Venezuela, Bolivarian Republic of",
|
243
|
+
"VG" => "Virgin Islands, British",
|
244
|
+
"VI" => "Virgin Islands, US",
|
245
|
+
"VN" => "Viet Nam",
|
246
|
+
"VU" => "Vanuatu",
|
247
|
+
"WF" => "Wallis and Futuna",
|
248
|
+
"WS" => "Samoa",
|
249
|
+
"YE" => "Yemen",
|
250
|
+
"YT" => "Mayotte",
|
251
|
+
"YU" => "Yugoslavia",
|
252
|
+
"ZA" => "South Africa",
|
253
|
+
"ZM" => "Zambia",
|
254
|
+
"ZW" => "Zimbabwe",
|
255
|
+
}
|
256
|
+
end
|
257
|
+
end
|