Giter VIP home page Giter VIP logo

tankerkoenig-ruby's Introduction

Tankerkoenig

This is a Ruby Wrapper for the Tankerkönig HTTP API.

Installation

Add this line to your application's Gemfile:

gem 'tankerkoenig'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tankerkoenig

Usage

Set the API Token

Tankerkoenig.api_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Get the detail of a single station

Tankerkoenig::Station.detail('24a381e3-0d72-416d-bfd8-b2f65f6e5802')
# => #<Tankerkoenig::Response @ok=true @result=#<Tankerkoenig::Station [...]> [...]>

Search stations in the radius of the given coordinates.

Tankerkoenig::Station.list(lat: 52.521, lng: 13.438, rad: 1.5, type: :all, sort: :dist)
# => #<Tankerkoenig::Response @ok=true @result=[#<Tankerkoenig::Station [...]>, #<Tankerkoenig::Station [...]>] [...]>

Get the prices of a list of stations

Tankerkoenig::Price.get(['4429a7d9-fb2d-4c29-8cfe-2ca90323f9f8', '446bdcf5-9f75-47fc-9cfa-2c3d6fda1c3b', '60c0eefa-d2a8-4f5c-82cc-b5244ecae955', '44444444-4444-4444-4444-444444444444'])
# or
Tankerkoenig::Price.get('4429a7d9-fb2d-4c29-8cfe-2ca90323f9f8,446bdcf5-9f75-47fc-9cfa-2c3d6fda1c3b,60c0eefa-d2a8-4f5c-82cc-b5244ecae955,44444444-4444-4444-4444-444444444444')

# => #<Tankerkoenig::Response @ok=true @result=[#<Tankerkoenig::Price [...]>, #<Tankerkoenig::Price [...]>] [...]>

Interacting with the Tankerkoenig::Station class.

stations = Tankerkoenig::Station.list(lat: 52.521, lng: 13.438, rad: 1.5, type: :all, sort: :dist).result
station = stations.first

station.brand
# => "TOTAL"

station.street
# => "MARGARETE-SOMMER-STR"

station.place
# => "BERLIN"

station.e5?
# => true

station.e5
# => 1.499

station.e10?
# => true

station.e10
# => 1.479

station.diesel?
# => true

station.diesel
# => 1.309

station.open?
# => true

station.whole_day?
# => false

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/marcoroth/tankerkoenig-ruby.

License

The gem is available as open source under the terms of the MIT License.

More Information

Tankerkoenig Website

Tankerkoenig HTTP API

RubyGems

Source Code

tankerkoenig-ruby's People

Contributors

dependabot-preview[bot] avatar marcoroth avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.