Class: MockSearch
- Inherits:
-
Object
- Object
- MockSearch
- Defined in:
- lib/mock_search.rb
Direct Known Subclasses
MockSearchMultipledestinations, MockSearchOneway, MockSearchRoundtrip
Instance Attribute Summary collapse
-
#adt ⇒ Object
readonly
Returns the value of attribute adt.
-
#cabotage ⇒ Object
readonly
Returns the value of attribute cabotage.
-
#cnn ⇒ Object
readonly
Returns the value of attribute cnn.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#inf ⇒ Object
readonly
Returns the value of attribute inf.
Instance Method Summary collapse
- #generar_host(site, env) ⇒ Object
- #generate_post_alert_url ⇒ Object
- #get_childrens ⇒ Object
-
#initialize(site, env, cabotage) ⇒ MockSearch
constructor
A new instance of MockSearch.
- #passengers ⇒ Object
- #set_from_city(code) ⇒ Object
- #set_to_city(code) ⇒ Object
- #to_city_change(site) ⇒ Object
Constructor Details
#initialize(site, env, cabotage) ⇒ MockSearch
Returns a new instance of MockSearch.
7 8 9 10 11 |
# File 'lib/mock_search.rb', line 7 def initialize(site,env,cabotage) @site = site @host = generar_host(site,env) @cabotage = (cabotage=='true') end |
Instance Attribute Details
#adt ⇒ Object (readonly)
Returns the value of attribute adt.
5 6 7 |
# File 'lib/mock_search.rb', line 5 def adt @adt end |
#cabotage ⇒ Object (readonly)
Returns the value of attribute cabotage.
5 6 7 |
# File 'lib/mock_search.rb', line 5 def cabotage @cabotage end |
#cnn ⇒ Object (readonly)
Returns the value of attribute cnn.
5 6 7 |
# File 'lib/mock_search.rb', line 5 def cnn @cnn end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/mock_search.rb', line 5 def host @host end |
#inf ⇒ Object (readonly)
Returns the value of attribute inf.
5 6 7 |
# File 'lib/mock_search.rb', line 5 def inf @inf end |
Instance Method Details
#generar_host(site, env) ⇒ Object
13 14 15 16 |
# File 'lib/mock_search.rb', line 13 def generar_host(site,env) host = YAML.load(File.open("host.yml")) return host[site][env] end |
#generate_post_alert_url ⇒ Object
32 33 34 |
# File 'lib/mock_search.rb', line 32 def generate_post_alert_url() return @host + "/subscriptions-ui/subscriptions/price-alert-by-month/add" end |
#get_childrens ⇒ Object
36 37 38 |
# File 'lib/mock_search.rb', line 36 def get_childrens @cnn + @inf end |
#passengers ⇒ Object
18 19 20 21 22 23 |
# File 'lib/mock_search.rb', line 18 def passengers() @adt = [1,2,3][rand(3)] @cnn = [0,1,2][rand(@adt)] @inf = [0,1,2][rand(@adt-@cnn)] return "#{@adt}/#{@cnn}/#{@inf}" end |
#set_from_city(code) ⇒ Object
40 41 42 |
# File 'lib/mock_search.rb', line 40 def set_from_city(code) @city_from_1 = MockCity.new(@site,code) end |