Class: Edi::MiraklSeller::BestbuyCaOutlet::ProductDataPresenter
- Inherits:
-
Edi::MiraklSeller::BestbuyCa::ProductDataPresenter
- Object
- SimpleDelegator
- BasePresenter
- Edi::MiraklSeller::BaseMiraklPresenter
- Edi::MiraklSeller::BestbuyCa::ProductDataPresenter
- Edi::MiraklSeller::BestbuyCaOutlet::ProductDataPresenter
- Defined in:
- app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb
Overview
Service object: product data presenter.
Constant Summary collapse
- HOME_AUTOMATION_CATEGORY =
BBYCat code, not the human path (see parent class for context).
'CAT_37144'- FALLBACK_PRODUCT_CONDITION =
Fallback when an Outlet item doesn't carry an explicit
condition
spec yet. Must be one of Best Buy's_ProductCondition_LOV literals
(seecanonicalize_condition). Set toRefurbished Excellentto match
the grade the existing Outlet catalog products already carry — sending a
different condition (e.g.Open Box) makes Best Buy fork a separate
product entity from the live "Refurbished" one, which then can't bind to
the existing offer. Override per-item once Heatwave tracks the resale
grade on CatalogItem (or wherever it lands). 'Refurbished Excellent'
Constants inherited from Edi::MiraklSeller::BestbuyCa::ProductDataPresenter
Edi::MiraklSeller::BestbuyCa::ProductDataPresenter::BATHROOM_CATEGORY, Edi::MiraklSeller::BestbuyCa::ProductDataPresenter::DEFAULT_PRODUCT_CONDITION, Edi::MiraklSeller::BestbuyCa::ProductDataPresenter::HEATER_CATEGORY
Instance Attribute Summary
Attributes inherited from Edi::MiraklSeller::BaseMiraklPresenter
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
- #best_buy_category ⇒ Object
-
#family ⇒ Object
Add floor-heating cable dispatch to the parent's four-way family selector.
- #family_data ⇒ Object
-
#floor_heating_cable_data ⇒ Object
─── Floor heating cable family (Outlet only) ────────────────────────.
-
#product_condition ⇒ Object
Outlet items carry a graded condition.
Methods inherited from Edi::MiraklSeller::BestbuyCa::ProductDataPresenter
#accessory?, #bathroom_material_family, #bathroom_mirror?, #bathroom_mirror_data, #colour_family, #country_of_origin, #dim_cm, #dim_inches, #electric_heater_technology, #french_compliant_flag, #generic_data, #heater_type_label, #images, #indoor_heater?, #indoor_heater_data, #outdoor_heater?, #outdoor_heater_data, #short_description_for_bb, #spec_color, #spec_finish, #spec_material, #thermostat_label, #to_h, #towel_warmer_data, #weight_kg, #yes_no
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
#best_buy_category ⇒ Object
88 89 90 91 92 |
# File 'app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb', line 88 def best_buy_category return HOME_AUTOMATION_CATEGORY if family == :floor_heating_cable super end |
#family ⇒ Object
Add floor-heating cable dispatch to the parent's four-way family
selector.
43 44 45 46 47 |
# File 'app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb', line 43 def family return :floor_heating_cable if item.is_floor_heating_product? super end |
#family_data ⇒ Object
49 50 51 52 53 |
# File 'app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb', line 49 def family_data return floor_heating_cable_data if family == :floor_heating_cable super end |
#floor_heating_cable_data ⇒ Object
─── Floor heating cable family (Outlet only) ────────────────────────
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb', line 71 def floor_heating_cable_data { required: { _ProductCondition_20257570_CAT_37144_EN: product_condition }, optional: { # The Home Automation category in the LOV reference has a sparser # required-attribute set than Heaters/Bathroom — most floor-cable # specs land in the long description rather than as structured # facets. Map the dimensional + electrical fields where Best Buy # exposes them; leave product-type LOV mappings nil and refine # against import errors after the first feed. _Weight_5302_CAT_37144_EN: weight_kg } } end |
#product_condition ⇒ Object
Outlet items carry a graded condition. Marketplace presenter pins
this to Brand New; we either read it from the catalog item spec
or fall back to a documented default.
58 59 60 61 62 63 64 65 66 67 |
# File 'app/services/edi/mirakl_seller/bestbuy_ca_outlet/product_data_presenter.rb', line 58 def product_condition raw = item.try(:condition_grade) || item.try(:spec_value, :condition) || FALLBACK_PRODUCT_CONDITION mapped = canonicalize_condition(raw) return mapped if mapped @error_list << "Best Buy Outlet condition unmapped for #{item.sku}: #{raw.inspect}; defaulting to #{FALLBACK_PRODUCT_CONDITION}" FALLBACK_PRODUCT_CONDITION end |