Class: MockSearchMultipledestinations

Inherits:
MockSearch
  • Object
show all
Defined in:
lib/mock_search/mock_search_multipledestinations.rb

Instance Attribute Summary collapse

Attributes inherited from MockSearch

#adt, #cabotage, #cnn, #host, #inf, #itinerary, #json

Instance Method Summary collapse

Methods inherited from MockSearch

#digest_md5, #generar_host, #generate_post_alert_url, #generate_url_checkout, #generate_url_landing_airline, #generate_url_landing_arrival_airport, #generate_url_landing_origin_airport, #get_childrens, #get_results_search_service, #paginate, #passengers, #set_from_city, #set_to_city, #to_city_change

Constructor Details

#initialize(site, env, cabotage, params = {}) ⇒ MockSearchMultipledestinations

Returns a new instance of MockSearchMultipledestinations.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 5

def initialize(site,env,cabotage,params={})
	super(site,env,cabotage)
	@city_from_1  = MockCity.new(@site)
 	@city_to_1    = @city_from_1.generate_city([@city_from_1.code])
 	@city_from_2  = @city_to_1
 	@city_to_2    = @city_from_1.generate_city([@city_from_1.code,@city_from_2.code])
 	@city_from_3  = @city_to_2
 	@city_to_3    = @city_from_1
 	@date_from_1  = Date.today+120
 	@date_from_2  = Date.today+130+rand(10)
 	@date_from_3  = Date.today+140+rand(10)
   @description  = "multipledestinations"
 	@path = "#{@city_from_1.code},#{@city_from_2.code},#{@city_from_3.code}/#{@city_to_1.code},#{@city_to_2.code},#{@city_to_3.code}/#{@date_from_1},#{@date_from_2},#{@date_from_3}/#{passengers}"
end

Instance Attribute Details

#city_from_1Object (readonly)

Returns the value of attribute city_from_1.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_from_1
  @city_from_1
end

#city_from_2Object (readonly)

Returns the value of attribute city_from_2.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_from_2
  @city_from_2
end

#city_from_3Object (readonly)

Returns the value of attribute city_from_3.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_from_3
  @city_from_3
end

#city_to_1Object (readonly)

Returns the value of attribute city_to_1.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_to_1
  @city_to_1
end

#city_to_2Object (readonly)

Returns the value of attribute city_to_2.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_to_2
  @city_to_2
end

#city_to_3Object (readonly)

Returns the value of attribute city_to_3.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def city_to_3
  @city_to_3
end

#date_from_1Object (readonly)

Returns the value of attribute date_from_1.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def date_from_1
  @date_from_1
end

#date_from_2Object (readonly)

Returns the value of attribute date_from_2.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def date_from_2
  @date_from_2
end

#date_from_3Object (readonly)

Returns the value of attribute date_from_3.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def date_from_3
  @date_from_3
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def description
  @description
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 3

def path
  @path
end

Instance Method Details

#generate_url_anticipated_searchObject

genero una url para una busqueda anticipada



38
39
40
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 38

def generate_url_anticipated_search()
   return @host + "/shop/flights/test/data/search/begin/multipledestinations/" + @path
end

#generate_url_disambiguation_airports(city) ⇒ Object

genero una url para ingresar a desambiguacion de aeropuertos



27
28
29
30
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 27

def generate_url_disambiguation_airports(city)
  @path = "#{@city_from_1.code},#{city},#{@city_from_3.code}/#{city},#{@city_to_2.code},#{@city_to_3.code}/#{@date_from_1},#{@date_from_2},#{@date_from_3}/#{passengers}"
  return @host + "/shop/flights/results/multipledestinations/" + @path
end

#generate_url_disambiguation_cityObject

genero una url para ingresar a desambiguacion de ciudades



33
34
35
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 33

def generate_url_disambiguation_city()
  	return @host + "/shop/flights/search/multipledestinations/" + @path.gsub(/(\D{3}),(\D{3}),(\D{3})\/(\D{3}),(\D{3}),(\D{3})\//,"___,___,___/___,___,___/") + "?toDescriptions=test1,test2,test3&fromDescriptions=test4,test5,test6"
end

#generate_url_results_search(params = "", site_country = nil) ⇒ Object

genero una url de busqueda basica



21
22
23
24
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 21

def generate_url_results_search(params = "",site_country=nil)
  to_city_change(site_country) if site_country
  return @host + "/shop/flights/results/multipledestinations/" + @path + params
end

#generate_url_results_search_serviceObject

genero la url del servicio de resultados



43
44
45
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 43

def generate_url_results_search_service()
  return @host + "/shop/flights/data/search/multipledestinations/" + @path + "/TOTALFARE/ASCENDING?hashForData=#{digest_md5()}"
end

#get_advanced_bussinnesObject



52
53
54
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 52

def get_advanced_bussinnes
  return ""
end

#get_indec_airlines(env) ⇒ Object



56
57
58
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 56

def get_indec_airlines(env)
   return []
end

#get_ticket_dateObject



47
48
49
50
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 47

def get_ticket_date()
  super()
  @result_hash['itinerary_hash']  = @itinerary['id']
end

#set_from_date(date_from) ⇒ Object



64
65
66
67
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 64

def set_from_date(date_from)
  @date_from_1 = date_from
  @path = "#{@city_from_1.code},#{@city_from_2.code},#{@city_from_3.code}/#{@city_to_1.code},#{@city_to_2.code},#{@city_to_3.code}/#{@date_from_1},#{@date_from_2},#{@date_from_3}/#{passengers}"
end

#to_city_descriptionObject



60
61
62
# File 'lib/mock_search/mock_search_multipledestinations.rb', line 60

def to_city_description()
 	return "#{@city_to_1},#{@city_to_2},#{@city_to_3}"
end