Class: MockSearchOneway
- Inherits:
-
MockSearch
- Object
- MockSearch
- MockSearchOneway
- Defined in:
- lib/mock_search/mock_search_oneway.rb
Instance Attribute Summary collapse
-
#city_from_1 ⇒ Object
readonly
Returns the value of attribute city_from_1.
-
#city_to_1 ⇒ Object
readonly
Returns the value of attribute city_to_1.
-
#date_from_1 ⇒ Object
readonly
Returns the value of attribute date_from_1.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes inherited from MockSearch
#adt, #cabotage, #cnn, #host, #inf
Instance Method Summary collapse
-
#generate_url_anticipated_search ⇒ Object
genero una url para una busqueda anticipada.
-
#generate_url_disambiguation_airports(city) ⇒ Object
genero una url para ingresar a desambiguacion de aeropuertos.
-
#generate_url_disambiguation_city ⇒ Object
genero una url para ingresar a desambiguacion de ciudades.
-
#generate_url_results_search(params = "", site_country = nil) ⇒ Object
genero una url de busqueda basica.
- #get_advanced_bussinnes ⇒ Object
- #get_indec_airlines(env) ⇒ Object
-
#initialize(site, env, cabotage) ⇒ MockSearchOneway
constructor
A new instance of MockSearchOneway.
- #to_city_description ⇒ Object
Methods inherited from MockSearch
#generar_host, #generate_post_alert_url, #get_childrens, #passengers, #set_from_city, #set_to_city, #to_city_change
Constructor Details
#initialize(site, env, cabotage) ⇒ MockSearchOneway
Returns a new instance of MockSearchOneway.
5 6 7 8 9 10 11 12 |
# File 'lib/mock_search/mock_search_oneway.rb', line 5 def initialize(site,env,cabotage) super(site,env,cabotage) @city_from_1 = MockCity.new(@site) @city_to_1 = @city_from_1.generate_to_city(@cabotage) @date_from_1 = Date.today + 60 + rand(15) @description = "oneway" @path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{passengers}" end |
Instance Attribute Details
#city_from_1 ⇒ Object (readonly)
Returns the value of attribute city_from_1.
3 4 5 |
# File 'lib/mock_search/mock_search_oneway.rb', line 3 def city_from_1 @city_from_1 end |
#city_to_1 ⇒ Object (readonly)
Returns the value of attribute city_to_1.
3 4 5 |
# File 'lib/mock_search/mock_search_oneway.rb', line 3 def city_to_1 @city_to_1 end |
#date_from_1 ⇒ Object (readonly)
Returns the value of attribute date_from_1.
3 4 5 |
# File 'lib/mock_search/mock_search_oneway.rb', line 3 def date_from_1 @date_from_1 end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/mock_search/mock_search_oneway.rb', line 3 def description @description end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/mock_search/mock_search_oneway.rb', line 3 def path @path end |
Instance Method Details
#generate_url_anticipated_search ⇒ Object
genero una url para una busqueda anticipada
32 33 34 |
# File 'lib/mock_search/mock_search_oneway.rb', line 32 def generate_url_anticipated_search() return @host + "/shop/flights/test/data/search/begin/oneway/" + @path end |
#generate_url_disambiguation_airports(city) ⇒ Object
genero una url para ingresar a desambiguacion de aeropuertos
21 22 23 24 |
# File 'lib/mock_search/mock_search_oneway.rb', line 21 def generate_url_disambiguation_airports(city) @path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{passengers}" return @host + "/shop/flights/disambiguation/airports/oneway/" + @path end |
#generate_url_disambiguation_city ⇒ Object
genero una url para ingresar a desambiguacion de ciudades
27 28 29 |
# File 'lib/mock_search/mock_search_oneway.rb', line 27 def generate_url_disambiguation_city() return @host + "/shop/flights/search/oneway/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2" end |
#generate_url_results_search(params = "", site_country = nil) ⇒ Object
genero una url de busqueda basica
15 16 17 18 |
# File 'lib/mock_search/mock_search_oneway.rb', line 15 def generate_url_results_search(params = "",site_country=nil) to_city_change(site_country) if site_country return @host + "/shop/flights/results/oneway/" + @path + params end |
#get_advanced_bussinnes ⇒ Object
36 37 38 |
# File 'lib/mock_search/mock_search_oneway.rb', line 36 def get_advanced_bussinnes() return "/NA/C/NA/NA" end |
#get_indec_airlines(env) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/mock_search/mock_search_oneway.rb', line 40 def get_indec_airlines(env) servers = { "rc"=>"http://lb.despegar.it/", "beta"=>"http://backoffice.despegar.com/", "produccion"=>"http://backoffice.despegar.com/" } respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}") return respond end |
#to_city_description ⇒ Object
50 51 52 |
# File 'lib/mock_search/mock_search_oneway.rb', line 50 def to_city_description() return @city_to_1.name.no_accents end |