dmtd_vbmapp_data 1.0.3 → 1.0.4

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: 93d6ded3058b25dcdddf63fdf9772d4ae2b39225
4
- data.tar.gz: 92a1f20afb9d0a0420287a1c6d227e86a592b450
3
+ metadata.gz: 7ff92a3ffefd26edba360ec5d1124fe9ad42509d
4
+ data.tar.gz: b282d4a1a768fc22f3425335c07c8b36b5758f6e
5
5
  SHA512:
6
- metadata.gz: 1fdc047a929060b5fcf19b6b5e6d09738eba0ecdfae67ccc2e4eae217dfefafd224a27e2e937852265ffdd94c9f4cc8c7726516fe88937c83fe3f5032b809832
7
- data.tar.gz: c100ae97c161b3f3ccb8a640eabcdbffc3487249e9b053eacf8568cc80edb7d0d8cd3c929f48e53ae209e2a63b05ee0ddd92f01a41db5004cbd021417d0a7dcc
6
+ metadata.gz: f0b1b76b66fff0f900e4aeecd7123133575a68805c5ac91eb9feef7ef9d2eb6d4a530516b641ff2a0b66824e79237dd89e4fe2e79ac0b4a81e9853aacdd67295
7
+ data.tar.gz: 3a4e745d5dac38f95c578924d1a772b176cd8b476c62701bdc19010c23f4f02ada40b11575001f40bcf97893c1b4b3ed22a6d4f94760bac124f9ba6262c9145a
data/CHANGELOG.md CHANGED
@@ -8,4 +8,12 @@
8
8
 
9
9
  ## 1.0.2
10
10
 
11
- * Added an AssessmentReport class that simplifies the functionality of generating an IEP report
11
+ * Added an AssessmentReport class that simplifies the functionality of generating an IEP report
12
+
13
+ ## 1.0.3
14
+
15
+ * Added language support
16
+
17
+ ## 1.0.4
18
+
19
+ * Implemented the Guide's caching support
@@ -19,20 +19,28 @@ module DmtdVbmappData
19
19
 
20
20
  # Populates the internal VB-MAPP guide index
21
21
  #
22
- # This index is cached locally and expires once a day.
22
+ # This index is cached locally and expires once a day at midnight UTC.
23
23
  #
24
24
  # The first call to this method with an expired cache will
25
25
  # block until the cache is populated. All subsequent calls
26
26
  # will load from the cache.
27
27
  #
28
+ # NOTE: The cache is an in-memory cache (not on-disc). Thus, if the process is restarted,
29
+ # the cache will be dropped.
30
+ #
28
31
  # Returns:
29
32
  # Array as defined as the result of the 1/guide/index REST api
30
33
  def index
31
- if @guide_index.nil?
32
- @guide_index = retrieve_guide_index
34
+
35
+ expire_cache
36
+ if defined?(@@guide_cache).nil?
37
+ @@guide_cache = {
38
+ datestamp: DateTime.now.new_offset(0).to_date,
39
+ guide_index: retrieve_guide_index
40
+ }
33
41
  end
34
42
 
35
- @guide_index
43
+ @@guide_cache[:guide_index]
36
44
  end
37
45
 
38
46
  # Returns the VB-MAPP Guide chapters
@@ -49,6 +57,15 @@ module DmtdVbmappData
49
57
 
50
58
  private
51
59
 
60
+ def expire_cache
61
+ if defined?(@@guide_cache)
62
+ today = DateTime.now.new_offset(0).to_date
63
+ cache_day = @@guide_cache[:datestamp]
64
+
65
+ @@guide_cache = nil unless cache_day == today
66
+ end
67
+ end
68
+
52
69
  def self.end_point
53
70
  '1/guide/index'
54
71
  end
@@ -1,3 +1,3 @@
1
1
  module DmtdVbmappData
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmtd_vbmapp_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hunt