Project

gls_agent

0.0
No commit activity in last 3 years
No release in over 3 years
Log into GLS site, create and save new parcel sticker for Germany.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0

Runtime

~> 2.7
~> 2.0
 Project Readme

GLSAgent

Log into the German GLS (General Logistics Systems) webpage, create a new parcel sticker (for Germany) and save it to disk.

You'll need a "Easy-Start"/"Your GLS" account to do so.

GLS changed their webpage, now without JavaScript it seems that you need to save a Consignee Number with each request. This will be a timestamp, so this script will create a lot of unique customers with weirdish numbers (one for each generated parcel sticker).

Installation

Add this line to your application's Gemfile:

gem 'gls_agent'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gls_agent

Usage

Usage as standalone tool

There is a small standalone script:

$ gls_create_label -u glsuser -p glspass -l "12.12.2014,John Doe,Companyname,Home Street,1,1234,City,1" -o output.pdf

Multiple labels can be created by not passing the data via --label-data or -l flag but by shoving in a file as argument (which contains mutliple lines that conform to the same format then with the -l flag):

$ gls_create_label -u glsuser -p glspass parcel_label_data.csv

Note that while not gemified, use

$ bundle exec bin/gls_create_label ...

and

$ bundle console

to play around.

Usage as lib

To use gls_agent in your ruby project, install the gem and use something along these lines:

options = GLSAgent::Dotfile::get_opts
mech = GLSMech.new
mech.user = options[:user]
mech.pass = options[:pass]

GLSAgent::ParcelJob.new('31.01.2014','Frank Sinatra','Singing Ltd.,'CloudStreet','1',1234,'HeavenCity','1')
saved_as = mech.save_parcel_label parcel,'gls_label_frank_sinatra.pdf'

Configuration

You can invoke gls_agent without any configuration by specifying command line parameters. If you do not want to retype your gls credentials or do not want them to travel the wire (ssh), be present in the history (i.e. bash) or visible in the process list, you can put credentials or delivery details in ~/.gls_agent .

Its syntax follows the

option=value

scheme, where option can be anything of: user, pass, name, street, streetno, zip, city, weight, output_file . Note that these options are ignored if gls_create_label is given a file to create multiple labels.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/gls_agent/fork )
  2. Mail me.
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request