Class: Edi::MiraklSeller::BestbuyCaOutlet::ProductDataPresenter

Inherits:
Edi::MiraklSeller::BestbuyCa::ProductDataPresenter show all
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
(see canonicalize_condition). Set to Refurbished Excellent to 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

#image_locales

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

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_categoryObject



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

#familyObject

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_dataObject



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_dataObject

─── 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_conditionObject

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