Class: Edi::MiraklSeller::LeroymerlinAdeo::ProductDataPresenter
Overview
Service object: product data presenter.
Instance Attribute Summary
#image_locales
#current_account, #options, #url_helper
Instance Method Summary
collapse
#images, #initialize, #to_h, #video
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Instance Method Details
#brand ⇒ Object
87
88
89
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 87
def brand
'LOV_270934' end
|
#color ⇒ Object
END TOWEL WARMER RELATED METHODS
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 242
def color
fetched_color = spec_value(:finish) || spec_value(:color)
case fetched_color
when /Polished|Brushed|Stainless|Steel/i
'LOV_038355'
when /Bronze/i
'LOV_004077'
when /Gold/i
'LOV_038356'
when /Black/i
'LOV_001063'
when /White/i
'LOV_001875'
when /Mirror|Glass/i
'LOV_003647'
else
@error_list << "Color #{fetched_color} not mapped for item #{item.sku}."
end
end
|
#energy_saving ⇒ Object
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 355
def energy_saving
'LOV_259111'
end
|
#generic_data ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 6
def generic_data
{
required: {
product_category: mirakl_product_category,
shop_sku: ean13,
i18n_fr_12963_title: name(locale: :fr),
i18n_it_12963_title: name(locale: :it),
i18n_es_12963_title: name(locale: :es),
i18n_pt_12963_title: name(locale: :pt),
feature_06575_brand: brand,
gtin_EAN13: ean13,
i18n_fr_01022_longdescription: detailed_description_html(locale: :fr),
i18n_it_01022_longdescription: detailed_description_html(locale: :it),
i18n_es_01022_longdescription: detailed_description_html(locale: :es),
i18n_pt_01022_longdescription: detailed_description_html(locale: :pt)
},
optional: {
product_administrative_code: item.sku,
media_1: images[0],
media_2: images[1],
media_3: images[2],
media_4: images[3],
media_5: images[4],
media_6: images[5],
media_7: images[6],
media_8: images[7],
media_9: images[8],
parentproductid: nil,
feature_10837_main_color: color,
feature_10840_main_material: nil
}
}
end
|
#height_range ⇒ Object
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 302
def height_range
height = item.rendered_product_specifications.dig(:height, :raw)
return nil if height.blank?
height = height.to_i
if height < 40
'LOV_064242'
elsif height.between?(40, 60)
'LOV_039247'
elsif height.between?(61, 80)
'LOV_204116'
elsif height > 80
'LOV_037580'
end
end
|
#height_range_tw ⇒ Object
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 152
def height_range_tw
height = item.rendered_product_specifications.dig(:height, :raw)
return nil if height.blank?
height = height.to_i
if height < 100
'LOV_037864'
elsif height.between?(100, 150)
'LOV_038230'
elsif height > 150
'LOV_039104'
end
end
|
#infrared_heating_panel_data ⇒ Object
71
72
73
74
75
76
77
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 71
def infrared_heating_panel_data
{
required: {
ATT_15344: 'No'
}
}
end
|
#mirakl_product_category ⇒ Object
79
80
81
82
83
84
85
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 79
def mirakl_product_category
if item.is_infrared_heating_panel?
'200282|RADIATEUR_RAYONNANT|RADIATEUR_ELECTRIQUE|R08-004-001'
elsif item.is_towel_warmer?
'200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002'
end
end
|
#more_info_tw ⇒ Object
114
115
116
117
118
119
120
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 114
def more_info_tw
'LOV_217097'
end
|
#power_range ⇒ Object
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 279
def power_range
watts = item.watts
return nil if watts.blank?
if watts < 750
'LOV_037568'
elsif watts.between?(750, 1000)
'LOV_037572'
elsif watts.between?(1001, 1500)
'LOV_037856'
elsif watts.between?(1501, 2000)
'LOV_037857'
elsif watts > 2000
'LOV_037569'
end
end
|
#product_name_tw ⇒ Object
108
109
110
111
112
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 108
def product_name_tw
'LOV_044694'
end
|
#programmable_tw ⇒ Object
189
190
191
192
193
194
195
196
197
198
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 189
def programmable_tw
'LOV_000002'
end
|
#remote_control_tw ⇒ Object
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 175
def remote_control_tw
'LOV_251958'
end
|
346
347
348
349
350
351
352
353
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 346
def shape_format
'LOV_001197'
end
|
#smart_home ⇒ Object
339
340
341
342
343
344
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 339
def smart_home
'LOV_257288'
end
|
#towel_warmer_data ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 40
def towel_warmer_data
{
required: {
ATT_15344: 'No'
},
optional: {
'feature_10774_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': width_range_tw,
'feature_08547_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': product_name_tw,
'feature_01181_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': more_info_tw,
'feature_22088_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': type_of_product,
'feature_10021_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': tube_shape,
'feature_10777_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': height_range_tw,
'feature_00773_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': 'No',
'feature_13174_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': tw_shape,
'feature_00040_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': tw_use,
'feature_12925_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': programmable_tw,
'feature_10355_200280|SECHE-SERVIETTE_ELECTRIQUE_ENERGIE_SECHE|SECHE_SERVIETTE_ELECTRIQUE|R08-004-002': watts_tw,
ATT_14317: item.spec_value(:watts),
ATT_00052: item.sku,
ATT_00053: item.spec_value(:width),
ATT_00054: item.spec_value(:height),
ATT_05885: item.spec_value(:finish),
ATT_02178: 'No',
ATT_06139: 'No',
ATT_22040: remote_control_tw,
ATT_00055: item.spec_value(:depth),
ATT_26844: 'No'
}
}
end
|
#tube_shape ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 130
def tube_shape
bar_shape = item.spec_value(:bar_shape)
case bar_shape
when 'Round'
'LOV_004325'
when 'Square'
'LOV_000900'
end
end
|
#tw_shape ⇒ Object
144
145
146
147
148
149
150
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 144
def tw_shape
tw_shape = item.spec_value(:overall_towel_warmer_shape)
case tw_shape
when 'Rectangular'
'LOV_001495'
end
end
|
#tw_use ⇒ Object
169
170
171
172
173
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 169
def tw_use
'LOV_237144'
end
|
#type_of_product ⇒ Object
122
123
124
125
126
127
128
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 122
def type_of_product
'LOV_280736'
end
|
#watts_tw ⇒ Object
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 200
def watts_tw
watts = item.spec_value(:watts)
case watts
when 150
'LOV_031515'
end
end
|
#width_range ⇒ Object
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 322
def width_range
width = item.rendered_product_specifications.dig(:width, :raw)
if width < 60
'LOV_047987'
elsif width.between?(60, 80)
'LOV_038586'
elsif width.between?(81, 100)
'LOV_204115'
elsif width > 100
'LOV_037622'
end
end
|
#width_range_tw ⇒ Object
TOWEL WARMER RELATED METHODS
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 94
def width_range_tw
width = item.rendered_product_specifications.dig(:width, :raw)
if width < 50
'LOV_037595'
elsif width == 50
'LOV_034152'
elsif width > 50
'LOV_037242'
end
end
|