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: 8c8a215a611d26d0679b420ba54fd5a9dda53e79
4
- data.tar.gz: 9439ac588ce891c63ac9b5fef40695c87a72373e
3
+ metadata.gz: d6021f41105230d85ed5e17932d8951f3df5e5a5
4
+ data.tar.gz: 31be58792c67aa36142c723efe05322530676a04
5
5
  SHA512:
6
- metadata.gz: 593c8f18db945eb5ab5ad5414401fafdae98de6a895a23649eb0dbaf08fa94aa8b2f39a1ea09a387e24913a572d5edbdeda3b44f14d5c5caee220601ab42bbee
7
- data.tar.gz: 8d7cf8efa18344713011544ce3726141a3a5fb564ba4558dcf8bcab3ca38f14378e91235d2d4f4a54745723adef2b871e8257a9c7cd3d437897ed21dfe7387d4
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 = wired.fetch_rooms(lcode)
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 = request_room_data(wired, config['lcode'], @options[:room_ident], today, last_day)
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|
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Locomotive
3
3
  module WuBook
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotive_wubook_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Eilers