locomotive_wubook_plugin 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6021f41105230d85ed5e17932d8951f3df5e5a5
|
4
|
+
data.tar.gz: 31be58792c67aa36142c723efe05322530676a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c674fbd84ab663150d64d593c5128b3d0b897e074335ce2c6229c9ec0d4c50033b998f3ea1e158333bd7055110efc22e2585e611bf0c35a5a0032d2447c7ab
|
7
|
+
data.tar.gz: 053251544cb139a78f5f02a3c56f3d1dd664ab5410062246c902892dea4cecbf8cc1e1d9febf617a51d9de6199247c4e493b857bdb4d5458992cbd20dae7cfc6
|
@@ -2,7 +2,11 @@ require 'wired'
|
|
2
2
|
|
3
3
|
module PluginHelper
|
4
4
|
def fetch_room_base_data(wired, lcode, room_id)
|
5
|
-
rooms =
|
5
|
+
rooms = Rails.cache.fetch(lcode + "/rooms", expires_in: 1.hours) do
|
6
|
+
::Locomotive.log "**> Cache fetch for key: #{lcode + "/rooms"}"
|
7
|
+
wired.fetch_rooms(lcode)
|
8
|
+
end
|
9
|
+
|
6
10
|
filtered_room = rooms.select { |room_hash| room_hash['shortname'] == room_id }
|
7
11
|
::Locomotive.log "**> Filtered rooms #{filtered_room} "
|
8
12
|
|
@@ -38,7 +38,10 @@ module Locomotive
|
|
38
38
|
base_room_data = fetch_room_base_data(wired, config['lcode'], @options[:room_ident])
|
39
39
|
base_price = base_room_data[0]["price"]
|
40
40
|
|
41
|
-
room_data =
|
41
|
+
room_data = Rails.cache.fetch(config['lcode'] + @options[:room_ident] + today.to_s + last_day.to_s + "/room_data", expires_in: 1.hours) do
|
42
|
+
::Locomotive.log "**> Cache fetch for key: #{config['lcode'] + @options[:room_ident] + today.to_s + last_day.to_s + "/room_data"}"
|
43
|
+
request_room_data(wired, config['lcode'], @options[:room_ident], today, last_day)
|
44
|
+
end
|
42
45
|
|
43
46
|
# Create one entry for each day from now to then.. put a 1 if the day is available or 0 if not.
|
44
47
|
(today .. last_day).each_with_index do |date, i|
|