api_call_cache 0.0.4 → 0.0.5

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: 29f03dad2301785c0c7d277e127c00107c4212a7
4
- data.tar.gz: ea8e14e3a1375cad7d03b90a21e5a01e6c6b1ad9
3
+ metadata.gz: dea7af9c41e304ea93eb2fbad4899388a457d4fc
4
+ data.tar.gz: 9e13f31444aac78dcd5ec66ae3d68a87923da4fc
5
5
  SHA512:
6
- metadata.gz: 90955d4ee9a31770a6d2c459b899a03241489d801d7959b3451e31f5d1ace1cd8553cf6c36e99ee8bd0cc60095714c400ea651204decd316b0b27fe05102e9a8
7
- data.tar.gz: 11458e7732dfbba9f7cd27156ac0657615e5e03eb3089261a220f6ac9953eec8c6210f1c42b45ac7f20a86f43367ea274ec69412060e05519f6601a293053925
6
+ metadata.gz: 2c168764dca83e88f4c2b5159e249675b01f161fd1db38b576e4b739b0c4a99b8cdf2e48a71307249ea4dfc15f6821670c208281c01fd75c4533b7b43a84a925
7
+ data.tar.gz: 740395b0ad19268f8c3cecd24bd4b485e8dd669417e3f537c5aabbcbc0ba6a13a8dc7de2bf8f537faac029f83689f090a7b7e41a90964d765018b2e8fee77545
@@ -9,6 +9,8 @@ require 'api_call_cache/version'
9
9
 
10
10
  class ApiCallCache
11
11
 
12
+ DEFAULT_ACCESS_TOKEN = 'DAT'
13
+
12
14
  def self.configure
13
15
  yield self
14
16
  end
@@ -20,7 +22,7 @@ class ApiCallCache
20
22
  end
21
23
 
22
24
  def self.logger_path(log_file = 'log/api_call_cache.log', rotation = 'monthly')
23
- @@acc_logger = Logger.new(log_file, rotation)
25
+ @@acc_logger = Logger.new(log_file, rotation)
24
26
  end
25
27
 
26
28
  def self.base_urls(base_urls_hash)
@@ -35,9 +37,10 @@ class ApiCallCache
35
37
  def self.req_defaults
36
38
  @req_opt_defaults ||= {
37
39
  base_url_key: '',
38
- access_token: '', # TODO_FIX -- will need NetHttp etc
40
+ access_token: DEFAULT_ACCESS_TOKEN,
39
41
  from_cache: true,
40
42
  override_cache_expiry: nil, # seconds. Overrides Cache-Control max-age value
43
+ append_dot_json: true,
41
44
  override_params_cache_key: nil, # If provided, this value will be used
42
45
  # as the 'params' part of the cache key,
43
46
  # instead of manually 'hashed_params'
@@ -128,7 +131,7 @@ class ApiCallCache
128
131
 
129
132
  if cache_miss
130
133
 
131
- rel_url = gen_api_call_rel_url(rel_path, req_params)
134
+ rel_url = gen_api_call_rel_url(rel_path, req_params, req_opts[:append_dot_json])
132
135
 
133
136
  acc_log_entry[:params_f] = req_params.to_s
134
137
 
@@ -194,8 +197,8 @@ class ApiCallCache
194
197
  ok?: false)
195
198
  end
196
199
 
197
- def gen_api_call_rel_url(rel_path, req_params)
198
- rel_path += '.json'
200
+ def gen_api_call_rel_url(rel_path, req_params, app_dot_json)
201
+ rel_path += '.json' if app_dot_json
199
202
  req_params.empty? ? rel_path : [rel_path, req_params.to_query].join('?')
200
203
  end
201
204
 
@@ -1,3 +1,3 @@
1
1
  class ApiCallCache
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_call_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akshay Rao
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-08-20 00:00:00.000000000 Z
12
+ date: 2018-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler