Class: Edi::MiraklSeller::Leclerc::ProductDataPresenter
- Inherits:
-
BaseMiraklPresenter
- Object
- SimpleDelegator
- BasePresenter
- BaseMiraklPresenter
- Edi::MiraklSeller::Leclerc::ProductDataPresenter
- Defined in:
- app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb
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
- #measure_unit ⇒ Object
- #mirakl_product_category ⇒ Object
- #power_type ⇒ Object
- #power_unit ⇒ Object
- #radiant_panel_data ⇒ Object
- #size ⇒ Object
- #towel_warmer_data ⇒ 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
130 131 132 133 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 130 def brand # WarmlyYours 18092 'warmlyyours' end |
#color ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 169 def color fetched_color = spec_value(:finish) || spec_value(:color) case fetched_color when /Polished|Brushed|Stainless|Steel/i 'inox-15' when /Bronze/i 'bronze-14' when /Gold/i 'dore-14' when /Black/i 'noir-01' when /White/i 'blanc-02' when /Mirror|Glass/i 'argent-15' else @error_list << ("Color #{fetched_color} not mapped for item #{item.sku}.") end end |
#control_type ⇒ Object
124 125 126 127 128 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 124 def control_type return unless spec_value(:on_off_switch).to_b 'bouton_poussoir' end |
#cord_length ⇒ Object
196 197 198 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 196 def cord_length spec_value(:cord_length) end |
#depth ⇒ Object
189 190 191 192 193 194 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 189 def depth depth = spec_value(:depth, output_unit: 'cm') return nil unless depth.present? depth.to_i 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 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 3 def generic_data { required: { categorie: mirakl_product_category, shop_sku: sku, libelle: name(locale: :fr), description: detailed_description_html(locale: :fr), ean: ean13, image1: images[0] }, optional: { image2: images[1], image3: images[2], image4: images[3], image5: images[4], image6: images[5], image7: images[6], url_video: nil, reference_fabricant: sku, hauteur_emballe: nil, largeur_emballe: nil, nombre_de_colis: nil, poids_emballe: nil, unite_poids_emballe: nil, unite_mesure_emballe: nil, profondeur_emballe: nil, plus_produit: nil, google_product_category: nil, codelec: nil } } end |
#height ⇒ Object
155 156 157 158 159 160 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 155 def height height = spec_value(:height, output_unit: 'cm') return nil unless height.present? height.to_i end |
#measure_unit ⇒ Object
143 144 145 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 143 def measure_unit 'centimetre' end |
#mirakl_product_category ⇒ Object
108 109 110 111 112 113 114 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 108 def mirakl_product_category if is_radiant_panel? 'chauffage_panneaux_rayonnant' elsif is_towel_warmer? 'seche_serviette' end end |
#power_type ⇒ Object
151 152 153 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 151 def power_type 'secteur' end |
#power_unit ⇒ Object
147 148 149 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 147 def power_unit 'volts' end |
#radiant_panel_data ⇒ Object
63 64 65 66 67 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 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 63 def radiant_panel_data { required: { marque: brand }, optional: { disponibilite_pieces_detachees: nil, details_concernant_garantie: nil, puissance_watts: watts, notice_utilisation: nil, poids: weight, unite_poids: weight_unit, accessoires_inclus: nil, alimentation: volts, unite_alimentation: power_unit, type_alimentation: power_type, arret_automatique: 'No', autres_informations: nil, part_number: sku, fabricant: brand, interrupteur_marche_arret: 'No', largeur_produit: width, hauteur_produit: height, unite_mesure_dimension_produit: measure_unit, longueur_produit: depth, frequence: nil, longueur_cordon: cord_length, matiere_principale: nil, securite: nil, label_liste: nil, compatible_internet_des_objets: nil, garantie_texte: warranty_text, garantie_constructeur: warranty_text, reprise_des_dechets: nil, url_image1_leclerc: nil, url_image2_leclerc: nil, url_image3_leclerc: nil, url_image4_leclerc: nil, url_image5_leclerc: nil, url_image6_leclerc: nil, url_image7_leclerc: nil } } end |
#size ⇒ Object
120 121 122 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 120 def size spec_value(:size, output_unit: 'cm') end |
#towel_warmer_data ⇒ Object
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 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 36 def towel_warmer_data { required: { marque: brand, couleur: color, technologie_de_chauffage: tw_technology, puissance_watts: watts, dimensions: size }, optional: { label_liste: nil, reprise_des_dechets: nil, idparent: nil, type_de_produit_categorie: mirakl_product_category, norme_ou_certification: nil, garantie_constructeur: warranty_text, details_concernant_garantie: nil, disponibilite_pieces_detachees: nil, garantie_texte: warranty_text, programmable: 'No', type_commande: control_type, classe_protection_electrique: nil, securite: nil } } end |
#tw_technology ⇒ Object
116 117 118 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 116 def tw_technology 'rayonnant' end |
#warranty_text ⇒ Object
200 201 202 203 204 205 206 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 200 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
135 136 137 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 135 def weight base_weight_converted(unit: 'kg').round(2) end |
#weight_unit ⇒ Object
139 140 141 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 139 def weight_unit 'kg' end |
#width ⇒ Object
162 163 164 165 166 167 |
# File 'app/services/edi/mirakl_seller/leclerc/product_data_presenter.rb', line 162 def width width = spec_value(:width, output_unit: 'cm') return nil unless width.present? width.to_i end |