Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcoroth/spritpreisrechner-ruby
Ruby Wrapper for the e-control.at Spritpreisrechner HTTP API
https://github.com/marcoroth/spritpreisrechner-ruby
api json ruby spritpreisrechner spritpreisrechner-api wrapper
Last synced: 16 days ago
JSON representation
Ruby Wrapper for the e-control.at Spritpreisrechner HTTP API
- Host: GitHub
- URL: https://github.com/marcoroth/spritpreisrechner-ruby
- Owner: marcoroth
- License: mit
- Created: 2018-09-25T19:24:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-24T11:57:01.000Z (about 6 years ago)
- Last Synced: 2024-12-13T23:56:05.340Z (20 days ago)
- Topics: api, json, ruby, spritpreisrechner, spritpreisrechner-api, wrapper
- Language: Ruby
- Homepage: https://www.spritpreisrechner.at/
- Size: 16.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Spritpreisrechner
![](https://api.travis-ci.com/marcoroth/spritpreisrechner-ruby.svg?branch=master)This is a Ruby Wrapper for the [e-Control.at Spritpreisrechner HTTP API](https://www.spritpreisrechner.at). Have a look at the [Swagger docs](https://api.e-control.at/sprit/1.0/doc/index.html?url=https://api.e-control.at/sprit/1.0/api-docs%3Fgroup%3Dpublic-api) for detailed info about the API.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'spritpreisrechner'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install spritpreisrechner
## Usage
Getting stations by LAT/LNG coordinates. The available Fuel Types are: `DIE` , `SUP` and `GAS`. The `closed` parameter is optional.
```ruby
response = Spritpreisrechner::Station.by_address(lat: 48.208, lng: 16.373, fuel_type: 'DIE', closed: 'true')
# => #, #, ... ] ... >```
Getting stations by region:
```ruby
response = Spritpreisrechner::Station.by_region(code: 1, region_type: "BL", fuel_type: 'DIE', closed: 'true')
# => #, #, ... ] ... >```
Getting all available regions:
```ruby
regions = Spritpreisrechner::Region.all
# => [#, # ...]
```Getting a specific region:
```ruby
region = Spritpreisrechner::Region.find(1)
# => #
```## 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](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/marcoroth/spritpreisrechner.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## More Information
[Spritpreisrechner Website](https://www.spritpreisrechner.at/)
[RubyGems](https://rubygems.org/gems/spritpreisrechner)
[Source Code](https://github.com/marcoroth/spritpreisrechner-ruby)