Module: Jekyll::Tasks::Related
Overview
Verify related API
Constant Summary collapse
- MINIMUM_RELATED_PRODUCTS =
5
Instance Method Summary collapse
Instance Method Details
#all_products_with_related(api = api_data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jekyll/tasks/related.rb', line 11 def (api = api_data) errors = [] Products.model_list.each do |product| if api[product] count = api[product].count errors << "Only has #{count} related products: #{product}" if count < MINIMUM_RELATED_PRODUCTS else errors << "Doesn't have related products: #{product}" end end errors.empty? ? 'OK' : errors end |
#all_related_exist ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jekyll/tasks/related.rb', line 24 def errors = [] models = Products.model_list api_data.each do |key, | next unless models.include? key errors += (key, ) end errors.empty? ? 'OK' : errors end |