module ThreeScale::Core::APIClient::Operations

Attributes

persisted[RW]

Public Class Methods

included(base) click to toggle source
# File lib/3scale/core/api_client/operations.rb, line 5
def self.included(base)
  base.extend ClassMethods
  base.prepend Initializer
end

Private Instance Methods

api_delete(api_options = {}) click to toggle source
# File lib/3scale/core/api_client/operations.rb, line 30
def api_delete(api_options = {})
  ok = self.class.api_delete attributes, api_options
  self.persisted = false if ok
  ok
end
api_save(api_options = {}) click to toggle source
# File lib/3scale/core/api_client/operations.rb, line 14
def api_save(api_options = {})
  if persisted
    ret = self.class.api_do_put attributes, api_options
  else
    ret = self.class.api_do_post attributes, api_options
    self.persisted = ret[:ok]
  end
  if ret[:ok]
    update_attributes(ret[:attributes])
    self.dirty = false
    true
  else
    false
  end
end