lib/api_client/resource/base.rb in api_client-0.3.0 vs lib/api_client/resource/base.rb in api_client-0.3.1
- old
+ new
@@ -37,25 +37,28 @@
def save
self.persisted? ? remote_update : remote_create
end
def destroy
- self.class.destroy(self.id)
+ get_scope.destroy(self.id)
end
def payload
hash = self.to_hash
hash.delete('id') # This key is never required
hash
end
def remote_update
- scope = original_scope || self.class
- scope.update(self.id, payload)
+ get_scope.update(self.id, payload)
end
def remote_create
- self.class.create(payload)
+ get_scope.create(payload)
+ end
+
+ def get_scope
+ original_scope || self.class
end
end
end