cached_resource 5.1.2 → 5.1.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
  SHA256:
3
- metadata.gz: 9fc8b21898febeea0df40b81f91f17d8ac7243024b600f9e6b9263da77157572
4
- data.tar.gz: 3cec5573bcb480d2fee60403aec06aef1c6dc588ad4feeafd4cd16d60bbe6f79
3
+ metadata.gz: 769d5356d807aba4f41cc6be8c2d256921d028b1f205350f0e77024a4db15829
4
+ data.tar.gz: 89d9d4bb95b3f325265124bc2d6dd877f68ce0fe6eabe5af2eb9d85327c03ca8
5
5
  SHA512:
6
- metadata.gz: 5f2c6fc515e5365230aaa49a12200e8e57e41f4468812cf96847b16e827e0aedd6354428d282591c85ce18ff104038b7d561d7080bb6bb973f7161da871ecf41
7
- data.tar.gz: 9fb5a752cd1084d88707478fb62957a3ee78bd8cc561d809e502e908c8dbcf3d627d0d20fb02c45ad9c1d7b52fa3756b8d5677535def16a96e5d07b0fb889205
6
+ metadata.gz: 6f2574db0f3bd31b1204a361c0c24c9494860947a63e9de90e5dc02762e2d78a034e6e68b380e763af574b2a5d0fc64c3107dbb86644de85fdfe0f8b16ff257c
7
+ data.tar.gz: 06c1087d5b036408ef7729e728ad27f8ae59dc2ec954a388fbbe455dc399fcc06b6d69a0bfa9f949c4e86761241a9a15a63d8956c18a1a3d696c4d9669a660d1
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  sudo: false
3
+ before_install:
4
+ - gem install bundler:1.17.3
3
5
  cache: bundler
4
6
 
5
7
  rvm:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cached_resource (5.1.1)
4
+ cached_resource (5.1.3)
5
5
  activeresource (>= 4.0)
6
6
  activesupport (>= 4.0)
7
7
  nilio (>= 1.0)
@@ -93,7 +93,7 @@ GEM
93
93
  rails-deprecated_sanitizer (>= 1.0.1)
94
94
  rails-html-sanitizer (1.0.3)
95
95
  loofah (~> 2.0)
96
- rails-observers (0.1.4)
96
+ rails-observers (0.1.5)
97
97
  activemodel (>= 4.0)
98
98
  railties (4.2.9)
99
99
  actionpack (= 4.2.9)
@@ -137,4 +137,4 @@ DEPENDENCIES
137
137
  rspec
138
138
 
139
139
  BUNDLED WITH
140
- 1.17.1
140
+ 1.17.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cached_resource (5.1.1)
4
+ cached_resource (5.1.3)
5
5
  activeresource (>= 4.0)
6
6
  activesupport (>= 4.0)
7
7
  nilio (>= 1.0)
@@ -37,19 +37,18 @@ GEM
37
37
  globalid (>= 0.3.6)
38
38
  activemodel (5.0.2)
39
39
  activesupport (= 5.0.2)
40
- activemodel-serializers-xml (1.0.1)
40
+ activemodel-serializers-xml (1.0.2)
41
41
  activemodel (> 5.x)
42
- activerecord (> 5.x)
43
42
  activesupport (> 5.x)
44
43
  builder (~> 3.1)
45
44
  activerecord (5.0.2)
46
45
  activemodel (= 5.0.2)
47
46
  activesupport (= 5.0.2)
48
47
  arel (~> 7.0)
49
- activeresource (5.0.0)
50
- activemodel (>= 5.0, < 6)
48
+ activeresource (5.1.1)
49
+ activemodel (>= 5.0, < 7)
51
50
  activemodel-serializers-xml (~> 1.0)
52
- activesupport (>= 5.0, < 6)
51
+ activesupport (>= 5.0, < 7)
53
52
  activesupport (5.0.2)
54
53
  concurrent-ruby (~> 1.0, >= 1.0.2)
55
54
  i18n (~> 0.7)
@@ -147,4 +146,4 @@ DEPENDENCIES
147
146
  rspec
148
147
 
149
148
  BUNDLED WITH
150
- 1.17.1
149
+ 1.17.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cached_resource (5.1.1)
4
+ cached_resource (5.1.3)
5
5
  activeresource (>= 4.0)
6
6
  activesupport (>= 4.0)
7
7
  nilio (>= 1.0)
@@ -37,19 +37,18 @@ GEM
37
37
  globalid (>= 0.3.6)
38
38
  activemodel (5.1.2)
39
39
  activesupport (= 5.1.2)
40
- activemodel-serializers-xml (1.0.1)
40
+ activemodel-serializers-xml (1.0.2)
41
41
  activemodel (> 5.x)
42
- activerecord (> 5.x)
43
42
  activesupport (> 5.x)
44
43
  builder (~> 3.1)
45
44
  activerecord (5.1.2)
46
45
  activemodel (= 5.1.2)
47
46
  activesupport (= 5.1.2)
48
47
  arel (~> 8.0)
49
- activeresource (5.0.0)
50
- activemodel (>= 5.0, < 6)
48
+ activeresource (5.1.1)
49
+ activemodel (>= 5.0, < 7)
51
50
  activemodel-serializers-xml (~> 1.0)
52
- activesupport (>= 5.0, < 6)
51
+ activesupport (>= 5.0, < 7)
53
52
  activesupport (5.1.2)
54
53
  concurrent-ruby (~> 1.0, >= 1.0.2)
55
54
  i18n (~> 0.7)
@@ -147,4 +146,4 @@ DEPENDENCIES
147
146
  rspec
148
147
 
149
148
  BUNDLED WITH
150
- 1.17.1
149
+ 1.17.3
@@ -86,8 +86,7 @@ module CachedResource
86
86
  def cache_read(key)
87
87
  object = cached_resource.cache.read(key).try do |json_cache|
88
88
 
89
- # In older version JSON can't deserialize 'null' to nil
90
- json = json_cache == 'null' ? nil : JSON.parse(json_cache, :symbolize_names => true)
89
+ json = ActiveSupport::JSON.decode(json_cache)
91
90
 
92
91
  unless json.nil?
93
92
  cache = json_to_object(json)
@@ -134,9 +133,9 @@ module CachedResource
134
133
  def json_to_object(json)
135
134
  if json.is_a? Array
136
135
  json.map { |attrs|
137
- self.new(attrs[:object], attrs[:persistence]) }
136
+ self.new(attrs["object"], attrs["persistence"]) }
138
137
  else
139
- self.new(json[:object], json[:persistence])
138
+ self.new(json["object"], json["persistence"])
140
139
  end
141
140
  end
142
141
 
@@ -1,3 +1,3 @@
1
1
  module CachedResource
2
- VERSION = "5.1.2"
2
+ VERSION = "5.1.3"
3
3
  end
@@ -19,10 +19,12 @@ describe CachedResource do
19
19
  @thing3 = {:thing => {:id => 3, :name => "Stu"}}
20
20
  @string_thing = {:thing => {:id => "fded", :name => "Lev"}}
21
21
  @other_string_thing = {:thing => {:id => "fded", :name => "Lon"}}
22
+ @date_thing = {:thing => {:id => 4, :created_at => Time.utc(2020).iso8601}}
22
23
  @thing_json = @thing.to_json
23
24
  @other_thing_json = @other_thing.to_json
24
25
  @string_thing_json = @string_thing.to_json
25
26
  @other_string_thing_json = @other_string_thing.to_json
27
+ @date_thing_json = @date_thing.to_json
26
28
  @nil_thing = nil.to_json
27
29
  end
28
30
 
@@ -44,6 +46,7 @@ describe CachedResource do
44
46
  mock.get "/things/1.json?foo=bar", {}, @thing_json
45
47
  mock.get "/things/fded.json", {}, @string_thing_json
46
48
  mock.get "/things.json?name=42", {}, @nil_thing, 404
49
+ mock.get "/things/4.json", {}, @date_thing_json
47
50
  end
48
51
  end
49
52
 
@@ -166,6 +169,19 @@ describe CachedResource do
166
169
  result1.should_not be_frozen
167
170
  end
168
171
 
172
+ describe "when ActiveSupport.parse_json_times is enabled" do
173
+ before(:all) do
174
+ Time.zone = 'UTC'
175
+ ActiveSupport.parse_json_times = true
176
+ end
177
+
178
+ it "should convert date times to objects when reading from cache" do
179
+ Thing.find(4)
180
+
181
+ read_from_cache("thing/4").created_at.should == @date_thing[:thing][:created_at]
182
+ end
183
+ end
184
+
169
185
  shared_examples "collection_return_type" do
170
186
  if ActiveResource::VERSION::MAJOR >= 4
171
187
  it "should return an ActiveResource::Collection" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cached_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.2
4
+ version: 5.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morgan Brown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -143,13 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.7.6
146
+ rubygems_version: 3.0.8
148
147
  signing_key:
149
148
  specification_version: 4
150
149
  summary: Caching for ActiveResource
151
- test_files:
152
- - spec/cached_resource/cached_resource_spec.rb
153
- - spec/cached_resource/caching_spec.rb
154
- - spec/cached_resource/configuration_spec.rb
155
- - spec/spec_helper.rb
150
+ test_files: []