wego 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wego/version.rb +1 -1
- data/spec/fixtures/error.json +3 -0
- data/spec/fixtures/locations.json +33 -0
- data/spec/fixtures/result.json +107 -0
- data/spec/fixtures/results.json +650 -0
- data/spec/fixtures/search.json +5 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/fake_wego_api.rb +47 -0
- data/spec/wego/booking_spec.rb +14 -0
- data/spec/wego/client_spec.rb +42 -0
- data/spec/wego/configuration_spec.rb +52 -0
- data/spec/wego/location_spec.rb +13 -0
- data/spec/wego/response_spec.rb +13 -0
- data/spec/wego/result_spec.rb +38 -0
- data/spec/wego/search_spec.rb +40 -0
- data/wego.gemspec +2 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee006ba3f359c5588913d6bf49277ef3913d59c1
|
4
|
+
data.tar.gz: 19a54224f3b646f58fe914798a4320022e07c9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 245b9e4aca0b273d3af5232bc39c18ede02de41b26f762d8aa648fc0c8b7e02058a07d8ebc5caa22e483c9eac17e6d3287b11e5d92bc81cbd7c3f04f82e33846
|
7
|
+
data.tar.gz: b81e7d6227be74345231ec7e3b93f2053817f3a04054ed30483958370fb42678563b07d55694f9d929604a0e27ed6dd3e8badc55d95ceb313761583c3a3b35a7
|
data/lib/wego/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"count": 3,
|
3
|
+
"query": "sydney",
|
4
|
+
|
5
|
+
"locations": [
|
6
|
+
{
|
7
|
+
"id": 7046,
|
8
|
+
"name": "Sydney, NSW, Australia - 741 hotels",
|
9
|
+
"country_name": "Australia",
|
10
|
+
"country_code": "AU",
|
11
|
+
"state_name": "{\"en\":\"New South Wales\"}",
|
12
|
+
"state_code": "NSW"
|
13
|
+
},
|
14
|
+
|
15
|
+
{
|
16
|
+
"id": 8564,
|
17
|
+
"name": "Sydney, Canada - 14 hotels",
|
18
|
+
"country_name": "Canada",
|
19
|
+
"country_code": "CA",
|
20
|
+
"state_name": null,
|
21
|
+
"state_code": null
|
22
|
+
},
|
23
|
+
|
24
|
+
{
|
25
|
+
"id": 18410,
|
26
|
+
"name": "North Sydney, SK, Canada - 21 hotels",
|
27
|
+
"country_name": "Canada",
|
28
|
+
"country_code": "CA",
|
29
|
+
"state_name": "{\"en\":\"Saskatchewan\"}",
|
30
|
+
"state_code": "SK"
|
31
|
+
}
|
32
|
+
]
|
33
|
+
}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
{
|
2
|
+
"total_count": 260,
|
3
|
+
"location": "Sydney",
|
4
|
+
"location_id": 7046,
|
5
|
+
"hotel": {
|
6
|
+
"id": 273451,
|
7
|
+
"name": "InterContinental Sydney",
|
8
|
+
"address": "117 Macquarie St, cnr of Bridge and Phillip",
|
9
|
+
"searched": null,
|
10
|
+
"desc": "Some visit Sydneys icons. Others stay in them. For more than 25 years, InterContinental Sydney has been the luxury hotel of choice to meet, do business and unlock authentic experiences that make Australias harbour city one of the best places in the world to live, work and visit. From its exceptional service and world-class facilities to luxury accommodation and rooftop Club InterContinental lounge overlooking the harbour, it offers everything you need to make your time in the city count.",
|
11
|
+
"stars": 5,
|
12
|
+
"map": true,
|
13
|
+
"total_reviews": 2790,
|
14
|
+
"positive": 0,
|
15
|
+
"negative": 0,
|
16
|
+
"neutral": 0,
|
17
|
+
"recent_snippet": "",
|
18
|
+
"rooms_count": 509,
|
19
|
+
"rank": 1,
|
20
|
+
"satisfaction": 91,
|
21
|
+
"satisfaction_description": "Excellent",
|
22
|
+
"url": "/hotels/australia/sydney/intercontinental-sydney-273451",
|
23
|
+
"offer": null,
|
24
|
+
"image": "http://1.omg.io/wego/image/upload/w_200,h_200,c_fill/v1459219868/hotels/273451/9438078.jpg",
|
25
|
+
"cancellation_policy": {
|
26
|
+
"en": "Cancellation policies vary by hotel. Since a hotel can set a cancellation policy up to 30 days prior to arrival, please review rate rules prior to booking to avoid possible charges."
|
27
|
+
},
|
28
|
+
"check_in": "15:00:00",
|
29
|
+
"check_out": "11:00:00",
|
30
|
+
"reservation_phone": "+61292539000",
|
31
|
+
"fax": "9240 1240",
|
32
|
+
"longitude": 151.212108,
|
33
|
+
"latitude": -33.863111,
|
34
|
+
"postal_code": "2000",
|
35
|
+
"property_amenities": ["High speed internet access", "Swimming pool", "Parking", "Restaurant", "Fitness center or spa", "24-hour front desk", "24-hour security", "Accessible facilities", "Air conditioning", "All public areas non-smoking", "Baby sitting", "Banquet facilities", "Beauty shop/salon", "Bell staff/porter", "Business center", "Concierge", "Connecting rooms", "Currency exchange", "Express check-out", "Fax service", "Florist", "Gift/News stand", "Golf", "Ice machine", "Kitchenette", "Laundry service", "Lounges/bars", "Multilingual staff", "Room service", "Safe deposit box", "Secretarial service", "Shopping mall", "Tour/sightseeing desk", "Valet parking ", "Wakeup service"],
|
36
|
+
"property_amenity_ids": ["key_amenity_1", "key_amenity_2", "key_amenity_3", "key_amenity_4", "key_amenity_5", "service_2", "service_3", "service_4", "service_6", "service_8", "service_11", "service_16", "service_17", "service_20", "service_25", "service_42", "service_5", "service_44", "service_58", "service_59", "service_61", "service_66", "service_67", "service_74", "service_78", "service_80", "service_85", "service_89", "service_99", "service_100", "service_102", "service_104", "service_109", "service_112", "service_114"],
|
37
|
+
"room_amenities": ["Accessible room", "Non-smoking"],
|
38
|
+
"room_amenity_ids": [1, 42],
|
39
|
+
"images": [{
|
40
|
+
"url": "http://1.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219868/hotels/273451/9438079.jpg"
|
41
|
+
}, {
|
42
|
+
"url": "http://1.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219868/hotels/273451/2945552.jpg"
|
43
|
+
}, {
|
44
|
+
"url": "http://1.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219861/hotels/273451/2945566.jpg"
|
45
|
+
}, {
|
46
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219861/hotels/273451/2945563.jpg"
|
47
|
+
}, {
|
48
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219860/hotels/273451/10684581.jpg"
|
49
|
+
}, {
|
50
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1427402710/hotels/273451/8932817.jpg"
|
51
|
+
}, {
|
52
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219856/hotels/273451/32445409.jpg"
|
53
|
+
}, {
|
54
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1427402710/hotels/273451/36817407.jpg"
|
55
|
+
}, {
|
56
|
+
"url": "http://1.omg.io/wego/image/upload/w_460,h_460,c_fill/v1459219856/hotels/273451/38430574.jpg"
|
57
|
+
}, {
|
58
|
+
"url": "http://0.omg.io/wego/image/upload/w_460,h_460,c_fill/v1427402815/hotels/273451/12769231.jpg"
|
59
|
+
}],
|
60
|
+
"videos": [],
|
61
|
+
"concepts": [],
|
62
|
+
"tops_flops_review": [],
|
63
|
+
"hotel_types_review": [],
|
64
|
+
"good_to_knows_review": [],
|
65
|
+
"room_rates": [{
|
66
|
+
"id": "362-201",
|
67
|
+
"price_str": "253",
|
68
|
+
"currency_code": "USD",
|
69
|
+
"currency_sym": "US$",
|
70
|
+
"provider_name": "Ctrip.com",
|
71
|
+
"provider_code": "english.ctrip.com",
|
72
|
+
"mobile_friendly": false,
|
73
|
+
"ex_tax": false,
|
74
|
+
"is_direct": false,
|
75
|
+
"description": "Deluxe Room KING DELUXE (Capacity: 3)",
|
76
|
+
"phones": null
|
77
|
+
}],
|
78
|
+
"summary_room_rates": [{
|
79
|
+
"id": "362-201",
|
80
|
+
"price_str": "253",
|
81
|
+
"currency_code": "USD",
|
82
|
+
"currency_sym": "US$",
|
83
|
+
"provider_name": "Ctrip.com",
|
84
|
+
"provider_code": "english.ctrip.com",
|
85
|
+
"mobile_friendly": false,
|
86
|
+
"ex_tax": false,
|
87
|
+
"is_direct": false,
|
88
|
+
"description": "Deluxe Room KING DELUXE (Capacity: 3)",
|
89
|
+
"phones": null
|
90
|
+
}],
|
91
|
+
"room_rates_count": 1,
|
92
|
+
"room_rate_min": {
|
93
|
+
"id": "362-201",
|
94
|
+
"price_str": "253",
|
95
|
+
"currency_code": "USD",
|
96
|
+
"currency_sym": "US$",
|
97
|
+
"provider_name": "Ctrip.com",
|
98
|
+
"provider_code": "english.ctrip.com",
|
99
|
+
"mobile_friendly": false,
|
100
|
+
"ex_tax": false,
|
101
|
+
"is_direct": false,
|
102
|
+
"description": "Deluxe Room KING DELUXE (Capacity: 3)",
|
103
|
+
"phones": null
|
104
|
+
}
|
105
|
+
},
|
106
|
+
"is_done": true
|
107
|
+
}
|
@@ -0,0 +1,650 @@
|
|
1
|
+
{
|
2
|
+
"location": "Sydney",
|
3
|
+
"location_coordinates": [-33.8673, 151.183],
|
4
|
+
"total_count": 236,
|
5
|
+
"count": 5,
|
6
|
+
"filtered_count": 236,
|
7
|
+
"current_page": 1,
|
8
|
+
"per_page": 5,
|
9
|
+
"rates": {
|
10
|
+
"min": {
|
11
|
+
"price": 44,
|
12
|
+
"price_usd": 44.071998596191406,
|
13
|
+
"price_str": "44",
|
14
|
+
"currency_code": "USD"
|
15
|
+
},
|
16
|
+
"max": {
|
17
|
+
"price": 1076,
|
18
|
+
"price_usd": 1076.2900390625,
|
19
|
+
"price_str": "1,076",
|
20
|
+
"currency_code": "USD"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"districts": [{
|
24
|
+
"id": 60,
|
25
|
+
"name": "City Centre"
|
26
|
+
}, {
|
27
|
+
"id": 61,
|
28
|
+
"name": "Bondi"
|
29
|
+
}, {
|
30
|
+
"id": 54,
|
31
|
+
"name": "Kings Cross"
|
32
|
+
}, {
|
33
|
+
"id": 58,
|
34
|
+
"name": "Darling Harbour"
|
35
|
+
}, {
|
36
|
+
"id": 1313,
|
37
|
+
"name": "Manly"
|
38
|
+
}, {
|
39
|
+
"id": 2098,
|
40
|
+
"name": "Western Sydney"
|
41
|
+
}, {
|
42
|
+
"id": 1317,
|
43
|
+
"name": "Ryde"
|
44
|
+
}, {
|
45
|
+
"id": 57,
|
46
|
+
"name": "Darlinghurst - Surry Hills"
|
47
|
+
}, {
|
48
|
+
"id": 2095,
|
49
|
+
"name": "North Shore"
|
50
|
+
}, {
|
51
|
+
"id": 1310,
|
52
|
+
"name": "Coogee"
|
53
|
+
}, {
|
54
|
+
"id": 2096,
|
55
|
+
"name": "Sydney City"
|
56
|
+
}, {
|
57
|
+
"id": 51,
|
58
|
+
"name": "The Rocks"
|
59
|
+
}, {
|
60
|
+
"id": 2097,
|
61
|
+
"name": "Parramatta"
|
62
|
+
}, {
|
63
|
+
"id": 8589,
|
64
|
+
"name": "Chippendale"
|
65
|
+
}, {
|
66
|
+
"id": 52,
|
67
|
+
"name": "Sydney Airport (SYD)"
|
68
|
+
}, {
|
69
|
+
"id": 1307,
|
70
|
+
"name": "Bankstown"
|
71
|
+
}, {
|
72
|
+
"id": 7959,
|
73
|
+
"name": "Darlinghurst"
|
74
|
+
}, {
|
75
|
+
"id": 1314,
|
76
|
+
"name": "Liverpool"
|
77
|
+
}, {
|
78
|
+
"id": 2099,
|
79
|
+
"name": "Inner West"
|
80
|
+
}, {
|
81
|
+
"id": 8588,
|
82
|
+
"name": "Milsons Point"
|
83
|
+
}],
|
84
|
+
"is_done": true,
|
85
|
+
"hotels": [{
|
86
|
+
"id": 272771,
|
87
|
+
"name": "Parkroyal Darling Harbour",
|
88
|
+
"address": "150 Day Street, Sydney, NSW",
|
89
|
+
"districts": [58],
|
90
|
+
"latitude": -33.87361,
|
91
|
+
"longitude": 151.2033,
|
92
|
+
"property_type": 1,
|
93
|
+
"brand_id": 336,
|
94
|
+
"searched": null,
|
95
|
+
"desc": "Be in the thick of everything at amazing accommodation in the heart of Sydney.\n\nYou’ll always be in the centre of the action at this wonderful Darling Harbour hotel. Its convenient location means you’re just minutes away from the city’s top sights and attractions.\n\nThe friendly and well-informed associates at our hotel in Darling Harbour, Sydney are always on hand to share their extensive knowledge of the city’s best-kept secrets with you. Explore the neighbourhood and feel the buzz of energy at the bustling Town Hall train interchange and surrounding malls. The steps of the famous Town Hall landmark have long been a popular meeting point for locals of all ages.\n\nGo for a stroll and enjoy the amazing views at Cockle Bay, take in the city’s history and culture at the galleries and museum at The Rocks, or simply enjoy a spot of retail therapy at shopping precincts like Harbourside and Pitt Street Mall, a favourite with the locals. Once you’re finished exploring, simply rest and relax in the comfort of the 345 rooms and suites at this premium Darling Harbour hotel.",
|
96
|
+
"stars": 4,
|
97
|
+
"map": true,
|
98
|
+
"room_rates": [{
|
99
|
+
"id": "302-1",
|
100
|
+
"price_str": "280",
|
101
|
+
"currency_code": "USD",
|
102
|
+
"currency_sym": "US$",
|
103
|
+
"provider_name": "Skoosh",
|
104
|
+
"provider_code": "skoosh.com",
|
105
|
+
"mobile_friendly": false,
|
106
|
+
"ex_tax": false,
|
107
|
+
"is_direct": false,
|
108
|
+
"description": "Nonrefundable Double Darling-Harbour View-King - Room Only"
|
109
|
+
}],
|
110
|
+
"summary_room_rates": [{
|
111
|
+
"id": "302-1",
|
112
|
+
"price_str": "280",
|
113
|
+
"currency_code": "USD",
|
114
|
+
"currency_sym": "US$",
|
115
|
+
"provider_name": "Skoosh",
|
116
|
+
"provider_code": "skoosh.com",
|
117
|
+
"mobile_friendly": false,
|
118
|
+
"ex_tax": false,
|
119
|
+
"description": "Nonrefundable Double Darling-Harbour View-King - Room Only",
|
120
|
+
"is_direct": false
|
121
|
+
}],
|
122
|
+
"room_rates_count": 1,
|
123
|
+
"room_rate_min": {
|
124
|
+
"id": "302-1",
|
125
|
+
"price_str": "280",
|
126
|
+
"currency_code": "USD",
|
127
|
+
"currency_sym": "US$",
|
128
|
+
"provider_name": "Skoosh",
|
129
|
+
"provider_code": "skoosh.com",
|
130
|
+
"mobile_friendly": false,
|
131
|
+
"ex_tax": false,
|
132
|
+
"is_direct": false
|
133
|
+
},
|
134
|
+
"total_reviews": 3171,
|
135
|
+
"positive": 0,
|
136
|
+
"negative": 0,
|
137
|
+
"neutral": 0,
|
138
|
+
"rooms_count": 345,
|
139
|
+
"rank": 1,
|
140
|
+
"satisfaction": 90,
|
141
|
+
"satisfaction_description": "Excellent",
|
142
|
+
"url": "/hotels/australia/sydney/parkroyal-darling-harbour-272771",
|
143
|
+
"offer": null,
|
144
|
+
"image": "http://0.omg.io/wego/image/upload/w_200,h_200,c_fill/v1411553183/hotels/272771/13723116.jpg"
|
145
|
+
}, {
|
146
|
+
"id": 273390,
|
147
|
+
"name": "Somerset Darling Harbour",
|
148
|
+
"address": "252 Sussex Street",
|
149
|
+
"districts": [58],
|
150
|
+
"latitude": -33.872748,
|
151
|
+
"longitude": 151.204072,
|
152
|
+
"property_type": 1,
|
153
|
+
"brand_id": 361,
|
154
|
+
"searched": null,
|
155
|
+
"desc": "Somerset Darling Harbour is located in Sydneys premier waterfront precinct. Just minutes from the Central Business District- surrounded by iconic Australian sites- the property offers guests the chance to immerse themselves in the citys culture. Darling Harbour is also home to Sydneys burgeoning fashion industry- some of the citys finest dining establishments- spectacular street and theatre entertainment and is perfectly positioned to take full advantage of the Convention Centre- the Powerhouse Museum and the world-renowned Sydney Aquarium and Wild Life park.\n\nSomerset Darling Harbour combines all of this with a stylish yet comfortable residential choice. With 119 well-appointed studio- one- two and three-bedroom apartments over twenty levels- Somerset Darling Harbour is the perfect choice for guests staying for a night- extended stay- assignment or relocation. Somerset Darling Harbour also offers a bar- restaurant- pool- spa and sauna- amongst other facilities to enjoy. Staff are discreet and knowledgeable when it comes to the city they call home- their job is to make our guests feel welcome and to help them settle into the city and integrate with the local culture.",
|
156
|
+
"stars": 4,
|
157
|
+
"map": true,
|
158
|
+
"room_rates": [{
|
159
|
+
"id": "168-1",
|
160
|
+
"price_str": "135",
|
161
|
+
"currency_code": "USD",
|
162
|
+
"currency_sym": "US$",
|
163
|
+
"provider_name": "Hotels.com",
|
164
|
+
"provider_code": "hotels.com",
|
165
|
+
"mobile_friendly": true,
|
166
|
+
"ex_tax": false,
|
167
|
+
"is_direct": false,
|
168
|
+
"description": "Save 25% - NON REFUNDABLE"
|
169
|
+
}, {
|
170
|
+
"id": "193-1",
|
171
|
+
"price_str": "135",
|
172
|
+
"currency_code": "USD",
|
173
|
+
"currency_sym": "US$",
|
174
|
+
"provider_name": "Expedia.co.th",
|
175
|
+
"provider_code": "expedia.co.th",
|
176
|
+
"mobile_friendly": true,
|
177
|
+
"ex_tax": false,
|
178
|
+
"is_direct": false,
|
179
|
+
"description": "One Bedroom Executive Apartment - Save 25% - NON REFUNDABLE"
|
180
|
+
}, {
|
181
|
+
"id": "362-201",
|
182
|
+
"price_str": "184",
|
183
|
+
"currency_code": "USD",
|
184
|
+
"currency_sym": "US$",
|
185
|
+
"provider_name": "Ctrip.com",
|
186
|
+
"provider_code": "english.ctrip.com",
|
187
|
+
"mobile_friendly": false,
|
188
|
+
"ex_tax": false,
|
189
|
+
"is_direct": false,
|
190
|
+
"description": "1 Bedroom Executive ONE BEDROOM-EXECUTIVE DOUBLE (Capacity: 3)"
|
191
|
+
}, {
|
192
|
+
"id": "376-1",
|
193
|
+
"price_str": "185",
|
194
|
+
"currency_code": "USD",
|
195
|
+
"currency_sym": "US$",
|
196
|
+
"provider_name": "Prestigia.com",
|
197
|
+
"provider_code": "prestigia.com",
|
198
|
+
"mobile_friendly": false,
|
199
|
+
"ex_tax": false,
|
200
|
+
"is_direct": false,
|
201
|
+
"description": "DOUBLE ONE BEDROOM-EXECUTIVE"
|
202
|
+
}, {
|
203
|
+
"id": "302-1",
|
204
|
+
"price_str": "188",
|
205
|
+
"currency_code": "USD",
|
206
|
+
"currency_sym": "US$",
|
207
|
+
"provider_name": "Skoosh",
|
208
|
+
"provider_code": "skoosh.com",
|
209
|
+
"mobile_friendly": false,
|
210
|
+
"ex_tax": false,
|
211
|
+
"is_direct": false,
|
212
|
+
"description": "Double One Bedroom-Executive - Room Only"
|
213
|
+
}],
|
214
|
+
"summary_room_rates": [{
|
215
|
+
"id": "168-1",
|
216
|
+
"price_str": "135",
|
217
|
+
"currency_code": "USD",
|
218
|
+
"currency_sym": "US$",
|
219
|
+
"provider_name": "Hotels.com",
|
220
|
+
"provider_code": "hotels.com",
|
221
|
+
"mobile_friendly": true,
|
222
|
+
"ex_tax": false,
|
223
|
+
"description": "Save 25% - NON REFUNDABLE",
|
224
|
+
"is_direct": false
|
225
|
+
}, {
|
226
|
+
"id": "193-1",
|
227
|
+
"price_str": "135",
|
228
|
+
"currency_code": "USD",
|
229
|
+
"currency_sym": "US$",
|
230
|
+
"provider_name": "Expedia.co.th",
|
231
|
+
"provider_code": "expedia.co.th",
|
232
|
+
"mobile_friendly": true,
|
233
|
+
"ex_tax": false,
|
234
|
+
"description": "One Bedroom Executive Apartment - Save 25% - NON REFUNDABLE",
|
235
|
+
"is_direct": false
|
236
|
+
}, {
|
237
|
+
"id": "362-201",
|
238
|
+
"price_str": "184",
|
239
|
+
"currency_code": "USD",
|
240
|
+
"currency_sym": "US$",
|
241
|
+
"provider_name": "Ctrip.com",
|
242
|
+
"provider_code": "english.ctrip.com",
|
243
|
+
"mobile_friendly": false,
|
244
|
+
"ex_tax": false,
|
245
|
+
"description": "1 Bedroom Executive ONE BEDROOM-EXECUTIVE DOUBLE (Capacity: 3)",
|
246
|
+
"is_direct": false
|
247
|
+
}, {
|
248
|
+
"id": "376-1",
|
249
|
+
"price_str": "185",
|
250
|
+
"currency_code": "USD",
|
251
|
+
"currency_sym": "US$",
|
252
|
+
"provider_name": "Prestigia.com",
|
253
|
+
"provider_code": "prestigia.com",
|
254
|
+
"mobile_friendly": false,
|
255
|
+
"ex_tax": false,
|
256
|
+
"description": "DOUBLE ONE BEDROOM-EXECUTIVE",
|
257
|
+
"is_direct": false
|
258
|
+
}, {
|
259
|
+
"id": "302-1",
|
260
|
+
"price_str": "188",
|
261
|
+
"currency_code": "USD",
|
262
|
+
"currency_sym": "US$",
|
263
|
+
"provider_name": "Skoosh",
|
264
|
+
"provider_code": "skoosh.com",
|
265
|
+
"mobile_friendly": false,
|
266
|
+
"ex_tax": false,
|
267
|
+
"description": "Double One Bedroom-Executive - Room Only",
|
268
|
+
"is_direct": false
|
269
|
+
}],
|
270
|
+
"room_rates_count": 5,
|
271
|
+
"room_rate_min": {
|
272
|
+
"id": "168-1",
|
273
|
+
"price_str": "135",
|
274
|
+
"currency_code": "USD",
|
275
|
+
"currency_sym": "US$",
|
276
|
+
"provider_name": "Hotels.com",
|
277
|
+
"provider_code": "hotels.com",
|
278
|
+
"mobile_friendly": true,
|
279
|
+
"ex_tax": false,
|
280
|
+
"is_direct": false
|
281
|
+
},
|
282
|
+
"total_reviews": 2395,
|
283
|
+
"positive": 0,
|
284
|
+
"negative": 0,
|
285
|
+
"neutral": 0,
|
286
|
+
"rooms_count": 119,
|
287
|
+
"rank": 2,
|
288
|
+
"satisfaction": 77,
|
289
|
+
"satisfaction_description": "Good",
|
290
|
+
"url": "/hotels/australia/sydney/somerset-darling-harbour-273390",
|
291
|
+
"offer": null,
|
292
|
+
"image": "http://0.omg.io/wego/image/upload/w_200,h_200,c_fill/v1418850021/hotels/273390/2374436.jpg"
|
293
|
+
}, {
|
294
|
+
"id": 529028,
|
295
|
+
"name": "Hilton Sydney",
|
296
|
+
"address": "488 George Street",
|
297
|
+
"districts": [2096],
|
298
|
+
"latitude": -33.87194,
|
299
|
+
"longitude": 151.20695,
|
300
|
+
"property_type": 1,
|
301
|
+
"brand_id": 125,
|
302
|
+
"searched": null,
|
303
|
+
"desc": "Centrally located in the CBD, Hilton Sydney is close to shopping, entertainment and only a short walk from Darling Harbour. The hotel features deluxe accommodation including the luxurious and much-talked about Relaxation Rooms and Suites, while the 4000sqm of flexible event space can accommodate up to 3000 delegates. Few restaurants can match the inspired elegance of glass brasserie where highly awarded restaurateur/Chef Luke Mangan has created the definitive Sydney dining experience. With contemporary design and a rooftop terrace, enjoy cocktails in Zeta bar or visit the heritage-listed Marble Bar renowned for its opulent Victorian decor and live bands. The hotel is also home to LivingWell Premier Health Club, the city’s largest hotel gym, featuring the latest interactive equipment, group fitness studios, saunas, steam rooms, spa and 25m swimming pool. ",
|
304
|
+
"stars": 5,
|
305
|
+
"map": true,
|
306
|
+
"room_rates": [{
|
307
|
+
"id": "168-1",
|
308
|
+
"price_str": "219",
|
309
|
+
"currency_code": "USD",
|
310
|
+
"currency_sym": "US$",
|
311
|
+
"provider_name": "Hotels.com",
|
312
|
+
"provider_code": "hotels.com",
|
313
|
+
"mobile_friendly": true,
|
314
|
+
"ex_tax": false,
|
315
|
+
"is_direct": false,
|
316
|
+
"description": "King Standard Plus - Best Available Rate - REFUNDABLE"
|
317
|
+
}, {
|
318
|
+
"id": "193-1",
|
319
|
+
"price_str": "219",
|
320
|
+
"currency_code": "USD",
|
321
|
+
"currency_sym": "US$",
|
322
|
+
"provider_name": "Expedia.co.th",
|
323
|
+
"provider_code": "expedia.co.th",
|
324
|
+
"mobile_friendly": true,
|
325
|
+
"ex_tax": false,
|
326
|
+
"is_direct": false,
|
327
|
+
"description": "King Standard Plus - Best Available Rate - REFUNDABLE - FREE CANCELLATION"
|
328
|
+
}, {
|
329
|
+
"id": "302-1",
|
330
|
+
"price_str": "231",
|
331
|
+
"currency_code": "USD",
|
332
|
+
"currency_sym": "US$",
|
333
|
+
"provider_name": "Skoosh",
|
334
|
+
"provider_code": "skoosh.com",
|
335
|
+
"mobile_friendly": false,
|
336
|
+
"ex_tax": false,
|
337
|
+
"is_direct": false,
|
338
|
+
"description": "King Hilton Guestroom Plus...City Views, Contemporary Guest Room, Dvd...Aquavision Tv/Shower, Chaise Lounge, Hsi - Room Only"
|
339
|
+
}, {
|
340
|
+
"id": "362-201",
|
341
|
+
"price_str": "248",
|
342
|
+
"currency_code": "USD",
|
343
|
+
"currency_sym": "US$",
|
344
|
+
"provider_name": "Ctrip.com",
|
345
|
+
"provider_code": "english.ctrip.com",
|
346
|
+
"mobile_friendly": false,
|
347
|
+
"ex_tax": false,
|
348
|
+
"is_direct": false,
|
349
|
+
"description": "Deluxe Plus Room King Hilton Deluxe Plus Room (Capacity: 3)"
|
350
|
+
}],
|
351
|
+
"summary_room_rates": [{
|
352
|
+
"id": "168-1",
|
353
|
+
"price_str": "219",
|
354
|
+
"currency_code": "USD",
|
355
|
+
"currency_sym": "US$",
|
356
|
+
"provider_name": "Hotels.com",
|
357
|
+
"provider_code": "hotels.com",
|
358
|
+
"mobile_friendly": true,
|
359
|
+
"ex_tax": false,
|
360
|
+
"description": "King Standard Plus - Best Available Rate - REFUNDABLE",
|
361
|
+
"is_direct": false
|
362
|
+
}, {
|
363
|
+
"id": "193-1",
|
364
|
+
"price_str": "219",
|
365
|
+
"currency_code": "USD",
|
366
|
+
"currency_sym": "US$",
|
367
|
+
"provider_name": "Expedia.co.th",
|
368
|
+
"provider_code": "expedia.co.th",
|
369
|
+
"mobile_friendly": true,
|
370
|
+
"ex_tax": false,
|
371
|
+
"description": "King Standard Plus - Best Available Rate - REFUNDABLE - FREE CANCELLATION",
|
372
|
+
"is_direct": false
|
373
|
+
}, {
|
374
|
+
"id": "302-1",
|
375
|
+
"price_str": "231",
|
376
|
+
"currency_code": "USD",
|
377
|
+
"currency_sym": "US$",
|
378
|
+
"provider_name": "Skoosh",
|
379
|
+
"provider_code": "skoosh.com",
|
380
|
+
"mobile_friendly": false,
|
381
|
+
"ex_tax": false,
|
382
|
+
"description": "King Hilton Guestroom Plus...City Views, Contemporary Guest Room, Dvd...Aquavision Tv/Shower, Chaise Lounge, Hsi - Room Only",
|
383
|
+
"is_direct": false
|
384
|
+
}, {
|
385
|
+
"id": "362-201",
|
386
|
+
"price_str": "248",
|
387
|
+
"currency_code": "USD",
|
388
|
+
"currency_sym": "US$",
|
389
|
+
"provider_name": "Ctrip.com",
|
390
|
+
"provider_code": "english.ctrip.com",
|
391
|
+
"mobile_friendly": false,
|
392
|
+
"ex_tax": false,
|
393
|
+
"description": "Deluxe Plus Room King Hilton Deluxe Plus Room (Capacity: 3)",
|
394
|
+
"is_direct": false
|
395
|
+
}],
|
396
|
+
"room_rates_count": 4,
|
397
|
+
"room_rate_min": {
|
398
|
+
"id": "168-1",
|
399
|
+
"price_str": "219",
|
400
|
+
"currency_code": "USD",
|
401
|
+
"currency_sym": "US$",
|
402
|
+
"provider_name": "Hotels.com",
|
403
|
+
"provider_code": "hotels.com",
|
404
|
+
"mobile_friendly": true,
|
405
|
+
"ex_tax": false,
|
406
|
+
"is_direct": false
|
407
|
+
},
|
408
|
+
"total_reviews": 5582,
|
409
|
+
"positive": 0,
|
410
|
+
"negative": 0,
|
411
|
+
"neutral": 0,
|
412
|
+
"rooms_count": 577,
|
413
|
+
"rank": 3,
|
414
|
+
"satisfaction": 87,
|
415
|
+
"satisfaction_description": "Excellent",
|
416
|
+
"url": "/hotels/australia/sydney/hilton-sydney-529028",
|
417
|
+
"offer": null,
|
418
|
+
"image": "http://1.omg.io/wego/image/upload/w_200,h_200,c_fill/v1447392742/hotels/529028/10473170.jpg"
|
419
|
+
}, {
|
420
|
+
"id": 273063,
|
421
|
+
"name": "Shangri La Hotel Sydney",
|
422
|
+
"address": "176 Cumberland Street",
|
423
|
+
"districts": [51],
|
424
|
+
"latitude": -33.861378,
|
425
|
+
"longitude": 151.206399,
|
426
|
+
"property_type": 1,
|
427
|
+
"brand_id": null,
|
428
|
+
"searched": null,
|
429
|
+
"desc": "As a reflection of our commitment to continuously provide outstanding facilities to all our guests - we are happy to announce the refurbishment of our Horizon Club Rooms and Lounge from 1 Aug 2014 to late Oct 2014 - The Hotel will also conduct a soft refurbishment to the Lobby and entrance area from late July 2014 to mid-Sep 2014 which will entail a light upgrade of the current facilities and furnishings.\r\n\r\nDuring this time-the rest of the hotel including Cafe Mix - Altitude Restaurant and Blu Bar on level 36 will remain operational and accessible to all guests.\r\n\r\nAll measures will be taken to minimise disruption to our guests-with all renovation works confined to the lobby and levels 30-35 of the hotel and restricted to normal business hours.\r\n\r\nShangri-La Hotel Sydney is located 8 miles north of SYD Airport in the historic Rocks district between the Opera House and Harbour Bridge. Shangri-La Hotel Sydney offers the brightest views of Sydney Harbour - Circular Quay - Sydney Opera House and the Sydney Harbour Bridge. Several restaurants - pubs and shops are all within a short walk of the hotel.\r\n.\r\nLuxurious facilities and services include a business center - health club - spa - award-winning fine dining - meeting rooms - accessible facilities - 24 hour room service and concierge - indoor swimming pool and a bar on the 36th floor with breathtaking views.\r\n\r\nMany of the 563 large and well-appointed rooms and suites offer memorable views of the Sydney Opera House and Harbour. Room amenities include marble bathroom - separate bath and shower - mini-bar - work desk with both wireless and network high speed Internet access - cable TV with premium channels - complimentary and pay-per-view movies - hair dryer - iron and board - blackout drapes - daily newspaper - coffee-tea maker - bedside controls and in room safe.",
|
430
|
+
"stars": 5,
|
431
|
+
"map": true,
|
432
|
+
"room_rates": [{
|
433
|
+
"id": "402-601",
|
434
|
+
"price_str": "262",
|
435
|
+
"currency_code": "USD",
|
436
|
+
"currency_sym": "US$",
|
437
|
+
"provider_name": "Shangri-La",
|
438
|
+
"provider_code": "shangri-la.com",
|
439
|
+
"mobile_friendly": true,
|
440
|
+
"ex_tax": false,
|
441
|
+
"is_direct": false,
|
442
|
+
"description": "Best Available Rate / CustomStay-Deluxe Grand Harbour View Room(Twin)"
|
443
|
+
}, {
|
444
|
+
"id": "193-1",
|
445
|
+
"price_str": "264",
|
446
|
+
"currency_code": "USD",
|
447
|
+
"currency_sym": "US$",
|
448
|
+
"provider_name": "Expedia.co.th",
|
449
|
+
"provider_code": "expedia.co.th",
|
450
|
+
"mobile_friendly": true,
|
451
|
+
"ex_tax": false,
|
452
|
+
"is_direct": false,
|
453
|
+
"description": "Deluxe Grand Harbour View King - REFUNDABLE - FREE CANCELLATION"
|
454
|
+
}, {
|
455
|
+
"id": "302-1",
|
456
|
+
"price_str": "305",
|
457
|
+
"currency_code": "USD",
|
458
|
+
"currency_sym": "US$",
|
459
|
+
"provider_name": "Skoosh",
|
460
|
+
"provider_code": "skoosh.com",
|
461
|
+
"mobile_friendly": false,
|
462
|
+
"ex_tax": false,
|
463
|
+
"is_direct": false,
|
464
|
+
"description": "Deluxe (1 Bed)"
|
465
|
+
}, {
|
466
|
+
"id": "376-1",
|
467
|
+
"price_str": "311",
|
468
|
+
"currency_code": "USD",
|
469
|
+
"currency_sym": "US$",
|
470
|
+
"provider_name": "Prestigia.com",
|
471
|
+
"provider_code": "prestigia.com",
|
472
|
+
"mobile_friendly": false,
|
473
|
+
"ex_tax": false,
|
474
|
+
"is_direct": false,
|
475
|
+
"description": "DOUBLE HORIZON-DARLING HARBOUR VIEW-KING"
|
476
|
+
}],
|
477
|
+
"summary_room_rates": [{
|
478
|
+
"id": "402-601",
|
479
|
+
"price_str": "262",
|
480
|
+
"currency_code": "USD",
|
481
|
+
"currency_sym": "US$",
|
482
|
+
"provider_name": "Shangri-La",
|
483
|
+
"provider_code": "shangri-la.com",
|
484
|
+
"mobile_friendly": true,
|
485
|
+
"ex_tax": false,
|
486
|
+
"description": "Best Available Rate / CustomStay-Deluxe Grand Harbour View Room(Twin)",
|
487
|
+
"is_direct": false
|
488
|
+
}, {
|
489
|
+
"id": "193-1",
|
490
|
+
"price_str": "264",
|
491
|
+
"currency_code": "USD",
|
492
|
+
"currency_sym": "US$",
|
493
|
+
"provider_name": "Expedia.co.th",
|
494
|
+
"provider_code": "expedia.co.th",
|
495
|
+
"mobile_friendly": true,
|
496
|
+
"ex_tax": false,
|
497
|
+
"description": "Deluxe Grand Harbour View King - REFUNDABLE - FREE CANCELLATION",
|
498
|
+
"is_direct": false
|
499
|
+
}, {
|
500
|
+
"id": "302-1",
|
501
|
+
"price_str": "305",
|
502
|
+
"currency_code": "USD",
|
503
|
+
"currency_sym": "US$",
|
504
|
+
"provider_name": "Skoosh",
|
505
|
+
"provider_code": "skoosh.com",
|
506
|
+
"mobile_friendly": false,
|
507
|
+
"ex_tax": false,
|
508
|
+
"description": "Deluxe (1 Bed)",
|
509
|
+
"is_direct": false
|
510
|
+
}, {
|
511
|
+
"id": "376-1",
|
512
|
+
"price_str": "311",
|
513
|
+
"currency_code": "USD",
|
514
|
+
"currency_sym": "US$",
|
515
|
+
"provider_name": "Prestigia.com",
|
516
|
+
"provider_code": "prestigia.com",
|
517
|
+
"mobile_friendly": false,
|
518
|
+
"ex_tax": false,
|
519
|
+
"description": "DOUBLE HORIZON-DARLING HARBOUR VIEW-KING",
|
520
|
+
"is_direct": false
|
521
|
+
}],
|
522
|
+
"room_rates_count": 4,
|
523
|
+
"room_rate_min": {
|
524
|
+
"id": "402-601",
|
525
|
+
"price_str": "262",
|
526
|
+
"currency_code": "USD",
|
527
|
+
"currency_sym": "US$",
|
528
|
+
"provider_name": "Shangri-La",
|
529
|
+
"provider_code": "shangri-la.com",
|
530
|
+
"mobile_friendly": true,
|
531
|
+
"ex_tax": false,
|
532
|
+
"is_direct": false
|
533
|
+
},
|
534
|
+
"total_reviews": 5717,
|
535
|
+
"positive": 0,
|
536
|
+
"negative": 0,
|
537
|
+
"neutral": 0,
|
538
|
+
"rooms_count": 563,
|
539
|
+
"rank": 4,
|
540
|
+
"satisfaction": 89,
|
541
|
+
"satisfaction_description": "Excellent",
|
542
|
+
"url": "/hotels/australia/sydney/shangri-la-hotel-sydney-273063",
|
543
|
+
"offer": null,
|
544
|
+
"image": "http://1.omg.io/wego/image/upload/w_200,h_200,c_fill/v1427401945/hotels/273063/3574742.jpg"
|
545
|
+
}, {
|
546
|
+
"id": 273231,
|
547
|
+
"name": "Four Seasons Sydney",
|
548
|
+
"address": "199 George Street",
|
549
|
+
"districts": [51],
|
550
|
+
"latitude": -33.861507,
|
551
|
+
"longitude": 151.207752,
|
552
|
+
"property_type": 1,
|
553
|
+
"brand_id": 97,
|
554
|
+
"searched": null,
|
555
|
+
"desc": "The Four Seasons Hotel Sydney is a high rise modern hotel overlooking sydney harbour and the opera house. This signature landmark on the harbourfront offers easy access to both business and leisure districts.\n\nGuest rooms were refurbished in 2009, are quietly secluded on floors 6 to 34 of the tower and are decorated in a contemporary grand luxe style with rich silks and mahogany furniture.\n\nThe hotels four signature suites were renovate in 2011, located on level 34, offer stylish art-deco, new york-style apartment living, in the hear of sydney. Bookings for the signature suites must be made directly with the hotel.\n\nGuests may also purchase access for a nominal fee to the executive club featuring added amenities such as complimentary breakfast, afternoon hors doeuvres, and other services. The hotel offers brasserie-style cuisine, an award winning spa and state of the art fitness centre as well as sydneys largest outdoor hotel swimming pool. The vibrant elegant Four Seasons Hotel Sydney with its friendly australian charm will make every stay memorable.\n\nFour Seasons Hotel Sydney is a non-smoking hotel. This includes all Guest Rooms, Suites and indoor public spaces.",
|
556
|
+
"stars": 5,
|
557
|
+
"map": true,
|
558
|
+
"room_rates": [{
|
559
|
+
"id": "168-1",
|
560
|
+
"price_str": "295",
|
561
|
+
"currency_code": "USD",
|
562
|
+
"currency_sym": "US$",
|
563
|
+
"provider_name": "Hotels.com",
|
564
|
+
"provider_code": "hotels.com",
|
565
|
+
"mobile_friendly": true,
|
566
|
+
"ex_tax": false,
|
567
|
+
"is_direct": false,
|
568
|
+
"description": "Premier City Room - REFUNDABLE"
|
569
|
+
}, {
|
570
|
+
"id": "193-1",
|
571
|
+
"price_str": "295",
|
572
|
+
"currency_code": "USD",
|
573
|
+
"currency_sym": "US$",
|
574
|
+
"provider_name": "Expedia.co.th",
|
575
|
+
"provider_code": "expedia.co.th",
|
576
|
+
"mobile_friendly": true,
|
577
|
+
"ex_tax": false,
|
578
|
+
"is_direct": false,
|
579
|
+
"description": "Premier City Room - REFUNDABLE - FREE CANCELLATION"
|
580
|
+
}, {
|
581
|
+
"id": "376-1",
|
582
|
+
"price_str": "304",
|
583
|
+
"currency_code": "USD",
|
584
|
+
"currency_sym": "US$",
|
585
|
+
"provider_name": "Prestigia.com",
|
586
|
+
"provider_code": "prestigia.com",
|
587
|
+
"mobile_friendly": false,
|
588
|
+
"ex_tax": false,
|
589
|
+
"is_direct": false,
|
590
|
+
"description": "DOUBLE CLUB-DELUXE-KING"
|
591
|
+
}],
|
592
|
+
"summary_room_rates": [{
|
593
|
+
"id": "168-1",
|
594
|
+
"price_str": "295",
|
595
|
+
"currency_code": "USD",
|
596
|
+
"currency_sym": "US$",
|
597
|
+
"provider_name": "Hotels.com",
|
598
|
+
"provider_code": "hotels.com",
|
599
|
+
"mobile_friendly": true,
|
600
|
+
"ex_tax": false,
|
601
|
+
"description": "Premier City Room - REFUNDABLE",
|
602
|
+
"is_direct": false
|
603
|
+
}, {
|
604
|
+
"id": "193-1",
|
605
|
+
"price_str": "295",
|
606
|
+
"currency_code": "USD",
|
607
|
+
"currency_sym": "US$",
|
608
|
+
"provider_name": "Expedia.co.th",
|
609
|
+
"provider_code": "expedia.co.th",
|
610
|
+
"mobile_friendly": true,
|
611
|
+
"ex_tax": false,
|
612
|
+
"description": "Premier City Room - REFUNDABLE - FREE CANCELLATION",
|
613
|
+
"is_direct": false
|
614
|
+
}, {
|
615
|
+
"id": "376-1",
|
616
|
+
"price_str": "304",
|
617
|
+
"currency_code": "USD",
|
618
|
+
"currency_sym": "US$",
|
619
|
+
"provider_name": "Prestigia.com",
|
620
|
+
"provider_code": "prestigia.com",
|
621
|
+
"mobile_friendly": false,
|
622
|
+
"ex_tax": false,
|
623
|
+
"description": "DOUBLE CLUB-DELUXE-KING",
|
624
|
+
"is_direct": false
|
625
|
+
}],
|
626
|
+
"room_rates_count": 3,
|
627
|
+
"room_rate_min": {
|
628
|
+
"id": "168-1",
|
629
|
+
"price_str": "295",
|
630
|
+
"currency_code": "USD",
|
631
|
+
"currency_sym": "US$",
|
632
|
+
"provider_name": "Hotels.com",
|
633
|
+
"provider_code": "hotels.com",
|
634
|
+
"mobile_friendly": true,
|
635
|
+
"ex_tax": false,
|
636
|
+
"is_direct": false
|
637
|
+
},
|
638
|
+
"total_reviews": 4039,
|
639
|
+
"positive": 0,
|
640
|
+
"negative": 0,
|
641
|
+
"neutral": 0,
|
642
|
+
"rooms_count": 531,
|
643
|
+
"rank": 5,
|
644
|
+
"satisfaction": 90,
|
645
|
+
"satisfaction_description": "Excellent",
|
646
|
+
"url": "/hotels/australia/sydney/four-seasons-sydney-273231",
|
647
|
+
"offer": null,
|
648
|
+
"image": "http://0.omg.io/wego/image/upload/w_200,h_200,c_fill/v1418238803/hotels/273231/29712669.jpg"
|
649
|
+
}]
|
650
|
+
}
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "webmock/rspec"
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require "wego"
|
4
|
+
require "wego/rspec"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.before :suite do
|
8
|
+
Wego.configure do |wego_config|
|
9
|
+
wego_config.api_key = "WEGO_API_KEY"
|
10
|
+
wego_config.api_code = "WEGO_API_CODE"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def restore_default_config
|
16
|
+
Wego.configuration = nil
|
17
|
+
Wego.configure {}
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module FakeWegoApi
|
2
|
+
def stub_get_location_api(options = {})
|
3
|
+
stub_api_response("locations/search", options, filename: "locations")
|
4
|
+
end
|
5
|
+
|
6
|
+
def stub_new_search_api(search_terms)
|
7
|
+
stub_api_response("search/new", search_terms, filename: "search")
|
8
|
+
end
|
9
|
+
|
10
|
+
def stub_search_results_api(search_id, options = {})
|
11
|
+
stub_api_response("search/#{search_id}", options, filename: "results")
|
12
|
+
end
|
13
|
+
|
14
|
+
def stub_search_result_api(search_id:, hotel_id:)
|
15
|
+
stub_api_response(
|
16
|
+
"search/#{search_id}", { hotel_id: hotel_id }, filename: "result"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def stub_invalid_api_response(status: 404)
|
21
|
+
stub_api_response(
|
22
|
+
"invalid/resource", {}, filename: "error", status: status
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def stub_api_response(end_point, options, filename:, status: 200)
|
29
|
+
stub_request(:get, api_path(end_point, options)).
|
30
|
+
to_return(response_with(filename: filename, status: status))
|
31
|
+
end
|
32
|
+
|
33
|
+
def api_path(end_point, attributes = {})
|
34
|
+
Wego::Client.new(end_point, attributes).url
|
35
|
+
end
|
36
|
+
|
37
|
+
def response_with(filename:, status:)
|
38
|
+
{ body: fixture_file(filename), status: status }
|
39
|
+
end
|
40
|
+
|
41
|
+
def fixture_file(filename)
|
42
|
+
file_name = [filename, "json"].join(".")
|
43
|
+
file_path = ["../../fixtures", file_name].join("/")
|
44
|
+
|
45
|
+
File.read(File.expand_path(file_path, __FILE__))
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Booking do
|
4
|
+
describe "#redirect_url" do
|
5
|
+
it "prepares the redirect url" do
|
6
|
+
booking_url = Wego::Booking.url_for(
|
7
|
+
716_073_46, hotel_id: 273_451, room_rate_id: 12
|
8
|
+
)
|
9
|
+
|
10
|
+
expect(booking_url).to include("search/redirect/71607346?")
|
11
|
+
expect(booking_url).to include("hotel_id=273451&room_rate_id=12")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Wego, ".get_resource" do
|
4
|
+
context "when resource exists" do
|
5
|
+
it "submit a get request" do
|
6
|
+
location_name = "sydney"
|
7
|
+
stub_get_location_api(q: location_name)
|
8
|
+
|
9
|
+
expect(
|
10
|
+
Wego.get_resource("locations/search", q: location_name).query
|
11
|
+
).to eq(location_name)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when resource does not exists" do
|
16
|
+
it "returns nil" do
|
17
|
+
stub_invalid_api_response(status: 404)
|
18
|
+
expect(Wego.get_resource("invalid/resource")).to be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when user submit invalid data" do
|
23
|
+
it "simple ignore it and returns nil" do
|
24
|
+
stub_invalid_api_response(status: 400)
|
25
|
+
expect(Wego.get_resource("invalid/resource")).to be_nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec.describe Wego::Client, "#url" do
|
31
|
+
it "reutns the url with serialized params" do
|
32
|
+
attrs = { location: "dhaka" }
|
33
|
+
resource = Wego::Client.new("/custom", attrs)
|
34
|
+
|
35
|
+
expect(resource.url).to include("/custom?#{wego_api_path(attrs)}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def wego_api_path(options = {})
|
39
|
+
params = Wego.configuration.api_keys.merge(options)
|
40
|
+
params.map { |key, value| "#{key}=#{value}" }.join("&")
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Configuration do
|
4
|
+
after { restore_default_config }
|
5
|
+
|
6
|
+
context "when no api host specified" do
|
7
|
+
it "defualts to api.wego.com" do
|
8
|
+
default_host = "http://api.wego.com/hotels/api"
|
9
|
+
expect(Wego.configuration.api_host).to eq(default_host)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when custom api host specified" do
|
14
|
+
it "is used instead of default host" do
|
15
|
+
custom_api_host = "https://custom.api.host/search"
|
16
|
+
Wego.configure { |config| config.api_host = custom_api_host }
|
17
|
+
|
18
|
+
expect(Wego.configuration.api_host).to eq(custom_api_host)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when api_code specified" do
|
23
|
+
it "is used" do
|
24
|
+
custom_api_code = "code123456"
|
25
|
+
Wego.configure { |config| config.api_code = custom_api_code }
|
26
|
+
|
27
|
+
expect(Wego.configuration.api_code).to eq(custom_api_code)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when api_key specified" do
|
32
|
+
it "is used" do
|
33
|
+
custom_api_key = "key123456"
|
34
|
+
Wego.configure { |config| config.api_key = custom_api_key }
|
35
|
+
|
36
|
+
expect(Wego.configuration.api_key).to eq(custom_api_key)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#api_keys" do
|
41
|
+
it "returns the api keys in required format" do
|
42
|
+
Wego.configure do |config|
|
43
|
+
config.api_key = "custom_api_key"
|
44
|
+
config.api_code = "custom_api_code"
|
45
|
+
end
|
46
|
+
|
47
|
+
expect(
|
48
|
+
Wego.configuration.api_keys
|
49
|
+
).to eq(ts_code: "custom_api_code", key: "custom_api_key")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Location do
|
4
|
+
it "retrive locations" do
|
5
|
+
location_name = "sydney"
|
6
|
+
stub_get_location_api(q: location_name, lang: "en")
|
7
|
+
location = Wego::Location.find(location_name, lang: "en")
|
8
|
+
|
9
|
+
expect(location.count).to eq(3)
|
10
|
+
expect(location.query).to eq(location_name)
|
11
|
+
expect(location.locations.first.country_name).to eq("Australia")
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Response do
|
4
|
+
describe ".parse_json" do
|
5
|
+
it "parses json response" do
|
6
|
+
content = File.read "./spec/fixtures/locations.json"
|
7
|
+
response = Wego::Response.parse_json(content)
|
8
|
+
|
9
|
+
expect(response.count).to eq(3)
|
10
|
+
expect(response.class).to be Wego::OpenStruct
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Result do
|
4
|
+
describe ".find" do
|
5
|
+
context "when no hotel specified" do
|
6
|
+
it "returns search results" do
|
7
|
+
search_id = 716_073_46
|
8
|
+
stub_search_results_api(search_id)
|
9
|
+
results = Wego::Result.find search_id
|
10
|
+
|
11
|
+
expect(results.count).to eq(5)
|
12
|
+
expect(results.hotels.first.name).to eq("Parkroyal Darling Harbour")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when hotel_id specified" do
|
17
|
+
it "returns one specific hotels" do
|
18
|
+
search_id = 716_073_46
|
19
|
+
hotel_id = 273_451
|
20
|
+
stub_search_result_api(search_id: search_id, hotel_id: hotel_id)
|
21
|
+
result = Wego::Result.find search_id, hotel_id: hotel_id
|
22
|
+
|
23
|
+
expect(result.hotel.name).to eq("InterContinental Sydney")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when customized option provided" do
|
28
|
+
it "filters the search results" do
|
29
|
+
search_id = 716_073_46
|
30
|
+
options = { lang: "en", sort: "popularity" }
|
31
|
+
stub_search_results_api(search_id, options)
|
32
|
+
results = Wego::Result.find search_id, options
|
33
|
+
|
34
|
+
expect(results.hotels.first.name).to eq("Parkroyal Darling Harbour")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wego::Search do
|
4
|
+
describe ".create" do
|
5
|
+
it "create new search" do
|
6
|
+
search_terms = {
|
7
|
+
location_id: "7046",
|
8
|
+
check_in: "2016-05-20",
|
9
|
+
check_out: "2016-05-25",
|
10
|
+
user_ip: "127.0.0.1",
|
11
|
+
rooms: 1,
|
12
|
+
guests: 2
|
13
|
+
}
|
14
|
+
|
15
|
+
stub_new_search_api(search_terms)
|
16
|
+
search = Wego::Search.create(search_terms)
|
17
|
+
|
18
|
+
expect(search.search_id).not_to be_nil
|
19
|
+
expect(search.is_done).to be_falsey
|
20
|
+
expect(search.created_at).not_to be_nil
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when date time provided" do
|
24
|
+
it "formats as required" do
|
25
|
+
stub_new_search_api(
|
26
|
+
location_id: "7046", check_in: "2016-05-23",
|
27
|
+
check_out: "2016-05-28", user_ip: "127.0.0.1"
|
28
|
+
)
|
29
|
+
|
30
|
+
search = Wego::Search.create(
|
31
|
+
location_id: "7046", check_in: "2016-05-23 15:05:21 UTC",
|
32
|
+
check_out: "28 May 2016, 15:05:21 UTC", user_ip: "127.0.0.1"
|
33
|
+
)
|
34
|
+
|
35
|
+
expect(search).not_to be_nil
|
36
|
+
expect(search.is_done).to be_falsey
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/wego.gemspec
CHANGED
@@ -13,9 +13,10 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "http://www.wan.travel/api"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = `git ls-files
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.1.9")
|
19
20
|
|
20
21
|
spec.add_dependency "rest-client", "~> 1.8"
|
21
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wego
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abu Nashir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -121,6 +121,20 @@ files:
|
|
121
121
|
- lib/wego/rspec.rb
|
122
122
|
- lib/wego/search.rb
|
123
123
|
- lib/wego/version.rb
|
124
|
+
- spec/fixtures/error.json
|
125
|
+
- spec/fixtures/locations.json
|
126
|
+
- spec/fixtures/result.json
|
127
|
+
- spec/fixtures/results.json
|
128
|
+
- spec/fixtures/search.json
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
- spec/support/fake_wego_api.rb
|
131
|
+
- spec/wego/booking_spec.rb
|
132
|
+
- spec/wego/client_spec.rb
|
133
|
+
- spec/wego/configuration_spec.rb
|
134
|
+
- spec/wego/location_spec.rb
|
135
|
+
- spec/wego/response_spec.rb
|
136
|
+
- spec/wego/result_spec.rb
|
137
|
+
- spec/wego/search_spec.rb
|
124
138
|
- wego.gemspec
|
125
139
|
homepage: http://www.wan.travel/api
|
126
140
|
licenses:
|
@@ -134,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
148
|
requirements:
|
135
149
|
- - ">="
|
136
150
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
151
|
+
version: 2.1.9
|
138
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
153
|
requirements:
|
140
154
|
- - ">="
|