Class: Edi::MiraklSeller::Maxeda::ProductDataPresenter

Inherits:
BaseMiraklPresenter show all
Defined in:
app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb

Instance Attribute Summary

Attributes inherited from BaseMiraklPresenter

#image_locales

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BaseMiraklPresenter

#images, #initialize, #to_h, #video

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from Edi::MiraklSeller::BaseMiraklPresenter

Instance Method Details

#brandObject



235
236
237
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 235

def brand
  'WarmlyYours'
end

#colorObject



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 283

def color
  fetched_color = spec_value(:finish) || spec_value(:color)
  case fetched_color
  when /Polished|Brushed|Stainless|Steel/i
    'gs1_colourfamily_metaal_rvs'
  when /Bronze/i
    'gs1_colourfamily_metaal_brons'
  when /Gold/i
    'gs1_colourfamily_goud'
  when /Black/i
    'gs1_colourfamily_zwart'
  when /White/i
    'gs1_colourfamily_wit'
  when /Mirror|Glass/i
    'gs1_colourfamily_zilver'
  else
    @error_list << "Color #{fetched_color} not mapped for item #{item.sku}."
  end
end

#control_typeObject



229
230
231
232
233
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 229

def control_type
  return unless spec_value(:on_off_switch).to_b

  'bouton_poussoir'
end

#cord_lengthObject



310
311
312
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 310

def cord_length
  spec_value(:cord_length)
end

#depthObject



303
304
305
306
307
308
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 303

def depth
  depth = spec_value(:depth, output_unit: 'cm')
  return nil unless depth.present?

  depth.to_i
end

#generic_dataObject



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
36
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/maxeda/product_data_presenter.rb', line 3

def generic_data
  {
    required: {
      online_hybris_category: mirakl_product_category,
      seller_product_id: sku,
      proddesc_online_product_name_mirakl: product_name('en'),
      proddesc_online_body_text_mirakl: detailed_description_html,
      core_gtin: ean13,
      core_brand_name: brand,
      proddesc_online_product_name_NL_NL: product_name('nl'),
      proddesc_online_product_name_NL_BE: product_name('nl'),
      proddesc_online_product_name_FR_BE: product_name('fr'),
      proddesc_online_body_text_NL_BE: detailed_description_html(locale: :nl),
      proddesc_online_body_text_NL_NL: detailed_description_html(locale: :nl),
      proddesc_online_body_text_FR_BE: detailed_description_html(locale: :fr),
      hero_image: images[0],
      media_assets_instance_record_1: images[1]
    },
    optional: {
      parentproductid: nil,
      descriptionShort_NL_BE: short_description(locale: :nl),
      descriptionShort_NL_NL: short_description(locale: :nl),
      descriptionShort_FR_BE: short_description(locale: :fr),
      media_assets_instance_record_2: images[2],
      media_assets_instance_record_3: images[3],
      media_assets_instance_record_4: images[4],
      media_assets_instance_record_5: images[5],
      media_assets_instance_record_6: images[6],
      media_assets_instance_record_7: images[7],
      media_assets_instance_record_8: images[8],
      media_assets_instance_record_9: images[9],
      media_assets_instance_record_10: nil,
      media_assets_instance_record_11: nil,
      online_max_usp_1_NL_BE: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_1) },
      online_max_usp_1_NL_NL: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_1) },
      online_max_usp_1_FR_BE: Mobility.with_locale(:fr) { item.spec_output(:maxeda_special_feature_1) },
      online_max_usp_2_NL_BE: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_2) },
      online_max_usp_2_NL_NL: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_2) },
      online_max_usp_2_FR_BE: Mobility.with_locale(:fr) { item.spec_output(:maxeda_special_feature_2) },
      online_max_usp_3_NL_BE: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_3) },
      online_max_usp_3_NL_NL: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_3) },
      online_max_usp_3_FR_BE: Mobility.with_locale(:fr) { item.spec_output(:maxeda_special_feature_3) },
      online_max_usp_4_NL_BE: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_4) },
      online_max_usp_4_NL_NL: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_4) },
      online_max_usp_4_FR_BE: Mobility.with_locale(:fr) { item.spec_output(:maxeda_special_feature_4) },
      online_max_usp_5_NL_BE: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_5) },
      online_max_usp_5_NL_NL: Mobility.with_locale(:nl) { item.spec_output(:maxeda_special_feature_5) },
      online_max_usp_5_FR_BE: Mobility.with_locale(:fr) { item.spec_output(:maxeda_special_feature_5) },
      core_sales_unit_content: nil,
      core_sales_unit_content_uom: nil,
      energyLabel: nil,
      core_consumer_unit_depth: depth,
      core_consumer_unit_width: width,
      core_consumer_unit_height: height,
      common_wood_origin: nil,
      wood_certificate_pefc_indicator: nil,
      wood_certificate_fsc_indicator: nil,
      assigned_web_category: nil,
      assigned_web_category_name_fr_be: nil,
      assigned_web_category_name_nl_be: nil,
      assigned_web_category_name_nl_nl: nil
    }
  }
end

#heightObject



259
260
261
262
263
264
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 259

def height
  height = spec_value(:height, output_unit: 'cm')
  return nil unless height.present?

  height.to_i
end

#measure_unitObject



247
248
249
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 247

def measure_unit
  'centimetre'
end

#mirakl_product_categoryObject



213
214
215
216
217
218
219
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 213

def mirakl_product_category
  if is_radiant_panel?
    '10005717'
  elsif is_towel_warmer?
    '10002654'
  end
end

#mountingObject



322
323
324
325
326
327
328
329
330
331
332
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 322

def mounting
  mounting = spec_value(:mounting_locations)
  case mounting
  when 'Wall Mounted'
    'gs1_installationmethod_wandmontage'
  when 'Wall or Ceiling Mounted'
    'gs1_installationmethod_aan_plafond_gemonteerd'
  when 'Free Standing'
    'gs1_installationmethod_vrijstaand'
  end
end

#power_typeObject



255
256
257
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 255

def power_type
  'secteur'
end

#power_unitObject



251
252
253
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 251

def power_unit
  'volts'
end

#product_name(locale_s) ⇒ Object



205
206
207
208
209
210
211
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 205

def product_name(locale_s)
  if name(locale: locale_s).length <= 100
    name(locale: locale_s)
  else
    public_short_name(locale: locale_s)
  end
end

#radiant_panel_dataObject



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 123

def radiant_panel_data
  {
    required: {
      catspec_suitable_room_size: spec_value(:heating_area),
      catspec_mains_voltage: voltage,
      catspec_efficiency_percentage: 100.00,
      catspec_energy_source__not_for_powered_equipment_: 'gs1_energysourcenotforpoweredequipm_elektriciteit',
      catspec_fine_dust_emission: 0,
      catspec_with_carrying_or_integrated_handle_indicator: 'No',
      catspec_type_of_heating: 'gs1_typeofheating_infrarood',
      catspec_suitable_for_damp_spaces_indicator: 'Yes',
      catspec_gastec_mark_indicator: 'No',
      catspec_energy_rating_code: 'gs1_energyratingcode_zzzanders',
      catspec_cordless_indicator: 'No',
      catspec_handle_free_indicator: 'No',
      catspec_power_cord_cable: 'gs1_powercordcable_inclusief',
      catspec_input_voltage: 240
    },
    optional: {
      catspec_finish: 'gs1_finish_geen_afwerking',
      catspec_line_NL_BE: nil,
      catspec_other_value_NL_BE: nil,
      catspec_application_NL_NL: nil,
      catspec_number_of_settings: nil,
      catspec_type_of_material: nil,
      catspec_with_flame_protection_indicator: nil,
      catspec_line_FR_BE: nil,
      catspec_overheating_safety_device_indicator: nil,
      catspec_length_of_power_cord_cable_hose: spec_value(:cord_length),
      catspec_digital_analogue_type: nil,
      catspec_flue_gas_outlet_diameter: nil,
      catspec_with_on_off_switch_indicator: 'Yes',
      catspec_thermostat_indicator: 'No',
      catspec_line_NL_NL: nil,
      catspec_colour_family: color,
      catspec_heating_volume: nil,
      catspec_colour_NL_NL: nil,
      catspec_application_NL_BE: nil,
      catspec_material: nil,
      catspec_with_oxygen_deficiency_protection_indicator: 'No',
      catspec_movable_indicator: 'No',
      catspec_uv_proof_indicator: 'No',
      catspec_other_value_NL_NL: nil,
      catspec_with_wheels_indicator: 'No',
      catspec_kema_mark_indicator: 'No',
      catspec_with_anti_freeze_mode_indicator: 'No',
      catspec_with_remote_control_indicator: 'No',
      catspec_material_property: 'gs1_materialproperty_hittebestendig',
      catspec_electrical_safety_class: nil,
      catspec_maximum_adjustability: nil,
      catspec_adjustable_indicator: nil,
      catspec_application_FR_BE: nil,
      catspec_impregnation_class: nil,
      catspec_co2_emissions: 0,
      catspec_type_of_adjustability: 'gs1_toadjustability_vaste_standen',
      catspec_with_fan_function_indicator: 'No',
      catspec_fsc_mark_indicator: 'No',
      catspec_thermal_fuse_indicator: 'No',
      catspec_colour_NL_BE: 'No',
      catspec_with_handle_indicator: 'No',
      catspec_ip_protection_rating: 'gs1_ipprotectionrating_ip65',
      catspec_start_up_by_technician_indicator: 'No',
      catspec_weather_proof_indicator: nil,
      catspec_anti_fall_safety_device: nil,
      catspec_indoor_outdoor_use: 'gs1_indooroutdooruse_binnen',
      catspec_pefc_mark_indicator: nil,
      catspec_colour_FR_BE: nil,
      catspec_with_built_in_timer_indicator: 'No',
      catspec_other_value_FR_BE: nil,
      catspec_timer_type: nil,
      catspec_with_fixings_indicator: nil,
      catspec_coverage_conditions_NL_NL: nil,
      catspec_wifi_indicator: 'No',
      catspec_installation_method: mounting,
      catspec_number_of_operating_hours: nil,
      catspec_maximum_electrical_power: watts,
      catspec_consumption: 0,
      catspec_diameter_drain_hole2: nil
    }
  }
end

#sizeObject



225
226
227
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 225

def size
  spec_value(:size, output_unit: 'cm')
end

#towel_warmer_dataObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 68

def towel_warmer_data
  {
    required: {
      catspec_with_application_system_indicator: 'No',
      catspec_energy_saving_indicator: 'No',
      catspec_line_NL_NL: finish,
      catspec_colour_family: color,
      catspec_power_rating: watts,
      catspec_electric_indicator: 'Yes',
      catspec_energy_rating_code: 'gs1_energyratingcode_zzzanders',
      catspec_material: 'gs1_material_staal',
      catspec_thermostat_indicator: 'No',
      catspec_line_NL_BE: finish,
      catspec_mounting_fixing_method: 'gs1_mountingfixingmethod_wandbevestiging',
      catspec_line_FR_BE: finish,
      catspec_type_of_article: 'gs1_typeofarticle_handdoekdroger'
    },
    optional: {
      catspec_movable_indicator: nil,
      catspec_timer_type: 'gs1_timertype_zzzanders',
      catspec_number_of_heat_settings: nil,
      catspec_maximum_range: nil,
      catspec_other_value_NL_NL: nil,
      catspec_wifi_indicator: 'No',
      catspec_length_of_power_cord_cable_hose: cord_length,
      catspec_with_remote_control_indicator: 'No',
      catspec_impregnation_class: nil,
      catspec_finish: nil,
      catspec_texture_type: nil,
      catspec_type_of_material: 'gs1_typeofmaterial_rvs_inox',
      catspec_fsc_mark_indicator: 'No',
      catspec_maximum_temperature_resistance: nil,
      catspec_frost_resistance_function_indicator: 'No',
      catspec_type_of_panel_radiator: nil,
      catspec_style: 'gs1_style_modern',
      catspec_other_value_FR_BE: nil,
      catspec_with_fixings_indicator: 'No',
      catspec_colour_NL_NL: nil,
      catspec_number_of_fixing_points: nil,
      catspec_colour_NL_BE: nil,
      catspec_heating_volume: spec_value(:heating_area),
      catspec_material_property: nil,
      catspec_with_built_in_timer_indicator: 'No',
      catspec_model_tube_design_radiator: tube_shape,
      catspec_with_on_off_switch_indicator: 'Yes',
      catspec_suitable_room_size: nil,
      catspec_overheating_safety_device_indicator: nil,
      catspec_ip_protection_rating: 'gs1_ipprotectionrating_ip44',
      catspec_pefc_mark_indicator: nil,
      catspec_other_value_NL_BE: nil,
      catspec_colour_FR_BE: nil
    }
  }
end

#tube_shapeObject



273
274
275
276
277
278
279
280
281
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 273

def tube_shape
  bar_shape = item.spec_value(:bar_shape)
  case bar_shape
  when 'Round'
    'gs1_modeltubedesignradiator_horizontale_ronde_buizen'
  when 'Square'
    'gs1_modeltubedesignradiator_horizontale_platte_buizen'
  end
end

#tw_technologyObject



221
222
223
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 221

def tw_technology
  'rayonnant'
end

#warranty_textObject



314
315
316
317
318
319
320
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 314

def warranty_text
  if is_refurbished?
    'La garantie pour les produits reconditionnés est de 1 an à partir de la date d’achat.'
  else
    'Garantie de 3 ans à compter de la date d’achat.'
  end
end

#weightObject



239
240
241
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 239

def weight
  base_weight_converted(unit: 'kg').round(2)
end

#weight_unitObject



243
244
245
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 243

def weight_unit
  'kg'
end

#widthObject



266
267
268
269
270
271
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 266

def width
  width = spec_value(:width, output_unit: 'cm')
  return nil unless width.present?

  width.to_i
end