lib/zendesk_api/actions.rb
def save!(options = {})
      return false if respond_to?(:destroyed?) && destroyed?

      if new_record? && !options[:force_update]
        method = :post
        req_path = path
      else
        method = :put
        req_path = url || path
      end

      req_path = options[:path] if options[:path]

      save_associations

      @response = @client.connection.send(method, req_path) do |req|
        req.body = attributes_for_save.merge(@global_params)

        yield req if block_given?
      end

      handle_response(@response)

      @attributes.clear_changes
      clear_associations
      true
    end
def save!(options = {})
      return false if respond_to?(:destroyed?) && destroyed?

      if new_record? && !options[:force_update]
        method = :post
        req_path = path
      else
        method = :put
        req_path = url || path
      end

      req_path = options[:path] if options[:path]

      save_associations

      @response = @client.connection.send(method, req_path) do |req|
        req.body = attributes_for_save.merge(@global_params)

        yield req if block_given?
      end

      handle_response(@response)

      @attributes.clear_changes
      clear_associations
      true
    end
def save! ( options = { } ) return false if respond_to? ( :destroyed? ) && destroyed? if new_record? && ! options [ :force_update ] method = :post req_path = path else method = :put req_path = url || path end req_path = options [ :path ] if options [ :path ] save_associations @response = @client . connection . send ( method , req_path ) do | req | req . body = attributes_for_save . merge ( @global_params ) yield req if block_given? end handle_response ( @response ) @attributes . clear_changes clear_associations true end
If this resource hasn't been deleted, then create or save it.
 Executes a POST if it is a {Data#new_record?}, otherwise a PUT.
 Merges returned attributes on success.
 @return [Boolean] Success?
If this resource hasn t been deleted then create or save it . Executes a POST if it is a { Data#new_record? } otherwise a PUT . Merges returned attributes on success .