sabre_dev_studio-flight 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +2 -0
- data/lib/sabre_dev_studio-flight/airlines_lookup.rb +13 -0
- data/lib/sabre_dev_studio-flight/api.rb +28 -11
- data/lib/sabre_dev_studio-flight/version.rb +1 -1
- data/sabre_dev_studio-flight.gemspec +1 -0
- data/test/api_test.rb +11 -1
- data/test/fixtures/airlines.json +19 -0
- metadata +34 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZmJlM2U3OTU1OTVkZTA0OTFjYTFlYTEzMTFjZTdmZjE4MzYzYWQ1Mg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e424583fc68eda91d846f966af1255b4cf7f7ed2
|
4
|
+
data.tar.gz: 60fe573e2d8021ab461cb1d07d9630ac0c3b6029
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWMyNTNmMDRkNWM1MTFlODFkMWU1MjljMGRmYTc4OGY1MDYwZjI5YmM2NWZh
|
11
|
-
MWVkYWIzOGI1NGYyM2Y3NDcwNjkwYWEzYjYwNDkyNmVkZmNhNDE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGEzNzg1ZDQ0ZTkxYzNiNjVkOWM5ZjAzMzEyNTg3MzcwNDFhMjVkYzhmODA3
|
14
|
-
ZmJkZDVlMGM5YmEwYTI3YzViODcxZTI4OWZkMWYzMGE0ZWY4NmUxZjc0M2Vi
|
15
|
-
OTM5M2RjZDZhMGNlOTY4NWFiNzhjN2I0NGU0ZWM2NzU5MDhiYjc=
|
6
|
+
metadata.gz: 528ed809e6fdadcc1670d9fb06d2c0a90e020a37ab9f6180b49f4fe12e4f7d4d6e2f6de2b7dec1a8dd20917ba5226a4502bb9f72e4d1a27d40a3773f2d31ceed
|
7
|
+
data.tar.gz: 4a4d76850f310638c1a0389f8037ce4dd1257b2e7f68e9993d93a44e086ca7f0ef57e504ffcc7888f66b7dedc80fd842648a60a4b927dbd49f9563414bf2e6c3
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Access the Travel Platform Services Flight API
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/SabreDevStudio/sabre_dev_studio-flight.svg?branch=master)](https://travis-ci.org/SabreDevStudio/sabre_dev_studio-flight)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path('../airports_at_cities_lookup', __FILE__)
|
2
|
+
require File.expand_path('../airlines_lookup', __FILE__)
|
2
3
|
require File.expand_path('../city_pairs_lookup', __FILE__)
|
3
4
|
require File.expand_path('../destination_finder', __FILE__)
|
4
5
|
require File.expand_path('../fare_range', __FILE__)
|
@@ -13,6 +14,8 @@ require File.expand_path('../travel_theme_lookup', __FILE__)
|
|
13
14
|
module SabreDevStudio
|
14
15
|
module Flight
|
15
16
|
class Api
|
17
|
+
VERSION = "v1"
|
18
|
+
|
16
19
|
##
|
17
20
|
# List of Air Shopping Themes
|
18
21
|
#
|
@@ -22,7 +25,7 @@ module SabreDevStudio
|
|
22
25
|
# ==== Example:
|
23
26
|
# air_shopping_themes = SabreDevStudio::Flight::Api.travel_theme_lookup
|
24
27
|
def self.travel_theme_lookup
|
25
|
-
endpoint =
|
28
|
+
endpoint = "/#{VERSION}/shop/themes"
|
26
29
|
SabreDevStudio::Flight::TravelThemeLookup.new(endpoint)
|
27
30
|
end
|
28
31
|
class << self; alias_method :air_shopping_themes, :travel_theme_lookup; end
|
@@ -36,7 +39,7 @@ module SabreDevStudio
|
|
36
39
|
# ==== Example:
|
37
40
|
# airports = SabreDevStudio::Flight::Api.theme_airport_lookup('BEACH')
|
38
41
|
def self.theme_airport_lookup(theme)
|
39
|
-
endpoint = "/
|
42
|
+
endpoint = "/#{VERSION}/shop/themes/#{theme}"
|
40
43
|
SabreDevStudio::Flight::ThemeAirportLookup.new(endpoint)
|
41
44
|
end
|
42
45
|
|
@@ -57,7 +60,7 @@ module SabreDevStudio
|
|
57
60
|
# }
|
58
61
|
# fares = SabreDevStudio::Flight::Api.destination_finder(options)
|
59
62
|
def self.destination_finder(options)
|
60
|
-
endpoint =
|
63
|
+
endpoint = "/#{VERSION}/shop/flights/fares"
|
61
64
|
SabreDevStudio::Flight::DestinationFinder.new(endpoint, options)
|
62
65
|
end
|
63
66
|
class << self; alias_method :destination_air_shop, :destination_finder; end
|
@@ -78,7 +81,7 @@ module SabreDevStudio
|
|
78
81
|
# }
|
79
82
|
# fares = SabreDevStudio::Flight::Api.lead_price_calendar(options)
|
80
83
|
def self.lead_price_calendar(options)
|
81
|
-
endpoint =
|
84
|
+
endpoint = "/#{VERSION}/shop/flights/fares"
|
82
85
|
SabreDevStudio::Flight::LeadPriceCalendar.new(endpoint, options)
|
83
86
|
end
|
84
87
|
class << self; alias_method :future_dates_lead_fare_shop, :lead_price_calendar; end
|
@@ -103,7 +106,7 @@ module SabreDevStudio
|
|
103
106
|
# }
|
104
107
|
# itineraries = SabreDevStudio::Flight::Api.instaflights_search(options); nil
|
105
108
|
def self.instaflights_search(options)
|
106
|
-
endpoint =
|
109
|
+
endpoint = "/#{VERSION}/shop/flights"
|
107
110
|
SabreDevStudio::Flight::InstaflightsSearch.new(endpoint, options)
|
108
111
|
end
|
109
112
|
class << self; alias_method :single_date_air_shop, :instaflights_search; end
|
@@ -123,7 +126,7 @@ module SabreDevStudio
|
|
123
126
|
# }
|
124
127
|
# forecast = SabreDevStudio::Flight::Api.low_fare_forecast(options)
|
125
128
|
def self.low_fare_forecast(options)
|
126
|
-
endpoint =
|
129
|
+
endpoint = "/#{VERSION}/forecast/flights/fares"
|
127
130
|
SabreDevStudio::Flight::LowFareForecast.new(endpoint, options)
|
128
131
|
end
|
129
132
|
|
@@ -143,7 +146,7 @@ module SabreDevStudio
|
|
143
146
|
# }
|
144
147
|
# fare_range = SabreDevStudio::Flight::Api.fare_range(options)
|
145
148
|
def self.fare_range(options)
|
146
|
-
endpoint =
|
149
|
+
endpoint = "/#{VERSION}/historical/flights/fares"
|
147
150
|
SabreDevStudio::Flight::FareRange.new(endpoint, options)
|
148
151
|
end
|
149
152
|
|
@@ -156,7 +159,7 @@ module SabreDevStudio
|
|
156
159
|
# ==== Example:
|
157
160
|
# travel_seasonality = SabreDevStudio::Flight::Api.travel_seasonality('DFW')
|
158
161
|
def self.travel_seasonality(destination)
|
159
|
-
endpoint = "/
|
162
|
+
endpoint = "/#{VERSION}/historical/flights/#{destination}/seasonality"
|
160
163
|
SabreDevStudio::Flight::TravelSeasonality.new(endpoint)
|
161
164
|
end
|
162
165
|
|
@@ -173,7 +176,7 @@ module SabreDevStudio
|
|
173
176
|
# }
|
174
177
|
# city_pairs = SabreDevStudio::Flight::Api.city_pairs_lookup
|
175
178
|
def self.city_pairs_lookup(options)
|
176
|
-
endpoint =
|
179
|
+
endpoint = "/#{VERSION}/lists/airports/supported/origins-destinations"
|
177
180
|
SabreDevStudio::Flight::CityPairsLookup.new(endpoint, options)
|
178
181
|
end
|
179
182
|
|
@@ -187,7 +190,7 @@ module SabreDevStudio
|
|
187
190
|
# options = { :country => 'US' }
|
188
191
|
# city_pairs = SabreDevStudio::Flight::Api.multiairport_city_lookup(options)
|
189
192
|
def self.multiairport_city_lookup(options)
|
190
|
-
endpoint =
|
193
|
+
endpoint = "/#{VERSION}/lists/cities"
|
191
194
|
SabreDevStudio::Flight::MultiairportCityLookup.new(endpoint, options)
|
192
195
|
end
|
193
196
|
|
@@ -201,9 +204,23 @@ module SabreDevStudio
|
|
201
204
|
# options = { :city => 'NYC' }
|
202
205
|
# city_pairs = SabreDevStudio::Flight::Api.airports_at_cities_lookup(options)
|
203
206
|
def self.airports_at_cities_lookup(options)
|
204
|
-
endpoint =
|
207
|
+
endpoint = "/#{VERSION}/lists/airports"
|
205
208
|
SabreDevStudio::Flight::AirportsAtCitiesLookup.new(endpoint, options)
|
206
209
|
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# Airline Lookup
|
213
|
+
#
|
214
|
+
# ==== Documentation:
|
215
|
+
# https://developer.sabre.com/docs/read/rest_apis/utility/airline_lookup
|
216
|
+
#
|
217
|
+
# ==== Example:
|
218
|
+
# options = { :airlinecode => 'AA' }
|
219
|
+
# airline = SabreDevStudio::Flight::Api.airlines_lookup(options)
|
220
|
+
def self.airlines_lookup(options)
|
221
|
+
endpoint = "/#{VERSION}/lists/utilities/airlines"
|
222
|
+
SabreDevStudio::Flight::AirlinesLookup.new(endpoint, options)
|
223
|
+
end
|
207
224
|
end
|
208
225
|
end
|
209
226
|
end
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_development_dependency 'webmock', '~> 1.18.0'
|
21
21
|
gem.add_development_dependency 'geminabox', '~> 0.12.4'
|
22
22
|
gem.add_development_dependency 'rdoc', '~> 4.1.1'
|
23
|
+
gem.add_development_dependency 'test-unit', '~> 3.1'
|
23
24
|
gem.add_development_dependency 'rake', '~> 10.1.0'
|
24
25
|
gem.add_runtime_dependency 'sabre_dev_studio'
|
25
26
|
end
|
data/test/api_test.rb
CHANGED
@@ -7,7 +7,7 @@ class ApiTests < Test::Unit::TestCase
|
|
7
7
|
c.client_secret = 'PASSWORD'
|
8
8
|
c.uri = 'https://api.test.sabre.com'
|
9
9
|
end
|
10
|
-
stub_request(:post, "https://VjE6VVNFUjpHUk9VUDpET01BSU4%3D:UEFTU1dPUkQ%3D@api.test.sabre.com/
|
10
|
+
stub_request(:post, "https://VjE6VVNFUjpHUk9VUDpET01BSU4%3D:UEFTU1dPUkQ%3D@api.test.sabre.com/v2/auth/token").
|
11
11
|
to_return(:status => 200, :body =>"{\"access_token\":\"Shared/IDL:IceSess\\\\/SessMgr:1\\\\.0.IDL/Common/!ICESMS\\\\/ACPCRTD!ICESMSLB\\\\/CRT.LB!-3801964284027024638!507667!0!F557CBE649675!E2E-1\",\"token_type\":\"bearer\",\"expires_in\":1800}")
|
12
12
|
end
|
13
13
|
|
@@ -189,4 +189,14 @@ class ApiTests < Test::Unit::TestCase
|
|
189
189
|
assert_equal 3, airports.response['Airports'].count
|
190
190
|
assert_equal 'EWR', airports.response['Airports'].first['code']
|
191
191
|
end
|
192
|
+
|
193
|
+
def test_airlines_lookup_api
|
194
|
+
options = { :airlinecode => 'AI' }
|
195
|
+
uri = Addressable::URI.new
|
196
|
+
uri.query_values = options
|
197
|
+
stub_request(:get, "#{SabreDevStudio.configuration.uri}/v1/lists/utilities/airlines?#{uri.query}").
|
198
|
+
to_return(json_response('airlines.json'))
|
199
|
+
airline = SabreDevStudio::Flight::Api.airlines_lookup(options)
|
200
|
+
assert_equal "Air India Limited", airline.airline_info.first.airline_name
|
201
|
+
end
|
192
202
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"AirlineInfo": [
|
3
|
+
{
|
4
|
+
"AirlineCode": "AI",
|
5
|
+
"AirlineName": "Air India Limited",
|
6
|
+
"AlternativeBusinessName": "Air India"
|
7
|
+
}
|
8
|
+
],
|
9
|
+
"Links": [
|
10
|
+
{
|
11
|
+
"rel": "self",
|
12
|
+
"href": "https://api.sabre.com/v1/lists/utilities/airlines?airlinecode=AI"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"rel": "linkTemplate",
|
16
|
+
"href": "https://api.sabre.com/v1/lists/utilities/airlines?airlinecode=<airlinecode>"
|
17
|
+
}
|
18
|
+
]
|
19
|
+
}
|
metadata
CHANGED
@@ -1,83 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sabre_dev_studio-flight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barrett Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.18.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.18.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: geminabox
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.12.4
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.12.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.1.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.1.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: 10.1.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: 10.1.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sabre_dev_studio
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
description: Access the Sabre Travel Platform Services (TPS) Dev Studio Flight API
|
@@ -87,13 +101,14 @@ executables: []
|
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .travis.yml
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
92
106
|
- Gemfile
|
93
107
|
- LICENSE.txt
|
94
108
|
- README.md
|
95
109
|
- Rakefile
|
96
110
|
- lib/sabre_dev_studio-flight.rb
|
111
|
+
- lib/sabre_dev_studio-flight/airlines_lookup.rb
|
97
112
|
- lib/sabre_dev_studio-flight/airports_at_cities_lookup.rb
|
98
113
|
- lib/sabre_dev_studio-flight/api.rb
|
99
114
|
- lib/sabre_dev_studio-flight/city_pairs_lookup.rb
|
@@ -112,6 +127,7 @@ files:
|
|
112
127
|
- sabre_dev_studio-flight.gemspec
|
113
128
|
- test/api_test.rb
|
114
129
|
- test/fixtures/air_shopping_themes.json
|
130
|
+
- test/fixtures/airlines.json
|
115
131
|
- test/fixtures/airports_at_cities_lookup.json
|
116
132
|
- test/fixtures/city_pairs.json
|
117
133
|
- test/fixtures/destination_air_shop.json
|
@@ -133,23 +149,24 @@ require_paths:
|
|
133
149
|
- lib
|
134
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
151
|
requirements:
|
136
|
-
- -
|
152
|
+
- - ">="
|
137
153
|
- !ruby/object:Gem::Version
|
138
154
|
version: '0'
|
139
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
156
|
requirements:
|
141
|
-
- -
|
157
|
+
- - ">="
|
142
158
|
- !ruby/object:Gem::Version
|
143
159
|
version: '0'
|
144
160
|
requirements: []
|
145
161
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
162
|
+
rubygems_version: 2.4.8
|
147
163
|
signing_key:
|
148
164
|
specification_version: 4
|
149
165
|
summary: Access the Sabre Dev Studio API
|
150
166
|
test_files:
|
151
167
|
- test/api_test.rb
|
152
168
|
- test/fixtures/air_shopping_themes.json
|
169
|
+
- test/fixtures/airlines.json
|
153
170
|
- test/fixtures/airports_at_cities_lookup.json
|
154
171
|
- test/fixtures/city_pairs.json
|
155
172
|
- test/fixtures/destination_air_shop.json
|