api-resource 0.7.0 → 0.7.1
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 +4 -4
- data/lib/api-resource/resource.rb +5 -20
- data/lib/api-resource/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 12920e4c95319de6f1ad5bc8319ba6782ef2d1bd
|
|
4
|
+
data.tar.gz: d1e236843cf77d8ceb0e10c513352070a0a7b434
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6570f8461faab3595bd5c7362ace4a92799da969c46bc5fe73d5e1936a7f93b0af26527d9fd0749a66aa57c6db22f08735235be2d559972e7deccdf85fbdde2c
|
|
7
|
+
data.tar.gz: f4e2bbc66ef4aaaf70ea71f00ce82cc79995a48d4e0f09fe78799accb4b10db60b164c21c4ec8722ac76836ce7717bd2054a809f8e24c4895cbf29146e68966f
|
|
@@ -53,11 +53,11 @@ module ApiResource
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def resource_path
|
|
56
|
-
self.class.resource_path
|
|
56
|
+
@resource_path ||= self.class.resource_path
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def resource_path=(path)
|
|
60
|
-
|
|
60
|
+
@resource_path = path
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def self.find(id, params={})
|
|
@@ -115,7 +115,7 @@ module ApiResource
|
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def attributes
|
|
118
|
-
instance_values.with_indifferent_access.except(:errors, :validation_context)
|
|
118
|
+
instance_values.with_indifferent_access.except(:errors, :validation_context, :resource_path)
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
protected
|
|
@@ -174,23 +174,8 @@ module ApiResource
|
|
|
174
174
|
def method_missing(m, *args, &_)
|
|
175
175
|
case m
|
|
176
176
|
when /^by_(.+)/
|
|
177
|
-
resource_path = self.class.build_url($1.pluralize, args[0],
|
|
178
|
-
|
|
179
|
-
def initialize(proxied, resource_path)
|
|
180
|
-
@proxied = proxied
|
|
181
|
-
@resource_path = resource_path
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
def method_missing(m, *args, &block)
|
|
185
|
-
begin
|
|
186
|
-
old_resource_path = @proxied.resource_path
|
|
187
|
-
@proxied.resource_path = @resource_path
|
|
188
|
-
@proxied.public_send(m, *args, &block)
|
|
189
|
-
ensure
|
|
190
|
-
@proxied.resource_path = old_resource_path
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end.new(self, resource_path)
|
|
177
|
+
self.resource_path = self.class.build_url($1.pluralize, args[0], resource_path)
|
|
178
|
+
self
|
|
194
179
|
else
|
|
195
180
|
super
|
|
196
181
|
end
|
data/lib/api-resource/version.rb
CHANGED