active_cached_resource 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/active_cached_resource/version.rb +1 -1
- data/lib/activeresource/lib/active_resource/collection.rb +20 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7398b81424e7d34365729859220d5d05265452e4c7d8024f123b5a18f0490f0
|
4
|
+
data.tar.gz: 0c8b48b2cecec7992a5170b3467839cf7c4e9d13f141d552a9206f9eccc5527d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea69cc9271151a45decccb33a3e52275d05bd0dc0d4244472305e6b050479fb51431f42c13705f19a380bf0cfe1dba1e1242ff6480b4b23992fb850c25df32dd
|
7
|
+
data.tar.gz: '0807a7648e90ffd1e4a0c5650d52c15f67438a9a84366cf9a2563cd775ecd92a68f9fe0d816a8dac80f09f277623928b717a9f25f33fe1c484cb8617da367bc6'
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
## [0.1.
|
1
|
+
## [0.1.6] - 2024-01-15
|
2
|
+
- Renamed `ActiveResource::Collection#refresh` to `#reload` to match Rails ORM naming convention.
|
3
|
+
- Added a `ActiveResource::Collection.none` class method similar to Rails `ActiveRecord::QueryMethods.none`
|
4
|
+
- Enhanced `ActiveResource::Collection#where` so that it returns `ActiveResource::Collection.none` if `resource_class` is missing.
|
5
|
+
- This is useful for when `where` clauses are chained on an empty `ActiveResource::Collection`
|
6
|
+
|
7
|
+
## [0.1.5] - 2024-01-09
|
2
8
|
- Added callbacks to cache:
|
3
9
|
- Create/POST, refresh cache after successful POST request
|
4
10
|
- Update/PUT, refresh cache after successful PUT request
|
5
11
|
- Destroy/DELETE, invalidate cache after successful DELETE request
|
6
12
|
- Fixed issue with generator for SQLCache strategy tables
|
13
|
+
|
7
14
|
## [0.1.4] - 2024-12-20
|
8
15
|
- CI Improvements
|
9
16
|
- Added annotations
|
@@ -21,6 +21,23 @@ module ActiveResource # :nodoc:
|
|
21
21
|
attr_writer :prefix_options
|
22
22
|
attr_reader :from
|
23
23
|
|
24
|
+
# Returns a frozen empty collection.
|
25
|
+
#
|
26
|
+
# @return [ActiveResource::Collection] an empty collection
|
27
|
+
def self.none
|
28
|
+
new([]).tap do |collection|
|
29
|
+
collection.instance_variable_set(:@requested, true)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a new ActiveResource::Collection instance.
|
34
|
+
#
|
35
|
+
# ==== Arguments
|
36
|
+
#
|
37
|
+
# +elements+ (Array<Object>) - An optional array of resources to be set as the collection elements.
|
38
|
+
# Defaults to an empty array.
|
39
|
+
# +from+ (String, Symbol) - The path to the collection resource or the symbol for the collection resource.
|
40
|
+
|
24
41
|
# ActiveResource::Collection is a wrapper to handle parsing index responses that
|
25
42
|
# do not directly map to Rails conventions.
|
26
43
|
#
|
@@ -98,12 +115,12 @@ module ActiveResource # :nodoc:
|
|
98
115
|
@prefix_options || {}
|
99
116
|
end
|
100
117
|
|
101
|
-
#
|
118
|
+
# Reload the collection by re-fetching the resources from the API.
|
102
119
|
#
|
103
120
|
# ==== Returns
|
104
121
|
#
|
105
122
|
# [Array<Object>] The collection of resources retrieved from the API.
|
106
|
-
def
|
123
|
+
def reload
|
107
124
|
@requested = false
|
108
125
|
request_resources!
|
109
126
|
end
|
@@ -182,6 +199,7 @@ module ActiveResource # :nodoc:
|
|
182
199
|
# # => PostCollection:xxx (filtered collection)
|
183
200
|
def where(clauses = {})
|
184
201
|
raise ArgumentError, "expected a clauses Hash, got #{clauses.inspect}" unless clauses.is_a? Hash
|
202
|
+
return self.class.none if resource_class.nil?
|
185
203
|
new_clauses = query_params.merge(clauses)
|
186
204
|
resource_class.where(new_clauses)
|
187
205
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_cached_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Luis Urena
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-15 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activemodel-serializers-xml
|
@@ -71,6 +71,20 @@ dependencies:
|
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 1.7.5
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: ostruct
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.6.1
|
81
|
+
type: :runtime
|
82
|
+
prerelease: false
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.6.1
|
74
88
|
email:
|
75
89
|
- eljean@live.com
|
76
90
|
executables: []
|