Skip to content
Switch branches/tags
This branch is up to date with master.

Latest commit


Git stats


Failed to load latest commit information.
= Fraktjakt

	This is a Plugin to make it easier to search for the best shipping-service in 
	and to place an order there for shipment-handling, creation of shipping-documents and 
	sending edifact to the shipping-company.
	Fraktjakt is a service for comparing and purchasing shipping services over the Internet. 
	It is available both as a web site ( and as an API that can be 
	called by other services on the Internet. 

=== Why integrate with Fraktjakt?

	Because it's completely free to use, and it will save you time and money!
	If you have a web shop, Fraktjakt gives you simpler shipping support and discounted shipping prices. 
	Your customers will be able to choose the quickest, cheapest or most convenient shipping alternative 
	when they purchase products on Fraktjakt's site.
	Fraktjakt eliminates the need to procure shipping contracts, since Fraktjakt 
	have already negotiated good shipping contracts for you. 
	Fraktjakt also makes your shipping management very simple, so you can focus more on selling your products.
	Fraktjakt help you save on both domestic and international shipping. 
	This is possible because Frkajakt have volume based contracts with the shippers.
	You get access to these discounted prices when you use Fraktjakt with your web shop.
	When you integrate Fraktjakt's order handling system with your application's sales functions, 
	you are essentially plugging in your system to a variety of shipping providers. 
	Fraktjakt manages all of your communication with the shippers. 
	It also generates the necessary shipping documents, etc.

== Installation

	This plugin doesn't depend on anything except the Ruby standard library
	To install the plugin itself, simply just drop the whole directory into your application's "vendor/plugins" directory. 
	  Starting with version 1.0rc of rails, it will be automatically picked for you by rails plugin mechanism.
	Don't forget to generate rdoc
	rake doc:plugins
	For more information about different options, 
	please download the latest version Fraktjakt's API-documentation at:
	While you develop and tests your installation you should set :debug to true. This will send your calls to the test-server
	and prevent you from making any real orders. 

=== Configuration Possibilities with Fraktjakt

	Selection of which shipping services your customers may choose when they 
        make purchases in your web shop;
	Selection of whether to sort the shipping alternatives by time or price when 
        they are presented to your customers; 
	Selection of whether shipping time will be displayed as Number of days or Arrival time; 
	Selection of Free shipping when a customer's purchase exceeds a specific amount;
	Setting a price for picking up a product in person instead of having it shipped; 
	Definition of optional standard box dimensions, if you want Fraktjakt to use these;
	Selection of which days shippers can pick up products for delivery;
	Definition of pick-up times, if applicable.

=== Useful functions 

	Fraktjakt can handle all products in the customer's shopping cart, 
        regardless of whether they are sent as separate 
	parcels or if multiple products are packaged together in a standard box. 
	Fraktjakt allows you to define the dimensions of individual products. This 
        provides more exact price calculations.
	Fraktjakt can determine which products in your customer's shopping cart will fit into your 
        standard boxes and base the shipping prices on your standard box size. 
        This is normally cheaper than basing the shipping prices on the dimensions of 
        your individual products.  
	Fraktjakt estimates delivery times based on your settings,
        i.e. which days shippers can come and pick up products for delivery, along with any specific 
        pick-up times that you may have defined. 
	Your customers only see the shipping alternatives that you want them to be able to choose. 
	When your customers choose delivery that is not door-to-door, they are shown the nearest pick-up location and 
	      how far it is from their address to that location.
	Fraktjakt provides links to maps that help your customers locate pick-up locations.
	Fraktjakt prepares booking and pick-up of one or more shipments. 
	Frakt creates shipping documents for both domestic and international shipments, 
        to be printed out on your own printer.

== General Instruction

  To use Fraktjakt as your integration with a shipping company you need to do the folowing steps:
  1. Register a webshop in Fraktjakt. They call all users that has options to integrate with 
     them Webshops wether they actually are webshop or not.
     Go the the 'webbutik'-settings under your account and write down your consignor ID and KEY.
     A consignor is the buyer of the freight and ID and KEY is what identifies you in the system.
     Think of it as you user-name and password.
  2. Install this plugin in your application.
  3. Send in a freight-query with the shipment-method. 
     See the rdoc or the source-code for that method for available options.
  4. Use one of the results from that query to place an order in Fraktjakt. 
     To do that, call the order-method with the received shipment_id 
     See the rdoc or the source-code for all available options to that call.
	5. When you are ready to send your shipments
       Log in to Fraktjakt
       Go to your orders
       Click on the button to pay for all your orders at the same time.
       Pay for them and at the same tima make sure your booking-times are what you want.
       Print out your shipping-instructions and go to the agent or wait for the shipper.

== Example

=== Controller

==== class SearchController < ApplicationController
  # This action will give you a list of different shipment-services
  def index
    address = {   :street1 => 'c/o Johansson',
                  :street2 => 'Östra storgatan 49',
                  :postal_code => '55321',
                  :city_name => 'Jönköping', 
                  :country_code => 'SE',
                  :residential => true
    fraktjakt =
      :consignor_id => 2,
      :consignor_key => '04c959d8259e811342e01d5025bb35e460eb105e',
      :debug => true )  # Sets to false when you move to production
    fraktjakt.add_parcel( :weight => 1, :length => 15, :width => 7, :height => 3 )
      @shipment_id, @warning, @res = fraktjakt.shipment(:express => false, :value => 4, :address => address)
    rescue Fraktjakt::FraktjaktError
      @error_message = $!
    # The consignor is the buyer of the shipment. Usually also the
    # same as the sender. 
    # :value => 4 is telling the search-engine that the value of the stuff being sent is 4 (SKR).
    # Some shipping_products change price depending on the value of the stuff being transported.
    # found in the webshops profile page in Fraktjakt - Prod 
    # @shipment_id will later be used to place an order in Fraktjakt
    # @warning is a strng that might have some warnings
    # @res is an Array of the SearchResult-class (see rdoc)

  def order 
    shipping_product_id = params[:id]
    recipient = { :name_to=>'Lina Sandell', :mobile_to=>'0733-710252'}
    fraktjakt =
      :consignor_id => 2,
      :consignor_key => '04c959d8259e811342e01d5025bb35e460eb105e',
      :debug => true ) # Sets to false when you move to production
    fraktjakt.add_commodity(:name => 'Yllesocka', :quantity=>2)
      @warning, @shipment_id, @order_id, @order_link = fraktjakt.order(:value => 4, :shipping_product_id => shipping_product_id, :recipient => recipient, :shipment_id => @shipment_id)
    rescue Fraktjakt::FraktjaktError
      @error_message = $!
    # @order_link is an optional link that will be returned ONLY when 
    # the option :sender_email is provided.
    # Otherwise it will be set to nil.

	def track
    shipment_id = params[:id]
    fraktjakt =
      :consignor_id => 2,
      :consignor_key => '04c959d8259e811342e01d5025bb35e460eb105e',
      :debug => true )
      @warning, @results = fraktjakt.track(:shipment_id => shipment_id)
    rescue Fraktjakt::FraktjaktError
      @error_message = $!

=== Views

==== index.html.erb

<% if @error_message.blank? %>
  <b>Shipment_id: <%= @shipment_id %></b><br />
  <b>Warnings: <%= @warnings %></b><br />
  <br />
  <% @res.each do |res| %>
    <%= %> - <%= res.desc %> : <%= res.price %>
    <%= link_to 'Select', {:action => 'order', :id =>, :shipment_id => @shipment_id} %>
    <br />
  <h1> No search result due to:<br />
  <%= @error_message %></h1>

==== order.html.erb

<% if @error_message.blank? %>
  <b>Shipment_id: <%= @shipment_id %></b><br />
  <b>Warnings: <%= @warnings %></b><br />
  <b>Order_id: <%= @order_id %></b><br />
  <b>Shipping Labels: <%= @order_link %></b><br />
  <br />
 <h1> No search result due to:<br />
  <%= @error_message %></h1>

==== track.html.erb

<% if @error_message.blank? %>
  <% @results.each do |r| %>
    <%= debug r%><br />
    <b>Shipment_id: <%= r.shipment_id %></b><br />
    <b>Status: <%= %></b><br />
    <b>Id: <%= %></b><br />
    <b>Fraktjakt_id: <%= r.fraktjakt_id %></b><br />
    <br />
  <br />
 <h1> No search result due to:<br />
  <%= @error_message %></h1>

== More information

For more information, please download the latest version Fraktjakt's API-documentation at:

Don't forget to generate rdoc
rake doc:plugins


Bug reports (as well as patches) and feedback are very welcome. Please send it to

Copyright (c) 2010 [Mats Bergström], released under the MIT license


A Ruby on Rails plugin for shipping integration with Fraktjakt's API.






No releases published


No packages published