Class: Dugway::Drops::ProductsDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
lib/dugway/liquid/drops/products_drop.rb

Instance Attribute Summary

Attributes inherited from BaseDrop

#params, #request, #source

Instance Method Summary collapse

Methods inherited from BaseDrop

#before_method, #cart, #context=, #error, #errors, #initialize, #method_missing, #store, #theme

Constructor Details

This class inherits a constructor from Dugway::Drops::BaseDrop

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dugway::Drops::BaseDrop

Instance Method Details

#allObject



6
7
8
# File 'lib/dugway/liquid/drops/products_drop.rb', line 6

def all
  sort_and_paginate source
end

#currentObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dugway/liquid/drops/products_drop.rb', line 10

def current
  sort_and_paginate begin
    if artist.present?
      dropify store.artist_products(artist)
    elsif category.present?
      dropify store.category_products(category)
    elsif search_terms.present?
      dropify store.search_products(search_terms)
    else
      source
    end
  end
end

#on_saleObject



24
25
26
# File 'lib/dugway/liquid/drops/products_drop.rb', line 24

def on_sale
  sort_and_paginate source.select { |p| p['on_sale'] }
end