mock_search 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8440843434654a8075eceaa895572ac8163d3631
4
- data.tar.gz: 3960eba0052e9e4d3bac0bdd2a39c863b8d013f0
3
+ metadata.gz: 2e5872db0e2cbf0fc4219aabc315a97d535da834
4
+ data.tar.gz: de81435c7901fb2077084cf52b5bb620980d1c37
5
5
  SHA512:
6
- metadata.gz: bfd7fe01ca108727845f3db4b99316a209641094c2ef71a4397ff58a17128ae2658695de074353e2d3c10be01d43aa3f6019f2469f6ef17d5bb99910429f370c
7
- data.tar.gz: 56c1ac96070bc8d048c40e73dae424cf6226c57f3e444a52b51faca976262ea312ed9bc1db7a654c6ee78b33799dd559da4ff94c6b0179329bc54341f845bb1c
6
+ metadata.gz: 63a97b796740731badd951e8b1bacfe9f34e3792013969a1bf7ddc95ba5c24874abd3c766a3d898535017f32d03a12b39f9ab74c4edfa0f90f6850e9a636e3b0
7
+ data.tar.gz: ec9d613bf2911041419f33edc21f1832b297446589be3b4d2ccf2c717126b846b433965fa24c15664a4011bbc9fff644fce07381f22bcb59484c73417c6fc579
@@ -0,0 +1,123 @@
1
+ class MockSearchMultipleoneway < MockSearch
2
+
3
+ attr_reader :city_from_1, :city_to_1, :date_from_1, :date_to_1, :description, :path
4
+
5
+ def initialize(site,env,cabotage,params={})
6
+ super(site,env,cabotage)
7
+ unless (params.nil? or params.empty?)
8
+ @city_from_1 = MockCity.new(@site,params["from"])
9
+ @city_to_1 = MockCity.new(@site,params["to"])
10
+ else
11
+ @city_from_1 = MockCity.new(@site)
12
+ @city_to_1 = @city_from_1.generate_to_city(@cabotage)
13
+ end
14
+ @date_from_1 = Date.today + 120 + rand(15)
15
+ @date_to_1 = @date_from_1 + rand(15)
16
+ @description = "multipleoneway"
17
+ @path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
18
+ end
19
+
20
+ #genero una url de busqueda basica
21
+ def generate_url_results_search(params = "",site_country=nil)
22
+ to_city_change(site_country) if site_country
23
+ return @host + "/shop/flights/results/multipleoneway/" + @path + params
24
+ end
25
+
26
+ #genero una url para ingresar a desambiguacion de aeropuertos
27
+ def generate_url_disambiguation_airports(city)
28
+ @path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
29
+ return @host + "/shop/flights/results/multipleoneway/" + @path
30
+ end
31
+
32
+ #genero una url para ingresar a desambiguacion de ciudades
33
+ def generate_url_disambiguation_city()
34
+ return @host + "/shop/flights/search/multipleoneway/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2"
35
+ end
36
+
37
+ #genero una url para una busqueda anticipada
38
+ def generate_url_anticipated_search()
39
+ return @host + "/shop/flights/test/data/search/begin/multipleoneway/" + @path
40
+ end
41
+
42
+ #genero la url de resultados de landing a partir de una ciudad de salida y una ciudad de destino
43
+ def generate_url_landing_search(dep,ret)
44
+ landing = case @site
45
+ when "BR" then "/passagens-aereas"
46
+ when "US" then "/flights"
47
+ when "CN" then "/flights"
48
+ when "IN" then "/flights"
49
+ when "PT" then "/passagens-aereas"
50
+ else "/vuelos"
51
+ end
52
+ return @host + landing + "/#{dep}/#{ret}"
53
+ end
54
+
55
+ #genero la url para ingresar a la home de vuelos
56
+ def generate_url_landing_home()
57
+ landing = case @site
58
+ when "BR" then "/passagens-aereas"
59
+ when "US" then "/flights"
60
+ when "CN" then "/flights"
61
+ when "IN" then "/flights"
62
+ when "PT" then "/passagens-aereas"
63
+ else "/vuelos"
64
+ end
65
+ return @host + landing
66
+ end
67
+
68
+ #genero la url del servicio de resultados
69
+ def generate_url_results_search_service(type="TOTALFARE")
70
+ return @host + "/shop/flights/data/search/multipleoneway/" + @path + "/#{type}/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{des()}"
71
+ end
72
+
73
+ #genero la url del servicio de resultados
74
+ def generate_url_results_search_service_streaming(type="TOTALFARE")
75
+ return @host + "/shop/flights/data/search/multipleoneway/" + @path + "/#{type}/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{digest_md5()}&streaming=true"
76
+ end
77
+
78
+ #genero la url del paginado
79
+ def generate_url_results_search_paginate_service(page,hash)
80
+ return "#{@host}/shop/flights/data/refine/#{@description.upcase}/#{@city_from_1.code}/#{@city_to_1.code}/#{@cabotage ? 'DOMESTIC' : 'INTERNATIONAL'}/NA/#{hash}/1/PRECLUSTER/FARE/ASCENDING/#{page}/NA/NA/BRL/BRL/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA"
81
+ end
82
+
83
+ def get_ticket_date()
84
+ super()
85
+ @result_hash['itinerary_hash'] = @itinerary['itinerariesBox']['matchingInfoMap']['_0_0']['itineraryId']
86
+ end
87
+
88
+ def get_advanced_bussinnes()
89
+ return "/NA/NA/C/NA/NA"
90
+ end
91
+
92
+ def get_indec_airlines(env)
93
+ servers = {
94
+ "rc"=>"http://lb.despegar.it/",
95
+ "beta"=>"http://backoffice.despegar.com/",
96
+ "produccion"=>"http://backoffice.despegar.com/"
97
+ }
98
+ respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
99
+ return respond
100
+ end
101
+
102
+ def get_to_city_description()
103
+ return @city_to_1.name.no_accents
104
+ end
105
+
106
+ def add_day_to_search()
107
+ @date_from_1 = @date_from_1 + 1
108
+ @date_to_1 = @date_to_1 + 1
109
+ @path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
110
+ end
111
+
112
+ def set_new_date(date_from,date_to)
113
+ @date_from_1 = date_from
114
+ @date_to_1 = date_to
115
+ @path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
116
+ end
117
+
118
+ def set_from_date(date_from)
119
+ @date_from_1 = date_from
120
+ @path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
121
+ end
122
+
123
+ end
data/lib/mock_search.rb CHANGED
@@ -156,4 +156,5 @@ end
156
156
 
157
157
  require_relative 'mock_search/mock_search_oneway'
158
158
  require_relative 'mock_search/mock_search_multipledestinations'
159
- require_relative 'mock_search/mock_search_roundtrip'
159
+ require_relative 'mock_search/mock_search_roundtrip'
160
+ require_relative 'mock_search/mock_search_multipleoneway'
data/mock_search.gemspec CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  gem.require_paths = ["lib"] #Usualmente es solo lib -> ["lib"]
17
17
 
18
- gem.version = '1.1.5' #La version se debe incrementar cada vez que se desea publicar una nueva version del test.
18
+ gem.version = '1.1.6' #La version se debe incrementar cada vez que se desea publicar una nueva version del test.
19
19
 
20
20
  gem.add_dependency('httparty')
21
21
  gem.add_dependency('ruby-des')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - lgonzalez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -63,6 +63,7 @@ files:
63
63
  - lib/mock_city.rb
64
64
  - lib/mock_search.rb
65
65
  - lib/mock_search/mock_search_multipledestinations.rb
66
+ - lib/mock_search/mock_search_multipleoneway.rb
66
67
  - lib/mock_search/mock_search_oneway.rb
67
68
  - lib/mock_search/mock_search_roundtrip.rb
68
69
  - mock_search.gemspec