Shopicruit
This is a RubyGem that will calculate the maximum amount of products that you would be able to purchase at Shopicruit store.
Installation
Add this line to your application's Gemfile:
gem 'shopicruit'
And then execute:
$ bundle
Or install it yourself as:
$ gem install shopicruit
Usage
- maxAmount method calculates the maximum amount of items that could be purchased within the weight limit.
It takes three arguments:- First argument takes in the maximum weight in kg.
- Second argument takes in the desired return type. ('cost', 'weight', or 'products')
- Third arguments takes in a list of types of products. ('Keyboard', 'Computer', 'Clock', 'Car', 'Bottle', 'Wallet', 'Knife', 'Lamp', 'Table', 'Chair', 'Hat', 'Shoes', 'Plate', 'Gloves', 'Bag', 'Coat', 'Pants')
# Total cost
Shopicruit.maxAmount(100, 'cost', ['Computer' ,'Keyboard'])
# Total weight
Shopicruit.maxAmount(100, 'weight', ['Computer' ,'Keyboard'])
# A list of purchased items
Shopicruit.maxAmount(100, 'products', ['Computer' ,'Keyboard'])
- leaseCost method will take into account the cost.
# Total cost
Shopicruit.leaseCost(100, 'cost', ['Computer' ,'Keyboard'])
# Total weight
Shopicruit.leaseCost(100, 'weight', ['Computer' ,'Keyboard'])
# A list of purchased items
Shopicruit.leaseCost(100, 'products', ['Computer' ,'Keyboard'])
Happy shopping.
License
The gem is available as open source under the terms of the MIT License.