Class: Edi::MiraklSeller::Maxeda::ProductDataPresenter
- Inherits:
-
BaseMiraklPresenter
- Object
- SimpleDelegator
- BasePresenter
- BaseMiraklPresenter
- Edi::MiraklSeller::Maxeda::ProductDataPresenter
- Defined in:
- app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb
Overview
Service object: product data presenter.
Instance Attribute Summary
Attributes inherited from BaseMiraklPresenter
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
- #brand ⇒ Object
- #color ⇒ Object
- #control_type ⇒ Object
- #cord_length ⇒ Object
- #depth ⇒ Object
- #generic_data ⇒ Object
- #height ⇒ Object
- #infrared_heating_panel_data ⇒ Object
- #measure_unit ⇒ Object
- #mirakl_product_category ⇒ Object
- #mounting ⇒ Object
- #power_type ⇒ Object
- #power_unit ⇒ Object
- #product_name(locale_s) ⇒ Object
- #size ⇒ Object
- #towel_warmer_data ⇒ Object
- #tube_shape ⇒ Object
- #tw_technology ⇒ Object
- #warranty_text ⇒ Object
- #weight ⇒ Object
- #weight_unit ⇒ Object
- #width ⇒ Object
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
#brand ⇒ Object
238 239 240 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 238 def brand 'WarmlyYours' end |
#color ⇒ Object
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 286 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_type ⇒ Object
232 233 234 235 236 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 232 def control_type return unless spec_value(:on_off_switch).to_b 'bouton_poussoir' end |
#cord_length ⇒ Object
313 314 315 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 313 def cord_length spec_value(:cord_length) end |
#depth ⇒ Object
306 307 308 309 310 311 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 306 def depth depth = spec_value(:depth, output_unit: 'cm') return nil if depth.blank? depth.to_i 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 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 67 68 69 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 6 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 |
#height ⇒ Object
262 263 264 265 266 267 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 262 def height height = spec_value(:height, output_unit: 'cm') return nil if height.blank? height.to_i end |
#infrared_heating_panel_data ⇒ Object
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 204 205 206 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 126 def infrared_heating_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 |
#measure_unit ⇒ Object
250 251 252 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 250 def measure_unit 'centimetre' end |
#mirakl_product_category ⇒ Object
216 217 218 219 220 221 222 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 216 def mirakl_product_category if is_infrared_heating_panel? '10005717' elsif is_towel_warmer? '10002654' end end |
#mounting ⇒ Object
325 326 327 328 329 330 331 332 333 334 335 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 325 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_type ⇒ Object
258 259 260 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 258 def power_type 'secteur' end |
#power_unit ⇒ Object
254 255 256 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 254 def power_unit 'volts' end |
#product_name(locale_s) ⇒ Object
208 209 210 211 212 213 214 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 208 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 |
#size ⇒ Object
228 229 230 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 228 def size spec_value(:size, output_unit: 'cm') end |
#towel_warmer_data ⇒ Object
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 122 123 124 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 71 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_shape ⇒ Object
276 277 278 279 280 281 282 283 284 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 276 def tube_shape = item.spec_value(:bar_shape) case when 'Round' 'gs1_modeltubedesignradiator_horizontale_ronde_buizen' when 'Square' 'gs1_modeltubedesignradiator_horizontale_platte_buizen' end end |
#tw_technology ⇒ Object
224 225 226 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 224 def tw_technology 'rayonnant' end |
#warranty_text ⇒ Object
317 318 319 320 321 322 323 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 317 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 |
#weight ⇒ Object
242 243 244 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 242 def weight base_weight_converted(unit: 'kg').round(2) end |
#weight_unit ⇒ Object
246 247 248 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 246 def weight_unit 'kg' end |
#width ⇒ Object
269 270 271 272 273 274 |
# File 'app/services/edi/mirakl_seller/maxeda/product_data_presenter.rb', line 269 def width width = spec_value(:width, output_unit: 'cm') return nil if width.blank? width.to_i end |