README.md
[![Code Climate](https://codeclimate.com/github/MatayoshiMariano/spree_weigth_calculator/badges/gpa.svg)](https://codeclimate.com/github/MatayoshiMariano/spree_weigth_calculator)
SpreeWeigthCalculator
=====================
This is a calculator that calculates (cuak!) the shipping cost based on the weight, volume, price of the order and the sum of the width, height and depth. To do that we have created an end-point that calculate that for us.
Installation
------------
Add spree_weigth_calculator to your Gemfile:
```ruby
gem 'spree_weigth_calculator'
```
Bundle your dependencies and run the installation generator:
```shell
bundle
bundle exec rails g spree_weigth_calculator:install
```
Configuration
----------
The calculator has two preferences:
1. URL
The preference `URL` is the endpoint. For example: `https://logistic.domain.com/cost`.
The endpoint should be like:
`https://logistic.domain.com/cost/#{zip}?volume=#{volume}&weight=#{weight}&dimension=#{dimension}`
Testing
-------
First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
```shell
bundle
bundle exec rake
```
When testing your applications integration with this extension you may use it's factories.
Simply add this require statement to your spec_helper:
```ruby
require 'spree_weigth_calculator/factories'
```
TODO
----
1. Set the `weight`, `dimension` and `volume` as optional parameters in the URL.
2. Add some tests.