household_people_and_contributions 0.0.7 → 0.0.8
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: 7b9671c3c6bcb0fd94db54cd9b0867332bc9239a
|
4
|
+
data.tar.gz: 351a66975be40f3dcdaa3c6155c72811f0832372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9644bc684cffa9c9fac35867d1a3b148ae2e68977ac267c52bc9bf15b657fcce896c5c1219c4e07f3ce1ea9be7f7fa00ee467ab08d8cbc25e38534bb357a87d2
|
7
|
+
data.tar.gz: 8c9896258beda5ee96f11012d529dabeb35ab0df277f1027e5228de375c6aae569248cddf7e8a7b54949b1bd0697f4c3305ab94cb8ad7d1b67e5fe13957bbc4d
|
@@ -43,6 +43,10 @@ module HouseholdPeopleAndContributions
|
|
43
43
|
ATTRIBUTED_SCHOLAR_RECORDS_PATH_FORMAT = "/v1/People/Search.json?id=%s&include=communications,attributes"
|
44
44
|
CONTRIBUTION_RECORDS_PATH_TEMPLATE = "/giving/v1/contributionreceipts/search.json?householdID=%s&startReceivedDate=%s&endReceivedDate=%s"
|
45
45
|
|
46
|
+
def initialize(cache=true)
|
47
|
+
@cache = cache
|
48
|
+
end
|
49
|
+
|
46
50
|
def key
|
47
51
|
unless @key
|
48
52
|
@key =
|
@@ -158,11 +162,13 @@ module HouseholdPeopleAndContributions
|
|
158
162
|
cache_file = options[:prefix] + "_" + cache_file
|
159
163
|
end
|
160
164
|
cache_file = CACHE_DIR + "/" + cache_file
|
161
|
-
if File.exists?(cache_file)
|
165
|
+
if @cache && File.exists?(cache_file)
|
162
166
|
results_array = JSON.parse(File.read(cache_file))
|
163
167
|
else
|
164
168
|
results_array = get(records_path, options[:key])
|
165
|
-
|
169
|
+
if @cache
|
170
|
+
File.write(cache_file, results_array.to_json)
|
171
|
+
end
|
166
172
|
end
|
167
173
|
return results_array
|
168
174
|
end
|