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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b43230ab4592f487f3ced50d5148946ad42811c
4
- data.tar.gz: bf945dbe477665f5ae40e0e8a8d40416d14b7952
3
+ metadata.gz: 12920e4c95319de6f1ad5bc8319ba6782ef2d1bd
4
+ data.tar.gz: d1e236843cf77d8ceb0e10c513352070a0a7b434
5
5
  SHA512:
6
- metadata.gz: d78d747c15f45145f9f4cc89b5816f4973a1cba477b08ad5479af57c4fdfb10ae4f7f4a9df0da23bcb4156d90a2ac9faca3c85372de58df6f0fff74798a8d46e
7
- data.tar.gz: 201e9c121ab99db3182c3f76941e5c8689c9153b69a3c69d63c1fa0745fc7702bf2cdf137a397672447ded96b76cee3215b0f4eeb839b10a9eba8c3149c907a3
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
- self.class.resource_path = path
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], self.resource_path)
178
- Class.new do
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
@@ -1,3 +1,3 @@
1
1
  module ApiResource
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chaker Nakhli