Sha256: 3189ab11eccd5aae74ca76d95e2be11cc30879683e99c5fe37dd97f318c51d18

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

class Spree::Api::V1::ChannableController < Spree::Api::BaseController

  before_action :get_products, only: [:variant_feed, :product_feed]

  def variant_feed
    headers["Content-Type"] = 'application/atom+xml; charset=utf-8'
    render plain: Spree::Product.to_channable_variant_xml(@products)
  end

  def product_feed
    headers["Content-Type"] = 'application/atom+xml; charset=utf-8'
    render plain: Spree::Product.to_channable_product_xml(@products)
  end

  private

  def get_products
    @products = Spree::Product.active.includes([:option_types, :taxons, product_properties: :property, variants: [{option_values: :option_type}, :default_price, :images], master: [{option_values: :option_type}, :default_price, :images]])
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_channable-0.0.24 app/controllers/spree/api/v1/channable_controller.rb
spree_channable-0.0.23 app/controllers/spree/api/v1/channable_controller.rb
spree_channable-0.0.22 app/controllers/spree/api/v1/channable_controller.rb
spree_channable-0.0.21 app/controllers/spree/api/v1/channable_controller.rb
spree_channable-0.0.20 app/controllers/spree/api/v1/channable_controller.rb
spree_channable-0.0.18.alpha app/controllers/spree/api/v1/channable_controller.rb