This gem makes it easy to get usually difficult-to-access information on the availability of British Airways reward flights.
I use the private API from the new Avios Flight Finder app for iOS to grab this data. Thanks to Raffles at Head for Points for covering this very helpful little app.
Pretty simple. First, add the gem to your Gemfile:
gem 'ba_rewards', github: 'timrogers/ba_rewards'
Simply call BARewards.availability
with the code of your
departure and destinations airports. You can then optionally choose a fare class (I'll assume Economy) and the number of seats you need:
require 'ba_rewards'
# I'm looking for two seats from any London airport to San Francisco in Business
result = BARewards.availability("LON", "SFO", :business, 2)
It'll return a BARewards::Result
object, or raise an error if something goes wrong. You can call the following methods on the result object:
- city - the destination city as text, converted from the provided airport code
- country - the country that the destination city is located in
- region - the region that the destination city is located in (probably pointless)
- avios_price - the Avios price for a return ticket (excluding taxes and the like)
- reward_flight_saver? - is this destination part of Avios's (rather excellent) Reward Flight Saver scheme?
- availability_dates - an array of Ruby Date objects, representing the dates in the next year where your requested number of seats are availability in the requested class
- raw_response - an
HTTParty::Response
object returned from the request to the Avios private API
Released by Tim Rogers (@timrogers) under the MIT license. Any questions? Email barewards@timrogers.co.uk.