sacs_ruby 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +196 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/sacs_ruby.rb +56 -0
- data/lib/sacs_ruby/api/advanced_calendar_search.rb +13 -0
- data/lib/sacs_ruby/api/aircraft_equipment_lookup.rb +14 -0
- data/lib/sacs_ruby/api/airline_alliance_lookup.rb +15 -0
- data/lib/sacs_ruby/api/airline_lookup.rb +14 -0
- data/lib/sacs_ruby/api/airports_at_cities_lookup.rb +19 -0
- data/lib/sacs_ruby/api/alternate_airport_shop.rb +15 -0
- data/lib/sacs_ruby/api/alternate_date.rb +13 -0
- data/lib/sacs_ruby/api/bargain_finder_max.rb +15 -0
- data/lib/sacs_ruby/api/car_availability.rb +13 -0
- data/lib/sacs_ruby/api/city_pairs_lookup.rb +17 -0
- data/lib/sacs_ruby/api/countries_lookup.rb +15 -0
- data/lib/sacs_ruby/api/destination_finder.rb +17 -0
- data/lib/sacs_ruby/api/fare_range.rb +25 -0
- data/lib/sacs_ruby/api/flights_to.rb +17 -0
- data/lib/sacs_ruby/api/geo_autocomplete.rb +17 -0
- data/lib/sacs_ruby/api/geo_code.rb +12 -0
- data/lib/sacs_ruby/api/geo_search.rb +12 -0
- data/lib/sacs_ruby/api/insta_flights_search.rb +17 -0
- data/lib/sacs_ruby/api/lead_price_calendar.rb +17 -0
- data/lib/sacs_ruby/api/low_fare_forecast.rb +19 -0
- data/lib/sacs_ruby/api/low_fare_history.rb +17 -0
- data/lib/sacs_ruby/api/multi_airport_city_lookup.rb +20 -0
- data/lib/sacs_ruby/api/point_of_sale_country_code_lookup.rb +17 -0
- data/lib/sacs_ruby/api/seat_map.rb +13 -0
- data/lib/sacs_ruby/api/top_destinations.rb +19 -0
- data/lib/sacs_ruby/api/travel_seasonality.rb +23 -0
- data/lib/sacs_ruby/api/travel_seasonality_airports_lookup.rb +13 -0
- data/lib/sacs_ruby/api/travel_theme_lookup.rb +15 -0
- data/lib/sacs_ruby/base.rb +47 -0
- data/lib/sacs_ruby/base_post.rb +27 -0
- data/lib/sacs_ruby/client.rb +124 -0
- data/lib/sacs_ruby/configuration.rb +23 -0
- data/lib/sacs_ruby/credentials.rb +35 -0
- data/lib/sacs_ruby/error.rb +55 -0
- data/lib/sacs_ruby/json.rb +16 -0
- data/lib/sacs_ruby/version.rb +3 -0
- data/sacs_ruby.gemspec +28 -0
- metadata +189 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Bargain Finder Max Alternate Date Shopping API allows you to specify
|
4
|
+
# multiple itinerary options and date pair combinations per request.
|
5
|
+
class AlternateDate < SacsRuby::Base
|
6
|
+
include BasePost
|
7
|
+
|
8
|
+
def endpoint_url
|
9
|
+
'/v1.9.0/shop/altdates/flights?mode=live'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# Bargain Finder Max (BFM), our best-in-class low fare search product, is
|
4
|
+
# used to search for the lowest available priced itineraries based upon a
|
5
|
+
# travel date. A wide range of user-specified criteria can be applied to
|
6
|
+
# the search.
|
7
|
+
class BargainFinderMax < SacsRuby::Base
|
8
|
+
include BasePost
|
9
|
+
|
10
|
+
def endpoint_url
|
11
|
+
'/v1.9.0/shop/flights?mode=live'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Car Availability API returns real-time rental car pricing
|
4
|
+
# and availability information.
|
5
|
+
class CarAvailability < SacsRuby::Base
|
6
|
+
include BasePost
|
7
|
+
|
8
|
+
def endpoint_url
|
9
|
+
'/v2.4.0/shop/cars'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The City Pairs Lookup API consists of supplemental APIs which retrieve
|
4
|
+
# city pairs that can be passed to applicable Air Shopping REST APIs. A city
|
5
|
+
# pair is passed as a combination of an origin and destination airport.
|
6
|
+
# For example, City Pairs Lookup retrieves the SJU-MIA city pair (San Juan
|
7
|
+
# International, Puerto Rico to Miami International). You can pass this city
|
8
|
+
# pair for any applicable air search API request, e.g., Lead Price Calendar.
|
9
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/city_pairs_lookup API Documentation
|
10
|
+
# @see Base Base class for documentation
|
11
|
+
class CityPairsLookup < SacsRuby::Base
|
12
|
+
def endpoint_url
|
13
|
+
'/v1/lists/supported/shop/flights/origins-destinations'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Countries Lookup API retrieves a list of origin and destination
|
4
|
+
# countries. These countries can be used as a filter in applicable
|
5
|
+
# REST APIs. This API is point of sale specific (each point of sale
|
6
|
+
# supports a unique list of origin and destination countries).
|
7
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/countries_lookup API Documentation
|
8
|
+
# @see Base Base class for documentation
|
9
|
+
class CountriesLookup < SacsRuby::Base
|
10
|
+
def endpoint_url
|
11
|
+
'/v1/lists/supported/countries'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Destination Finder API returns the lowest published fares
|
4
|
+
# available to destinations from a given origin.
|
5
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/search/destination_finder API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class DestinationFinder < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i( origin )
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
'/v2/shop/flights/fares'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Fare Range API returns the median, highest, and lowest published fares
|
4
|
+
# that were ticketed via the Sabre GDS during the previous 4 weeks for each
|
5
|
+
# of the future departure dates in a range, using the specific origin,
|
6
|
+
# destination, and length of stay in the request.
|
7
|
+
# In the request, future departure dates can range from 0-90 days, from the
|
8
|
+
# day of the API request. Length of stay is any single value from 0-16 days.
|
9
|
+
# The API also returns a rating of high, medium, or low, which represents
|
10
|
+
# the quantity of tickets that the API referenced to obtain the published
|
11
|
+
# fare values.
|
12
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/intelligence/fare_range API Documentation
|
13
|
+
# @see Base Base class for documentation
|
14
|
+
class FareRange < SacsRuby::Base
|
15
|
+
def required_vars
|
16
|
+
%i(origin destination earliestdeparturedate latestdeparturedate
|
17
|
+
lengthofstay)
|
18
|
+
end
|
19
|
+
|
20
|
+
def endpoint_url
|
21
|
+
'/v1/historical/flights/fares'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Flights To API returns 20 of the lowest published
|
4
|
+
# fares available for a given destination.
|
5
|
+
# @see https://developer.sabre.com/docs/rest_apis/air/search/flights_to/ API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class FlightsTo < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i(destination)
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
"/v1/shop/flights/cheapest/fares/#{opts.delete(:destination)}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Geo Autocomplete API returns a list of location predictions
|
4
|
+
# for text-based geographic search queries.
|
5
|
+
# @see https://developer.sabre.com/docs/rest_apis/utility/geo_autocomplete/ API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class GeoAutocomplete < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i(query)
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
'/v1/lists/utilities/geoservices/autocomplete'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The InstaFlights Search API retrieves roundtrip flight itineraries
|
4
|
+
# with published fares and fare breakdowns available from the Sabre
|
5
|
+
# cache for a certain origin, destination, and roundtrip travel dates.
|
6
|
+
# The origins and destinations are airport codes
|
7
|
+
class InstaFlightsSearch < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i(origin destination departuredate returndate)
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
'/v1/shop/flights'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Lead Price Calendar API returns the lowest published fares each of
|
4
|
+
# the next 192 calendar days for a given city pair.
|
5
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/search/lead_price_calendar API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class LeadPriceCalendar < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i(origin destination lengthofstay)
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
'/v2/shop/flights/fares'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Low Fare Forecast API forecasts the price range into which the
|
4
|
+
# lowest published fare that is available via the Sabre GDS is predicted
|
5
|
+
# to fall within the next 7 days, for a specific origin and destination on
|
6
|
+
# specific roundtrip travel dates.
|
7
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/intelligence/low_fare_forecast API Documentation
|
8
|
+
# @see Base Base class for documentation
|
9
|
+
class LowFareForecast < SacsRuby::Base
|
10
|
+
def required_vars
|
11
|
+
%i(origin destination departuredate returndate)
|
12
|
+
end
|
13
|
+
|
14
|
+
def endpoint_url
|
15
|
+
'/v1/forecast/flights/fares'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Low Fare History API returns each day of the past two weeks
|
4
|
+
# lowest published fares for a given city/date pair.
|
5
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/intelligence/low_fare_history API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class LowFareHistory < SacsRuby::Base
|
8
|
+
def required_vars
|
9
|
+
%i(origin destination departuredate returndate)
|
10
|
+
end
|
11
|
+
|
12
|
+
def endpoint_url
|
13
|
+
'/v1/historical/shop/flights/fares'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Multi-Airport City Lookup API returns a list of multi-airport city
|
4
|
+
# (MAC) codes. The response contains multi-airport cities located in the
|
5
|
+
# requested country(s), sorted by city name, in ascending rank order. If no
|
6
|
+
# country is specified, then all MAC codes and cities are returned. An
|
7
|
+
# example multi-airport city code is CHI, and the corresponding city name is
|
8
|
+
# Chicago. Note: Some city codes represent a metropolitan area that
|
9
|
+
# contains more than one major city. For example, the MAC code "QDF"
|
10
|
+
# represents Dallas and Ft. Worth, Texas. In this case, the city name is
|
11
|
+
# "Dallas / Ft. Worth".
|
12
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/multiairport_city_lookup API Documentation
|
13
|
+
# @see Base Base class for documentation
|
14
|
+
class MultiAirportCityLookup < SacsRuby::Base
|
15
|
+
def endpoint_url
|
16
|
+
'/v1/lists/supported/cities'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# Point of Sale Country Code Lookup is a supplemental API that retrieves a
|
4
|
+
# list of supported point of sale country codes and associated country
|
5
|
+
# names. The country codes can be passed as a parameter in certain REST API
|
6
|
+
# requests (those which support a 'pointofsalecountry' parameter). When a
|
7
|
+
# point of sale country is submitted with the request, only data related to
|
8
|
+
# that point of sale will be included in the response.
|
9
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/point_of_sale_country_code_lookup API Documentation
|
10
|
+
# @see Base Base class for documentation
|
11
|
+
class PointOfSaleCountryCodeLookup < SacsRuby::Base
|
12
|
+
def endpoint_url
|
13
|
+
'/v1/lists/supported/pointofsalecountries'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Seat Map API returns real-time seat map and specific seat pricing
|
4
|
+
# and availability information for a given aircraft.
|
5
|
+
class SeatMap < SacsRuby::Base
|
6
|
+
include BasePost
|
7
|
+
|
8
|
+
def endpoint_url
|
9
|
+
'/v3.0.0/book/flights/seatmaps?mode=live'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Top Destinations API retrieves top booked leisure destinations from a
|
4
|
+
# given origin and returns them in ascending rank order.
|
5
|
+
# The API looks up the traffic volume booked via the Sabre GDS to the top
|
6
|
+
# destinations for the previous 2, 8 or 12 weeks. It returns up to 50
|
7
|
+
# results per origin by rank - rank one is most popular; whereas, rank 50
|
8
|
+
# is least popular. Origin can be a multi-airport city (MAC) code, airport
|
9
|
+
# code, country code, or all possible origins (domestic and international)
|
10
|
+
# combined.
|
11
|
+
# @see https://developer.sabre.com/docs/rest_apis/air/search/flights_to/ API Documentation
|
12
|
+
# @see Base Base class for documentation
|
13
|
+
class TopDestinations < SacsRuby::Base
|
14
|
+
def endpoint_url
|
15
|
+
'/v1/lists/top/destinations'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Travel Seasonality API returns a traffic volume rating for each week
|
4
|
+
# of the year for a given destination.
|
5
|
+
# In total, each request returns a booked traffic volume rating of low,
|
6
|
+
# medium or high for each week (1-52) of the next year for a given
|
7
|
+
# destination. Each week is compared with the traffic volume of the other 51
|
8
|
+
# weeks. The API then calculates whether that week is high or low
|
9
|
+
# seasonality, e.g., week 32 is compared with the 1st, 2nd, 3rd … 33rd,
|
10
|
+
# 34th, 35th… 52nd weeks.
|
11
|
+
# @see https://developer.sabre.com/docs/rest_apis/air/search/flights_to/ API Documentation
|
12
|
+
# @see Base Base class for documentation
|
13
|
+
class TravelSeasonality < SacsRuby::Base
|
14
|
+
def required_vars
|
15
|
+
%i(destination)
|
16
|
+
end
|
17
|
+
|
18
|
+
def endpoint_url
|
19
|
+
"/v1/historical/flights/#{opts.delete(:destination)}/seasonality"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Travel Seasonality Airports Lookup API retrieves a list of our
|
4
|
+
# supported destinations.
|
5
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/travel_seasonality_airports_lookup API Documentation
|
6
|
+
# @see Base Base class for documentation
|
7
|
+
class TravelSeasonalityAirportsLookup < SacsRuby::Base
|
8
|
+
def endpoint_url
|
9
|
+
'/v1/lists/supported/historical/seasonality/airports'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
module API
|
3
|
+
# The Travel Theme Lookup API returns a list of supported Sabre themes.
|
4
|
+
# A theme is similar to a travel category, and is based on geography, points
|
5
|
+
# of interest, and recreational activities, such as beaches, national parks,
|
6
|
+
# or skiing.
|
7
|
+
# @see https://developer.sabre.com/docs/read/rest_apis/air/utility/travel_theme_lookup API Documentation
|
8
|
+
# @see Base Base class for documentation
|
9
|
+
class TravelThemeLookup < SacsRuby::Base
|
10
|
+
def endpoint_url
|
11
|
+
'/v1/lists/supported/shop/themes'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module SacsRuby
|
2
|
+
# Base class for API
|
3
|
+
class Base
|
4
|
+
attr_reader :opts, :token, :results, :url
|
5
|
+
|
6
|
+
def self.get(*args)
|
7
|
+
new(*args).get
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(opts = {})
|
11
|
+
@token = opts.delete(:token)
|
12
|
+
@opts = opts
|
13
|
+
end
|
14
|
+
|
15
|
+
def get
|
16
|
+
validate!(opts)
|
17
|
+
response = SacsRuby.client.get(request_params)
|
18
|
+
@results = JSON.load(response)
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
return true unless self.respond_to? :required_vars
|
23
|
+
@missing_opts = required_vars - opts.keys
|
24
|
+
@missing_opts.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
def url
|
28
|
+
fail ApiEndpointError, 'Missing endpoint url' unless self.respond_to? :endpoint_url
|
29
|
+
fail ConfigurationError if SacsRuby.configuration.nil?
|
30
|
+
[SacsRuby.configuration.environment, endpoint_url, '?', build_query].join
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def validate!(opts)
|
36
|
+
fail ApiArgumentError, "Missing required params: #{@missing_opts.join(' ')}" unless valid?
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_query
|
40
|
+
opts.map { |k, v| "#{k}=#{v}" }.join('&')
|
41
|
+
end
|
42
|
+
|
43
|
+
def request_params
|
44
|
+
@token.nil? ? { url: url } : { url: url, token: @token }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|