Class: Edi::MiraklSeller::LeroymerlinAdeo::ProductDataPresenter
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
84
85
86
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 84
def brand
'LOV_270934' end
|
#color ⇒ Object
END TOWEL WARMER RELATED METHODS
239
240
241
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
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 239
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 352
def energy_saving
'LOV_259111'
end
|
#generic_data ⇒ Object
3
4
5
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
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 3
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 299
def height_range
height = item.rendered_product_specifications.dig(:height, :raw)
return nil unless height.present?
height = height.to_i
if height < 40
'LOV_064242'
elsif height >= 40 && height <= 60
'LOV_039247'
elsif height >= 61 && height <= 80
'LOV_204116'
elsif height > 80
'LOV_037580'
end
end
|
#height_range_tw ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 149
def height_range_tw
height = item.rendered_product_specifications.dig(:height, :raw)
return nil unless height.present?
height = height.to_i
if height < 100
'LOV_037864'
elsif height >= 100 && height <= 150
'LOV_038230'
elsif height > 150
'LOV_039104'
end
end
|
#mirakl_product_category ⇒ Object
76
77
78
79
80
81
82
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 76
def mirakl_product_category
if item.is_radiant_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
111
112
113
114
115
116
117
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 111
def more_info_tw
'LOV_217097'
end
|
#power_range ⇒ Object
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 276
def power_range
watts = item.watts
return nil unless watts.present?
if watts < 750
'LOV_037568'
elsif watts >= 750 && watts <= 1000
'LOV_037572'
elsif watts >= 1001 && watts <= 1500
'LOV_037856'
elsif watts >= 1501 && watts <= 2000
'LOV_037857'
elsif watts > 2000
'LOV_037569'
end
end
|
#product_name_tw ⇒ Object
105
106
107
108
109
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 105
def product_name_tw
'LOV_044694'
end
|
#programmable_tw ⇒ Object
186
187
188
189
190
191
192
193
194
195
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 186
def programmable_tw
'LOV_000002'
end
|
#radiant_panel_data ⇒ Object
68
69
70
71
72
73
74
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 68
def radiant_panel_data
{
required: {
ATT_15344: 'No'
}
}
end
|
#remote_control_tw ⇒ Object
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 172
def remote_control_tw
'LOV_251958'
end
|
343
344
345
346
347
348
349
350
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 343
def shape_format
'LOV_001197'
end
|
#smart_home ⇒ Object
336
337
338
339
340
341
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 336
def smart_home
'LOV_257288'
end
|
#towel_warmer_data ⇒ Object
37
38
39
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
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 37
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
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 127
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
141
142
143
144
145
146
147
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 141
def tw_shape
tw_shape = item.spec_value(:overall_towel_warmer_shape)
case tw_shape
when 'Rectangular'
'LOV_001495'
end
end
|
#tw_use ⇒ Object
166
167
168
169
170
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 166
def tw_use
'LOV_237144'
end
|
#type_of_product ⇒ Object
119
120
121
122
123
124
125
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 119
def type_of_product
'LOV_280736'
end
|
#watts_tw ⇒ Object
197
198
199
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
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 197
def watts_tw
watts = item.spec_value(:watts)
case watts
when 150
'LOV_031515'
end
end
|
#width_range ⇒ Object
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 319
def width_range
width = item.rendered_product_specifications.dig(:width, :raw)
if width < 60
'LOV_047987'
elsif width >= 60 && width <= 80
'LOV_038586'
elsif width >= 81 && width <= 100
'LOV_204115'
elsif width > 100
'LOV_037622'
end
end
|
#width_range_tw ⇒ Object
TOWEL WARMER RELATED METHODS
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'app/services/edi/mirakl_seller/leroymerlin_adeo/product_data_presenter.rb', line 91
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
|