Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple_marketplace

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple_marketplace

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SimpleMarketplace

Ruby gem that operates simple checkout cart operations.

Installation

Add this line to your application's Gemfile:

gem 'simple_marketplace'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_marketplace

Usage

Create some products

# Let's create some products here...
SimpleMarketplace::Product.create(
    { code: "001", name: "Lavender Heart", price: BigDecimal.new("9.25") },
    { code: "002", name: "Personalised cufflinks", price: BigDecimal.new("45", 4) },
    { code: "003", name: "Kids T-shirt", price: BigDecimal.new("19.95", 4) })

Create a checkout basket and add items to it

co = SimpleMarketplace::Checkout.new

co.scan("001")
co.scan("002")
co.scan("001")

Check the total

co.pretty_total
=> £36.95

Customize promotions


promotion = SimpleMarketplace::Offer::ProductDiscountByAmount.new('001', 2, BigDecimal.new("8.50"))
co = SimpleMarketplace::Checkout.new(promotion)

Development

  • bin/setup to install dependencies;
  • rake spec to run the tests;
  • bin/console for an interactive prompt that will allow you to experiment.
  • ruby examples/usage to see this gem in action (check the source).

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pedroaugustosb/simple_marketplace.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 04 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc