Method: HaveAPI::Client::ResourceInstance#save
- Defined in:
- lib/haveapi/client/resource_instance.rb
#save ⇒ Object
Invoke create
action if the object is not persistent, update
action if it is.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/haveapi/client/resource_instance.rb', line 49 def save if @persistent method(:update).call else @action.provide_args @response = Response.new(@action, @action.execute(attributes_for_api(@action))) if @response.ok? @params = @response.response define_attributes else return nil end @persistent = true self end end |