Class: Transilien::VehicleJourney

Inherits:
MicroService show all
Defined in:
lib/transilien/vehicle_journey.rb

Constant Summary

Constants inherited from MicroService

MicroService::API_HOST, MicroService::API_URI, MicroService::Default_cache_duration

Instance Attribute Summary

Attributes inherited from MicroService

#access_time, #external_code, #name, #payload

Instance Method Summary collapse

Methods inherited from MicroService

action, action_component, action_instance_xpath, action_param, add_filters, cache_it, cache_keys, errors, filters, filters=, find, find_from_full_query_cache, find_from_query_caches, from_node, http, params, #to_s

Instance Method Details

#companyObject



8
9
10
# File 'lib/transilien/vehicle_journey.rb', line 8

def company
  @company ||= Transilien::Company.from_node(payload.at('Company'), access_time)
end

#modeObject



5
6
7
# File 'lib/transilien/vehicle_journey.rb', line 5

def mode
  @mode ||= Transilien::Mode.from_node(payload.at('Mode'), access_time)
end

#routeObject



2
3
4
# File 'lib/transilien/vehicle_journey.rb', line 2

def route
  @route ||= Transilien::Route.from_node(payload.at('Route'), access_time)
end

#stopsObject



18
19
20
21
22
23
24
25
# File 'lib/transilien/vehicle_journey.rb', line 18

def stops
  @stops ||= begin
    stops_nodes = payload.at('StopList')
    stops_nodes.children.map do |stop_node|
      Transilien::Stop.from_node(stop_node, access_time)
    end
  end
end

#validity_patternObject



14
15
16
# File 'lib/transilien/vehicle_journey.rb', line 14

def validity_pattern
  @validity_pattern ||= payload.at('ValidityPattern')
end

#vehicleObject



11
12
13
# File 'lib/transilien/vehicle_journey.rb', line 11

def vehicle
  @vehicle ||= payload.at('Vehicle')
end