Skip to content

atul-supernova/spree_stock_notifications

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spree Stock Notifications

Get email notifications when:

  • an item is running low on stock
  • an item goes out of stock

Installation

Add spree_stock_notifications to your Gemfile:

gem 'spree_stock_notifications'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_stock_notifications:install

Configure notification settings config/initializers/spree_stock_notifications.rb

Spree.config do |config|
  admin_role   = Spree::Role.find_by_name('admin')
  admin_emails = admin_role.users.map(&:email).join(',')

  # comma separated list of emails
  config.stock_notifications_list = admin_emails

  # when stock level reaches the "low stock threshold", admins will be notified. Default is 1
  config.low_stock_threshold = 2
end

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

Joshua Nussbaum is a Freelance Software Consultant. You can reach me at [email protected]

Copyright (c) 2014 Joshua Nussbaum, released under the New BSD License

About

Get notifications when stock is low or item goes out of stock

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 96.9%
  • HTML 3.1%