Class: Edi::MiraklSeller::BaseMiraklPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Edi::MiraklSeller::BaseMiraklPresenter
- Defined in:
- app/services/edi/mirakl_seller/base_mirakl_presenter.rb
Direct Known Subclasses
Edi::MiraklSeller::Bricodepot::ProductDataPresenter, Edi::MiraklSeller::Bricomarche::ProductDataPresenter, Castorama::ProductDataPresenter, Leclerc::ProductDataPresenter, LeroymerlinAdeo::ProductDataPresenter, Maxeda::ProductDataPresenter
Instance Attribute Summary collapse
-
#image_locales ⇒ Object
readonly
Returns the value of attribute image_locales.
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
- #images ⇒ Object
-
#initialize(item, options = {}) ⇒ BaseMiraklPresenter
constructor
def self.required_attributes=(*attributes) self.required_attributes = attributes end.
- #to_h ⇒ Object
- #video ⇒ Object
Methods inherited from BasePresenter
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Constructor Details
#initialize(item, options = {}) ⇒ BaseMiraklPresenter
def self.required_attributes=(*attributes)
self.required_attributes = attributes
end
12 13 14 15 16 |
# File 'app/services/edi/mirakl_seller/base_mirakl_presenter.rb', line 12 def initialize(item, = {}) @image_locales = .delete(:image_locales) @error_list = [] super(item, nil, ) end |
Instance Attribute Details
#image_locales ⇒ Object (readonly)
Returns the value of attribute image_locales.
4 5 6 |
# File 'app/services/edi/mirakl_seller/base_mirakl_presenter.rb', line 4 def image_locales @image_locales end |
Instance Method Details
#images ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/services/edi/mirakl_seller/base_mirakl_presenter.rb', line 30 def images # Use website image profiles (up to 9 images for Mirakl) item.image_profiles .website_image_profiles .image_order .includes(:image) .limit(9) .map { |p| p.image.image_url(width: 2000, height: 2000, encode_format: :jpeg) } end |
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/edi/mirakl_seller/base_mirakl_presenter.rb', line 18 def to_h data = generic_data if is_towel_warmer? data = data.deep_merge towel_warmer_data elsif is_radiant_panel? data = data.deep_merge radiant_panel_data else raise "Category for item #{id} - not presentable" end data end |
#video ⇒ Object
40 41 42 |
# File 'app/services/edi/mirakl_seller/base_mirakl_presenter.rb', line 40 def video Item::VideoRetriever.new(tags: 'for-product-page').process(item).all_videos[0] end |