Project

leipzig

0.0
No commit activity in last 3 years
No release in over 3 years
Tiny client for API Leipzig
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0.3
~> 2.12.0
~> 1.9.0

Runtime

>= 1.6.7
 Project Readme

Build Status Dependency Status Code Climate

Leipzig

Tiny client for API Leipzig

Installation

Add this line to your application's Gemfile:

gem 'leipzig'

And then execute:

$ bundle

Or install it yourself as:

$ gem install leipzig

Usage

Simply create a new instance of the client using your api key and call one of the find methods:

require 'leipzig'

client = Leipzig::Mediahandbook.new('my-key')

companies = client.find_companies(:postcode => '04103')
branches  = client.find_branches(:limit => 5)
people    = client.find_people(:offset => 100)

All find methods except a hash of params which are used to change the result set. See this link for more information about available params.

The result set is always an array containing OpenStruct objects so one can access entry data like properties:

client.find_companies(:limit => 10).first.name
# ==> First company's name

Besides Mediahandbook there are also classes for District and Calendar which are used the same way. Again, see link above for more information about params and structures. Calls could look as follows:

Leipzig::Calendar.new(key).find_events
Leipzig::District.new(key).find_streets

NOTE: Works with both ruby 1.9.2 and ruby 1.9.3

Running the tests

One can choose to run either the fake specs or the real world specs, whereas the latter ones actually calling the API:

$ bundle

$ # Mocked API (default)
$ rake spec

$ # Real world API
$ API_KEY='my-key' API_TYPE='real' rake spec

Todo

  • Refactoring

License

(The MIT License)

Copyright (c) 2012 Mario Behrendt info@mario-behrendt.de

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.