SpreeMatkahuolto
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'spree_matkahuolto'
And then execute:
$ bundle
Or install it yourself as:
$ gem install spree_matkahuolto
Then, to copy and execute the migrations, run:
$ rails g spree_matkahuolto:install
Then, add this requirement in your application.js.coffee
#= require shipping_method_matkahuolto
And add this requirement to your application.scss
*= require shipping_method_matkahuolto
Usage
Give Rails access to your Matkahuolto credentials (username, password and test_mode) as environment variables:
ENV["#{Rails.env.upcase}_MATKAHUOLTO_USERNAME"]
ENV["#{Rails.env.upcase}_MATKAHUOLTO_PASSWORD"]
ENV["#{Rails.env.upcase}_MATKAHUOLTO_TEST_MODE"]
[NOTE: Because ENV should only contain string, value of ENV["#{Rails.env.upcase}_MATKAHUOLTO_TEST_MODE"] should be either "true" or "false"]
In the Spree backend, shipping methods which internal names contains the following will be automatically linked to Matkahuolto backend:
matkahuolto_lahella
matkahuolto_jako
In the Spree checkout process, on the delivery method selection page, Matkahuolto Lahella will display a selection of available pickup places
In the Spree backend, any order that used Matkahuolto Lahella or Matkahuolto Jako as a delivery method will now provide a "print labels" link enabling to automatically download the package label PDF generated by Matkahuolto.
The Labels are saved to the file system. This rake tasks cleans up all labels older than 3 weeks:
rake labels:cleanup
You can setup a 'whenever' scheduled job by adding the following lines to your config/schedule.rb
every :sunday, :at => '12pm' do
rake "labels:cleanup"
end
Don't forget to use the 'whenever' capistrano script to deploy your scheduled job.
Contributing
- Fork it ( https://github.com/[my-github-username]/spree_matkahuolto/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request