Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timrogers/avios_cities
Avios Cities gives you up-to-date access to data on the airports accessible using Avios air miles flying from or to London.
https://github.com/timrogers/avios_cities
Last synced: 13 days ago
JSON representation
Avios Cities gives you up-to-date access to data on the airports accessible using Avios air miles flying from or to London.
- Host: GitHub
- URL: https://github.com/timrogers/avios_cities
- Owner: timrogers
- License: mit
- Created: 2015-10-26T17:04:54.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-26T17:05:14.000Z (about 9 years ago)
- Last Synced: 2024-11-24T13:43:49.752Z (about 2 months ago)
- Language: Ruby
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Avios Cities
[![Gem Version](https://badge.fury.io/rb/avios_cities.svg)](http://badge.fury.io/rb/avios_cities) [![Build Status](https://travis-ci.org/timrogers/avios_cities.svg)](https://travis-ci.org/timrogers/avios_cities)
Avios Cities gives you up-to-date access to data on the airports accessible using Avios air miles flying from or to London.
## Usage
Install the gem *(Ruby 2.1.0 and later only)*:
```ruby
gem 'avios_cities', github: 'timrogers/avios_cities'
```You can then look up a city by its IATA code (e.g. `MAK` for Marrakech) or, where one exists as for larger cities, its [Metropolitan Area Airport Code](http://wikitravel.org/en/Metropolitan_Area_Airport_Codes) (e.g. `LON` for London) using `AviosCities.find_by_iata_code`, which returns an object with a bunch of accessors like `name` and `city`:
```ruby
AviosCities.find_by_iata_code("LON")
=> #
```A couple of other methods provide access to aggregate data.
You can call `AviosCities.iata_codes` for a list of valid IATA codes, perfect for Rails validations:
```ruby
validates :destination_city, inclusion: { in: AviosCities.iata_codes, message: "is not a valid destination" }
```Or `AviosCities.all` will provide `AviosCities::City` objects representing all the cities the gem knows about.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` 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/timrogers/mummy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
## Acknowledgements
The data is taken from an [Avios private API](http://dev1-flightavail-avios.bitnamiapp.com:8080/flight-availability-ws/departure/cities/LON/destinations) used by one of their iOS apps (with London added, since it isn't included).
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).