Module: RemoteResource::Querying::PersistenceMethods::ClassMethods
- Defined in:
- lib/remote_resource/querying/persistence_methods.rb
Instance Method Summary collapse
- #create(attributes = {}, connection_options = {}) ⇒ Object
- #destroy(id, connection_options = {}) ⇒ Object
Instance Method Details
#create(attributes = {}, connection_options = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/remote_resource/querying/persistence_methods.rb', line 8 def create(attributes = {}, = {}) resource = new(attributes) response = RemoteResource::Request.new(self, :post, attributes, ).perform resource.handle_response(response) end |
#destroy(id, connection_options = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/remote_resource/querying/persistence_methods.rb', line 14 def destroy(id, = {}) resource = new(id: id) response = RemoteResource::Request.new(self, :delete, {}, .merge(id: id)).perform resource.handle_response(response) resource.destroyed = resource.success? resource end |