Sha256: 7b9bb770d60fd53c60fe95efd112d4ac827d79e7eb21f3d3faf389a6252ff807
Contents?: true
Size: 998 Bytes
Versions: 2
Compression:
Stored size: 998 Bytes
Contents
module Workarea module MailChimp class Product include ActionView::Helpers::AssetUrlHelper include Core::Engine.routes.url_helpers include Storefront::Engine.routes.url_helpers include Workarea::ApplicationHelper attr_reader :product def initialize(product) @product = product end # @return Hash def to_h { id: product.id.to_s, title: product.name, handle: product.slug, url: product_url(id: product.to_param, host: Workarea.config.host), description: product.description.to_s, image_url: primary_image, variants: variants } end private def variants @variants ||= product.variants.map{ |v| Variant.new(v).to_h } end def primary_image Workarea.config.host + ProductPrimaryImageUrl.new(product).path end def mounted_core self end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-mail_chimp-3.0.3 | app/services/workarea/mail_chimp/product.rb |
workarea-mail_chimp-3.0.2 | app/services/workarea/mail_chimp/product.rb |