Module: Oshpark::RemoteModel
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/oshpark/remote_model.rb', line 6 def self.included base base.extend ClassMethods end |
Instance Method Details
#destroy! ⇒ Object
24 25 26 27 |
# File 'lib/oshpark/remote_model.rb', line 24 def destroy! Oshpark::client.public_send("destroy_#{object_name}", id) nil end |
#reload! ⇒ Object
19 20 21 22 |
# File 'lib/oshpark/remote_model.rb', line 19 def reload! json = Oshpark::client.public_send(object_name, id) reload_with json end |
#save! ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/oshpark/remote_model.rb', line 10 def save! attrs = {} @dirty_attributes.map do |attr| attrs[attr] = public_send(attr) end Oshpark::client.public_send("update_#{object_name}", id, attrs) end |