elibri_onix_mocks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,388 @@
1
+ ---
2
+ :WorkRelationCode: :x454
3
+ :TaxType: :x470
4
+ :ContributorDescription: :b048
5
+ :Affiliation: :b046
6
+ :PriceQualifier: :j261
7
+ :DiscountType: :x467
8
+ :ProductClassificationCode: :b275
9
+ :CountryCode: :b251
10
+ :AudienceRange: :audiencerange
11
+ :DiscountPercent: :j267
12
+ :SenderName: :x298
13
+ :ReligiousText: :religioustext
14
+ :ProductRelationCode: :x455
15
+ :DiscountCodeTypeName: :j378
16
+ :BiographicalNote: :b044
17
+ :NewSupplier: :newsupplier
18
+ :ThesisPresentedTo: :b369
19
+ :SubjectSchemeIdentifier: :b067
20
+ :ResourceVersionFeatureType: :x442
21
+ :ExtentType: :b218
22
+ :ComponentNumber: :b289
23
+ :MarketDate: :marketdate
24
+ :UnpricedItemType: :j192
25
+ :SupplyDetail: :supplydetail
26
+ :ScriptCode: :x420
27
+ :ContentDate: :contentdate
28
+ :Discount: :discount
29
+ :PriceCondition: :pricecondition
30
+ :ImprintIdentifier: :imprintidentifier
31
+ :StudyBibleType: :b389
32
+ :PublishingDateRole: :x448
33
+ :PrizeCode: :g129
34
+ :CopyrightOwnerIdentifier: :copyrightowneridentifier
35
+ :AncillaryContentDescription: :x424
36
+ :OnOrder: :j351
37
+ :EpubUsageType: :x318
38
+ :RegionsExcluded: :x452
39
+ :ProductFormFeatureDescription: :b336
40
+ :Bible: :bible
41
+ :MinimumOrderQuantity: :j263
42
+ :EmailAddress: :j272
43
+ :TextContent: :textcontent
44
+ :ResourceFeature: :resourcefeature
45
+ :CollectionIdentifier: :collectionidentifier
46
+ :ListName: :x432
47
+ :TitlesBeforeNames: :b038
48
+ :SupplierIdentifier: :supplieridentifier
49
+ :SalesOutlet: :salesoutlet
50
+ :FreeQuantity: :j265
51
+ :ConferenceRole: :b051
52
+ :YearOfAnnual: :b020
53
+ :TelephoneNumber: :j270
54
+ :PriceStatus: :j266
55
+ :ContributorPlace: :contributorplace
56
+ :AgentIdentifier: :agentidentifier
57
+ :RecordReference: :a001
58
+ :ProductClassificationType: :b274
59
+ :PersonName: :b036
60
+ :CountryOfManufacture: :x316
61
+ :AudienceRangePrecision: :b075
62
+ :SentDateTime: :x307
63
+ :ReligiousTextFeature: :religioustextfeature
64
+ :ProductSupply: :productsupply
65
+ :NoCollection: :x411
66
+ :DiscountCoded: :discountcoded
67
+ :BookClubAdoption: :k169
68
+ :ThesisType: :b368
69
+ :SubjectSchemeName: :b171
70
+ :ROWSalesRightsType: :x456
71
+ :MarketDateRole: :j408
72
+ :ExtentUnit: :b220
73
+ :ComponentTypeName: :b288
74
+ :Website: :website
75
+ :SupportingResource: :supportingresource
76
+ :Sender: :sender
77
+ :PriceConditionQuantity: :priceconditionquantity
78
+ :ImprintIDType: :x445
79
+ :ContentDateRole: :x429
80
+ :Subject: :subject
81
+ :PublishingDetail: :publishingdetail
82
+ :OnOrderDetail: :onorderdetail
83
+ :EpubUsageUnit: :x321
84
+ :PrizeCountry: :g128
85
+ :CopyrightStatement: :copyrightstatement
86
+ :Audience: :audience
87
+ :Reissue: :reissue
88
+ :ProductFormFeatureType: :b334
89
+ :NameAsSubject: :nameassubject
90
+ :BibleContents: :b352
91
+ :TextItem: :textitem
92
+ :ResourceFeatureType: :x438
93
+ :LocationIdentifier: :locationidentifier
94
+ :CollectionIDType: :x344
95
+ :TitleText: :b203
96
+ :SupplierIDType: :j345
97
+ :SalesOutletIdentifier: :salesoutletidentifier
98
+ :Product: :product
99
+ :FromLanguage: :x412
100
+ :ConferenceSponsor: :conferencesponsor
101
+ :DateFormat: :j260
102
+ :Territory: :territory
103
+ :NumberOfCopies: :x323
104
+ :PriceType: :x462
105
+ :ContributorPlaceRelator: :x418
106
+ :AgentIDType: :j400
107
+ :RecordSourceIdentifier: :recordsourceidentifier
108
+ :ProductComposition: :x314
109
+ :Measurement: :c094
110
+ :CountryOfPublication: :b083
111
+ :AudienceRangeQualifier: :b074
112
+ :PersonNameInverted: :b037
113
+ :SequenceNumber: :b034
114
+ :ReligiousTextFeatureCode: :b359
115
+ :ProfessionalAffiliation: :professionalaffiliation
116
+ :LanguageCode: :b252
117
+ :NoContributor: :n339
118
+ :EpubTechnicalProtection: :x317
119
+ :CBO: :j375
120
+ :ThesisYear: :b370
121
+ :SubjectSchemeVersion: :b068
122
+ :ReturnsCode: :j269
123
+ :ExtentValue: :b219
124
+ :Conference: :conference
125
+ :MarketPublishingDetail: :marketpublishingdetail
126
+ :WebsiteDescription: :b294
127
+ :Tax: :tax
128
+ :PriceConditionQuantityType: :x464
129
+ :ImprintName: :b079
130
+ :ContentDetail: :contentdetail
131
+ :PublishingRole: :b291
132
+ :CopyrightYear: :b087
133
+ :AudienceCode: :b073
134
+ :OrderTime: :j144
135
+ :ExpectedDate: :j302
136
+ :PrizeJury: :g343
137
+ :ReissueDate: :j365
138
+ :ProductFormFeatureValue: :b335
139
+ :NameIdentifier: :nameidentifier
140
+ :BiblePurpose: :b354
141
+ :TextItemIDType: :b285
142
+ :ResourceForm: :x441
143
+ :CollectionType: :x329
144
+ :LocationIDType: :j377
145
+ :TitleType: :b202
146
+ :SupplierName: :j137
147
+ :SalesOutletIDType: :b393
148
+ :DefaultCurrencyCode: :m186
149
+ :PriceAmount: :j151
150
+ :IDTypeName: :b233
151
+ :ConferenceSponsorIDType: :b391
152
+ :PublisherIdentifier: :publisheridentifier
153
+ :ContributorRole: :b035
154
+ :AgentName: :j401
155
+ :NumberOfIllustrations: :b125
156
+ :PriceTypeDescription: :j262
157
+ :RecordSourceIDType: :x311
158
+ :ProductContentType: :b385
159
+ :MeasureType: :x315
160
+ :CurrencyCode: :j152
161
+ :AudienceRangeValue: :b076
162
+ :PositionOnList: :x433
163
+ :SourceName: :x330
164
+ :ReligiousTextFeatureDescription: :b360
165
+ :ProfessionalPosition: :b045
166
+ :CitationNote: :x434
167
+ :LanguageRole: :b253
168
+ :NoEdition: :n386
169
+ :EditionNumber: :b057
170
+ :TitleDetail: :titledetail
171
+ :Subtitle: :b029
172
+ :ReturnsCodeType: :j268
173
+ :ExtentValueRoman: :x421
174
+ :ConferenceAcronym: :b341
175
+ :MarketPublishingStatus: :j407
176
+ :WebsiteLink: :b295
177
+ :TaxAmount: :x474
178
+ :Addressee: :addressee
179
+ :PriceConditionType: :x463
180
+ :InitialPrintRun: :k167
181
+ :ContentItem: :contentitem
182
+ :PublishingStatus: :b394
183
+ :PrizeName: :g126
184
+ :CorporateName: :b047
185
+ :AudienceCodeType: :b204
186
+ :PackQuantity: :j145
187
+ :Extent: :extent
188
+ :ReissueDescription: :j366
189
+ :ProductIDType: :b221
190
+ :NameIDType: :x415
191
+ :BibleReferenceLocation: :b356
192
+ :TextItemIdentifier: :textitemidentifier
193
+ :ResourceLink: :x435
194
+ :ComparisonProductPrice: :comparisonproductprice
195
+ :LocationName: :j349
196
+ :TitleWithoutPrefix: :b031
197
+ :SupplierOwnCoding: :supplierowncoding
198
+ :SalesOutletName: :b382
199
+ :DefaultLanguageOfText: :m184
200
+ :PriceCode: :x468
201
+ :IDValue: :b244
202
+ :ConferenceSponsorIdentifier: :conferencesponsoridentifier
203
+ :StockQuantityCode: :j297
204
+ :PublisherIDType: :x447
205
+ :PrimaryContentType: :x416
206
+ :ContributorStatement: :b049
207
+ :AgentRole: :j402
208
+ :NumberOfItemsOfThisForm: :x322
209
+ :EndDate: :b325
210
+ :RecordSourceName: :a197
211
+ :ProductForm: :b012
212
+ :PositionOnProduct: :x313
213
+ :MeasureUnitCode: :c095
214
+ :CurrencyZone: :x475
215
+ :Barcode: :barcode
216
+ :SourceTitle: :x428
217
+ :ReligiousTextFeatureType: :b358
218
+ :PromotionCampaign: :k165
219
+ :NotificationType: :a002
220
+ :EditionStatement: :b058
221
+ :CitedContent: :citedcontent
222
+ :LastPageNumber: :b287
223
+ :TitleElement: :titleelement
224
+ :SuffixToKey: :b248
225
+ :ReturnsCodeTypeName: :x460
226
+ :MarketPublishingStatusNote: :x406
227
+ :FaxNumber: :j271
228
+ :ConferenceDate: :b054
229
+ :WebsiteRole: :b367
230
+ :TaxRateCode: :x471
231
+ :PriceDate: :pricedate
232
+ :KeyNames: :b040
233
+ :Contributor: :contributor
234
+ :AddresseeIdentifier: :addresseeidentifier
235
+ :PublishingStatusNote: :b395
236
+ :PrizeYear: :g127
237
+ :PageRun: :pagerun
238
+ :CorporateNameInverted: :x443
239
+ :AudienceCodeTypeName: :b205
240
+ :RelatedMaterial: :relatedmaterial
241
+ :ProductIdentifier: :productidentifier
242
+ :NamesAfterKey: :b041
243
+ :DiscountAmount: :x469
244
+ :BibleTextFeature: :b357
245
+ :TextItemType: :b290
246
+ :ResourceMode: :x437
247
+ :MainSubject: :x425
248
+ :Complexity: :complexity
249
+ :ToLanguage: :x413
250
+ :SupplierRole: :j292
251
+ :SalesRestriction: :salesrestriction
252
+ :PriceCoded: :pricecoded
253
+ :Illustrated: :x422
254
+ :ConferenceTheme: :b342
255
+ :DefaultPriceType: :x310
256
+ :Text: :d104
257
+ :StockQuantityCodeType: :j293
258
+ :PublisherName: :b081
259
+ :NumberOfPages: :b061
260
+ :EpubUsageConstraint: :epubusageconstraint
261
+ :PrimaryPart: :x457
262
+ :CopiesSold: :k168
263
+ :AlternativeName: :alternativename
264
+ :RecordSourceType: :a194
265
+ :ProductFormDescription: :b014
266
+ :MessageNote: :m183
267
+ :BarcodeType: :x312
268
+ :PrefixToKey: :b247
269
+ :SourceType: :x431
270
+ :ReligiousTextIdentifier: :b376
271
+ :PromotionContact: :k166
272
+ :LatestReprintNumber: :x446
273
+ :EditionType: :x419
274
+ :CitedContentType: :x430
275
+ :TitleElementLevel: :x409
276
+ :Supplier: :supplier
277
+ :ReturnsConditions: :returnsconditions
278
+ :FeatureNote: :x440
279
+ :ConferenceName: :b052
280
+ :Measure: :measure
281
+ :WorkIdentifier: :workidentifier
282
+ :TaxRatePercent: :x472
283
+ :PriceDateRole: :x476
284
+ :Language: :language
285
+ :ContributorDate: :contributordate
286
+ :AddresseeIDType: :m380
287
+ :Header: :header
288
+ :Quantity: :x320
289
+ :ProductAvailability: :j396
290
+ :CountriesIncluded: :x449
291
+ :AudienceCodeValue: :b206
292
+ :PartNumber: :x410
293
+ :SenderIDType: :m379
294
+ :RelatedProduct: :relatedproduct
295
+ :ProductPackaging: :b225
296
+ :NamesBeforeKey: :b039
297
+ :DiscountCode: :j364
298
+ :BibleTextOrganization: :b355
299
+ :TextSourceCorporate: :b374
300
+ :SubjectCode: :b069
301
+ :ResourceVersion: :resourceversion
302
+ :ComplexityCode: :b078
303
+ :MapScale: :b063
304
+ :TradeCategory: :b384
305
+ :SupplyDate: :supplydate
306
+ :SalesRestrictionNote: :x453
307
+ :PriceCodeType: :x465
308
+ :IllustrationsNote: :b062
309
+ :ContactName: :x299
310
+ :DeletionText: :a199
311
+ :StockQuantityCodeTypeName: :j296
312
+ :PublisherRepresentative: :publisherrepresentative
313
+ :AncillaryContent: :ancillarycontent
314
+ :ONIXMessage: :ONIXmessage
315
+ :EpubUsageLimit: :epubusagelimit
316
+ :PrintedOnProduct: :x301
317
+ :CopyrightOwner: :copyrightowner
318
+ :RegionCode: :b398
319
+ :ProductFormDetail: :b333
320
+ :Date: :b306
321
+ :MessageNumber: :m180
322
+ :BatchBonus: :batchbonus
323
+ :Price: :price
324
+ :StartDate: :b324
325
+ :ReprintDetail: :k309
326
+ :Publisher: :publisher
327
+ :LettersAfterNames: :b042
328
+ :EditionVersionNumber: :b217
329
+ :CityOfPublication: :b209
330
+ :TitlePrefix: :b030
331
+ :SupplierCodeType: :x458
332
+ :SalesRights: :salesrights
333
+ :FeatureValue: :x439
334
+ :ConferenceNumber: :b053
335
+ :Number: :b257
336
+ :WorkIDType: :b201
337
+ :TaxableAmount: :x473
338
+ :PricePer: :j239
339
+ :ContributorDateRole: :x417
340
+ :AddresseeName: :x300
341
+ :QuantityUnit: :x466
342
+ :ProductClassification: :productclassification
343
+ :CountriesExcluded: :x451
344
+ :AudienceDescription: :b207
345
+ :Percent: :b337
346
+ :SenderIdentifier: :senderidentifier
347
+ :RelatedWork: :relatedwork
348
+ :ProductPart: :productpart
349
+ :NameType: :x414
350
+ :DiscountCodeType: :j363
351
+ :BibleVersion: :b353
352
+ :TextType: :x426
353
+ :SubjectHeadingText: :b070
354
+ :ResourceVersionFeature: :resourceversionfeature
355
+ :ComplexitySchemeIdentifier: :b077
356
+ :Market: :market
357
+ :UnnamedPersons: :b249
358
+ :SupplyDateRole: :x461
359
+ :SalesRestrictionType: :b381
360
+ :DescriptiveDetail: :descriptivedetail
361
+ :PriceCodeTypeName: :x477
362
+ :Collection: :collection
363
+ :Imprint: :imprint
364
+ :ContentAudience: :x427
365
+ :StockQuantityCoded: :stockquantitycoded
366
+ :PublishingDate: :publishingdate
367
+ :Prize: :prize
368
+ :CopyrightOwnerIDType: :b392
369
+ :AncillaryContentType: :x423
370
+ :OnHand: :j350
371
+ :EpubUsageStatus: :x319
372
+ :RegionsIncluded: :x450
373
+ :ProductFormFeature: :productformfeature
374
+ :MessageRepeat: :m181
375
+ :BatchQuantity: :j264
376
+ :TextAuthor: :d107
377
+ :Stock: :stock
378
+ :ResourceContentType: :x436
379
+ :CollateralDetail: :collateraldetail
380
+ :LevelSequenceNumber: :b284
381
+ :TitlesAfterNames: :b043
382
+ :SupplierCodeValue: :x459
383
+ :SalesRightsType: :b089
384
+ :FirstPageNumber: :b286
385
+ :ConferencePlace: :b055
386
+
387
+ # TAGI NIESTANDARDOWE
388
+ :CoverType: :cover_type
@@ -0,0 +1,91 @@
1
+ # encoding: UTF-8
2
+
3
+ module Elibri
4
+ module MockMethodMissing
5
+
6
+ #TODO: dodać sprawdzanie czy obiekt przypadkiem nie zna metody
7
+ def method_missing(m, *args, &block)
8
+ if m == :product_form_onix_code
9
+ super
10
+ elsif [:kind_of_audio?, :kind_of_book?, :kind_of_map?, :kind_of_ebook?, :kind_of_measurable?].include? m
11
+ nil #TODO - dlaczego tak jest, jak to poprawić
12
+ elsif [:publisher_id, :publisher_symbol, :record_reference, :ean, :no_isbn,
13
+ :ean_other_than_isbn, :product_form_onix_code, :file_size, :publication_year,
14
+ :publication_month, :publication_day, :number_of_pages, :number_of_illustrations,
15
+ :width, :height, :thickness, :weight, :duration, :map_scale, :authorship_kind,
16
+ :series_membership_kind, :set_membership_kind, :created_at, :updated_at,
17
+ :book_cover_type_onix_code, :edition_statement, :audience_age_from,
18
+ :audience_age_to, :sale_restricted_to, :sale_restricted_for, :imprint_id,
19
+ :_publishing_status_onix_code, :sale_restricted, :isbn_id, :price_amount ,
20
+ :price_currency, :price_printed_on_product_onix_code, :pack_quantity, :state,
21
+ :__elibri_product_category1_identifier, :__elibri_product_category2_identifier,
22
+ :template_product_id, :title, :subtitle, :or_title, :cascading_title, :collection_id,
23
+ :collection_part, :title_part, :vat, :pkwiu , :print_run, :medial_patronage, :media_action_plan,
24
+ :city_of_publication, :cover_type_id, :paper_type_id, :publisher_product_category1_id,
25
+ :publisher_product_category2_id, :sale_restricted_to_poland, :platon_export_id, :azymut_export_id,
26
+ :import_verified, :matras_export_id, :dictum_export_id, :elibri_product_category1_id, :elibri_product_category2_id,
27
+ :super_siodemka_export_id, :wilga_xml_checksum, :isbn_from_import, :external_id, :stock_operator, :stock_quantity,
28
+ :motyl_product_id, :exported_to_motyl, :exported_to_motyl_at, :motyl_export_id, :epub_technical_protection_onix_code,
29
+ :product_form_detail_onix_code, :epub_sale_restricted_to, :epub_sale_not_restricted, :settlement_id,
30
+ :collection, :trade_title, :imprint, :publisher_name, :sale_restricted?, :skip_ProductSupply, :cover_type, :preview_exists?].include? m #nieobowiązkowe pola
31
+ begin
32
+ super
33
+ rescue Mocha::ExpectationError
34
+ nil
35
+ end
36
+ elsif [:series_memberships, :product_availabilities, :contributors, :languages,
37
+ :elibri_product_categories, :publisher_product_categories, :other_texts, :attachments].include? m #nieobowiązkowe relacje
38
+ begin
39
+ super
40
+ rescue Mocha::ExpectationError
41
+ []
42
+ end
43
+ else
44
+ begin
45
+ super
46
+ rescue Mocha::ExpectationError
47
+ nil
48
+ end
49
+ end
50
+ end
51
+
52
+
53
+ end
54
+
55
+
56
+
57
+ module Attributes
58
+ DIMENSION_ATTRIBUTES = [ :width, :height, :thickness, :weight ]
59
+ EPUB_ATTRIBUTES = [ :file_size, :epub_technical_protection_onix_code, :product_form_detail_onix_code, :epub_sale_restricted_to, :epub_sale_not_restricted ]
60
+ BOOK_ATTRIBUTES = [ :number_of_pages, :number_of_illustrations, :excerpt, :edition_statement ]
61
+
62
+ # Lista pól, które nie mają sensu dla określonych typów produktów.
63
+ EXCLUDED_ATTRIBUTES = {
64
+ # książka
65
+ "BA" => [:duration, :map_scale, EPUB_ATTRIBUTES].flatten,
66
+ # e-book
67
+ "EA" => [:duration, :paper_type_id, :stock_quantity, :stock_operator, :print_run, :pack_quantity, :map_scale, :cover_type_id, DIMENSION_ATTRIBUTES].flatten,
68
+ # kalendarz
69
+ "PC" => [:duration, :map_scale, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
70
+ # audio DVD
71
+ "AI" => [:map_scale, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
72
+ # audio CD
73
+ "AC" => [:map_scale, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
74
+ # kaseta magnetofonowa
75
+ "AB" => [:map_scale, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
76
+ # audio MP3
77
+ "AJ" => [:map_scale, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
78
+ # inny format kartograficzny
79
+ "CZ" => [:duration, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
80
+ # mapa w rolce
81
+ "CD" => [:duration, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
82
+ # mapa płaska
83
+ "CC" => [:duration, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
84
+ # mapa składana
85
+ "CB" => [:duration, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
86
+ # mapa
87
+ "CA" => [:duration, :cover_type_id, BOOK_ATTRIBUTES, EPUB_ATTRIBUTES].flatten,
88
+ }
89
+
90
+ end
91
+ end