14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/results.rb', line 14
def get_journeys(options)
from = options[:from].gsub(" ", "+")
to = options[:to].gsub(" ", "+")
via = options[:via]
national_search = options[:national_search] || false
time = options[:time]
date = options[:date]
time_is = options[:time_is] || "Departing"
journey_preference = options[:journey_preference]
mode = options[:mode]
from_name = options[:from_name]
to_name = options[:to_name]
via_name = options[:via_name]
max_transfer_minutes = options[:max_transfer_minutes]
max_walking_minutes = options[:max_walking_minutes]
cycle_preference = options[:cycle_preference]
adjustment = options[:adjustment]
alternative_cycle = options[:alternative_cycle] || false
alternative_walking = options[:alternative_walking] || true
apply_html_markup = options[:apply_html_markup] || false
results = self.class.get(BASE_URI, query:
{app_key: app_key,
app_id: app_id,
from: from,
to: to,
via: via,
nationalSearch: national_search,
time: time,
date: date,
timeIs: time_is,
journeyPreference: journey_preference,
mode: mode,
fromName: from_name,
toName: to_name,
viaName: via_name,
maxTransferMinutes: max_transfer_minutes,
maxWalkingMinutes: max_walking_minutes,
cyclePreference: cycle_preference,
adjustment: adjustment,
alternativeCycle: alternative_cycle,
alternativeWalking: alternative_walking,
applyHtmlMarkup: apply_html_markup}).rubyify_keys!
results["$type"].include?("DisambiguationResult") ? (disambiguate results) : (process_journeys_from results)
end
|