Class: Transilien::Time

Inherits:
FakeMicroService show all
Defined in:
lib/transilien/time.rb

Constant Summary

Constants inherited from MicroService

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

Instance Attribute Summary collapse

Attributes inherited from MicroService

#access_time, #external_code, #payload

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FakeMicroService

http

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, http, params, #to_s

Instance Attribute Details

#dayObject

Returns the value of attribute day.



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

def day
  @day
end

#hourObject

Returns the value of attribute hour.



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

def hour
  @hour
end

#minuteObject

Returns the value of attribute minute.



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

def minute
  @minute
end

#total_secondsObject

Returns the value of attribute total_seconds.



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

def total_seconds
  @total_seconds
end

Class Method Details

.from_node(node, access_time) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/transilien/time.rb', line 5

def from_node(node, access_time)
  item = new
  item.payload = node

  item.total_seconds = node.at('TotalSeconds').text
  item.day = node.at('Day').text
  item.hour = node.at('Hour').text
  item.minute = node.at('Minute').text
  item
end

Instance Method Details

#nameObject

objective: enable caching



17
18
19
# File 'lib/transilien/time.rb', line 17

def name # objective: enable caching
  "#{day}:#{hour}:#{minutes}|#{total_seconds}"
end