Class: Edi::MiraklSeller::Bricodepot::ProductDataPresenter
- Inherits:
-
Edi::MiraklSeller::BaseMiraklPresenter
- Object
- SimpleDelegator
- BasePresenter
- Edi::MiraklSeller::BaseMiraklPresenter
- Edi::MiraklSeller::Bricodepot::ProductDataPresenter
- Defined in:
- app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb
Instance Attribute Summary
Attributes inherited from Edi::MiraklSeller::BaseMiraklPresenter
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
- #bar_shape_tw ⇒ Object
- #brand ⇒ Object
- #color ⇒ Object
- #depth ⇒ Object
- #fix_type_panel ⇒ Object
- #generic_data ⇒ Object
- #heating_area ⇒ Object
- #height ⇒ Object
- #instalation_type_tw ⇒ Object
- #mirakl_product_category ⇒ Object
- #product_weight ⇒ Object
- #radiant_panel_data ⇒ Object
- #screen_type ⇒ Object
- #towel_warmer_data ⇒ Object
- #watts ⇒ Object
- #width ⇒ Object
Methods inherited from Edi::MiraklSeller::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
#bar_shape_tw ⇒ Object
123 124 125 126 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 123 def # Redonda-Recta 5473 5473 end |
#brand ⇒ Object
118 119 120 121 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 118 def brand # WarmlyYours 18092 18_092 end |
#color ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 157 def color fetched_color = spec_value(:finish) || spec_value(:color) case fetched_color when /Polished|Brushed|Stainless|Steel/i 16_918 when /Bronze/i 13_633 when /Gold/i 13_636 when /Black/i 2936 when /White/i 2930 when /Mirror|Glass/i 2940 else @error_list << ("Color #{fetched_color} not mapped for item #{item.sku}.") end end |
#depth ⇒ Object
185 186 187 188 189 190 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 185 def depth depth = spec_value(:depth, output_unit: 'cm') return nil unless depth.present? depth.to_i end |
#fix_type_panel ⇒ Object
133 134 135 136 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 133 def fix_type_panel # Tornillos y tacos 5826 5826 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 36 37 38 39 40 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 3 def generic_data { required: { category: mirakl_product_category, shop_sku: ean13, name: public_short_name(locale: :es), # Short name because Bricodepot has a 75 character limit identifier_brand: brand, mirakl_image_1: images[0], identifier_ean: ean13, 'advertising_descripcion_comercial-es_ES': detailed_description_html(locale: :es), gpsr_manufaturer_name: 'WarmlyYours B.V.', gpsr_2023_compliant: 'Yes', gpsr_digital_assets_1: 'No', gpsr_digital_assets_2: 'No', gpsr_digital_assets_3: 'No', gpsr_digital_assets_4: 'No', gpsr_digital_assets_5: 'No', gpsr_digital_assets_6: 'No', gpsr_digital_assets_7: 'No', gpsr_digital_assets_8: 'No', gpsr_digital_assets_9: 'No' }, optional: { 'name-pt_PT': public_short_name(locale: :pt), weight: product_weight, mirakl_image_2: images[1], mirakl_image_3: images[2], mirakl_image_4: images[3], mirakl_image_5: images[4], mirakl_image_6: images[5], 'advertising_descripcion_comercial-pt_PT': detailed_description_html(locale: :pt), has_mirakl_offers: nil, technical_vendedor: nil, resources_marca: 'WarmlyYours' } } end |
#heating_area ⇒ Object
192 193 194 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 192 def heating_area spec_value(:heating_area) end |
#height ⇒ Object
143 144 145 146 147 148 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 143 def height height = spec_value(:height, output_unit: 'cm') return nil unless height.present? height.to_i end |
#instalation_type_tw ⇒ Object
128 129 130 131 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 128 def instalation_type_tw # Pared 5914 5914 end |
#mirakl_product_category ⇒ Object
110 111 112 113 114 115 116 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 110 def mirakl_product_category if is_radiant_panel? '6394' elsif is_towel_warmer? '6393' end end |
#product_weight ⇒ Object
181 182 183 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 181 def product_weight base_weight_converted(unit: 'kg').round(2) end |
#radiant_panel_data ⇒ Object
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 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 74 def radiant_panel_data { optional: { advertising_modelo: primary_product_line.public_name(locale: :es), resources_grupo_color: finish, technical_clasificacion_eficiencia_energetica: nil, technical_control_temperatura: 'Yes', technical_funcion_ventanas_abiertas: 'No', technical_funciones: nil, technical_grado_proteccion_ip: nil, technical_incluye_mando_distancia: 'No', technical_material: spec_value(:material), technical_numero_elementos: nil, technical_opcion_wifi: 'No', technical_patas_incluidas: 'No', technical_potencia: nil, technical_proteccion_contra_sobrecalentamiento: 'Yes', technical_proteccion_contra_sobrecarga: 'Yes', technical_tamano_estancia: rendered_product_specifications.dig(:heating_area, :output), technical_tipo_pantalla: screen_type, technical_con_ruedas: 'No', technical_tipo_fijacion: fix_type_panel, marketplace_alto_producto: height, marketplace_ancho_producto: width, marketplace_diametro_producto: nil, marketplace_fondo_producto: depth, marketplace_longitud_producto: nil, technical_manual_instrucciones: nil, resources_color_producto: color, technical_incluye: nil, quality_normas: nil, quality_fichas_seguridad: nil } } end |
#screen_type ⇒ Object
138 139 140 141 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 138 def screen_type # sin pantalla 6007 6007 end |
#towel_warmer_data ⇒ Object
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 70 71 72 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 42 def towel_warmer_data { optional: { advertising_modelo: primary_product_line.public_name(locale: :es), resources_grupo_color: finish, technical_clasificacion_eficiencia_energetica: nil, technical_funciones: nil, technical_grado_proteccion_ip: nil, technical_longitud_cable: spec_value(:cord_length), technical_potencia: nil, technical_proteccion_contra_sobrecalentamiento: 'Yes', technical_rango_temperatura_funcionamiento: nil, technical_tension: spec_value(:voltage), technical_termostato_programable: 'No', technical_tipo_barra: , technical_tipo_instalacion: instalation_type_tw, technical_tipo_pantalla: screen_type, marketplace_alto_producto: height, marketplace_ancho_producto: width, marketplace_diametro_producto: nil, marketplace_fondo_producto: depth, marketplace_longitud_producto: nil, technical_manual_instrucciones: nil, resources_color_producto: color, technical_incluye: nil, quality_normas: nil, technical_categoria_complementaria: nil, quality_fichas_seguridad: nil } } end |
#watts ⇒ Object
177 178 179 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 177 def watts spec_value(:watts) end |
#width ⇒ Object
150 151 152 153 154 155 |
# File 'app/services/edi/mirakl_seller/bricodepot/product_data_presenter.rb', line 150 def width width = spec_value(:width, output_unit: 'cm') return nil unless width.present? width.to_i end |