Saves the specified resource attributes by sending either a POST or PUT
 request to JIRA, depending on resource.new_record?

 Accepts an attributes hash of the values to be saved. Will return false
 if the request fails.
769147
def save(attrs, path = url)
      begin
        save_status = save!(attrs, path)
      rescue JIRA::HTTPError => exception
        begin
          set_attrs_from_response(exception.response) # Merge error status generated by JIRA REST API
        rescue JSON::ParserError => parse_exception
          set_attrs('exception' => {
                      'class' => exception.response.class.name,
                      'code' => exception.response.code,
                      'message' => exception.response.message
                    })
        end
        # raise exception
        save_status = false
      end
      save_status
    end
886043
def save
      response = service.send(:"#{method_prefix}_update", self.attrs)

      if response.at_xpath('//status').attr('code') == 'ok'
        # Load the ID if this was a creation
        self.id = response.at_xpath("//#{ac_obj_node_name}").attr("#{ac_obj_type}-id") if self.id.nil?
        true
      else
        save_errors(response)
        false
      end
    end
166108
def _update_record(attribute_names = @attributes.keys)
        # check if class has custom update method
        if self.class.custom_update_method
          # run before/after callbacks defined in model
          run_callbacks(:update) do
            # timestamp
            if should_record_timestamps?
              current_time = current_time_from_proper_timezone

              timestamp_attributes_for_update_in_model.each do |column|
                column = column.to_s
                next if will_save_change_to_attribute?(column)
                write_attribute(column, current_time)
              end
            end
            # update just dirty attributes
            if partial_writes?
              # Serialized attributes should always be written in case they've been
              # changed in place.
              update_using_custom_method(changed | (attributes.keys & self.class.columns.select { |column| column.is_a?(Type::Serialized) }))
            else
              update_using_custom_method(attributes.keys)
            end
          end
        else
          super
        end
      end
433305
def create(record)
      result = self.class.post(worksheet_url,
        :body => { "fields" => record.fields }.to_json,
        :headers => { "Content-type" => "application/json" }).parsed_response

      check_and_raise_error(result)

      record.override_attributes!(result_attributes(result))
      record
    end
158218
def persist(conditions = nil)
      run_callbacks(:save) do
        self.hash_key = SecureRandom.uuid if hash_key.blank?

        # Add an exists check to prevent overwriting existing records with new ones
        if new_record?
          conditions ||= {}
          (conditions[:unless_exists] ||= []) << self.class.hash_key
        end

        # Add an optimistic locking check if the lock_version column exists
        if self.class.attributes[:lock_version]
          conditions ||= {}
          self.lock_version = (lock_version || 0) + 1
          # Uses the original lock_version value from ActiveModel::Dirty in case user changed lock_version manually
          (conditions[:if] ||= {})[:lock_version] = changes[:lock_version][0] if changes[:lock_version][0]
        end

        attributes_dumped = Dumping.dump_attributes(attributes, self.class.attributes)

        begin
          Dynamoid.adapter.write(self.class.table_name, attributes_dumped, conditions)
          @new_record = false
          true
        rescue Dynamoid::Errors::ConditionalCheckFailedException => e
          if new_record?
            raise Dynamoid::Errors::RecordNotUnique.new(e, self)
          else
            raise Dynamoid::Errors::StaleObjectError.new(self, 'persist')
          end
        end
      end
    end
257115
def create
      attributes_values = arel_attributes_values(!id.nil?)

      new_id = self.class.unscoped.insert attributes_values

      self.id ||= new_id if self.class.primary_key

      IdentityMap.add(self) if IdentityMap.enabled?
      @new_record = false
      id
    end
362630
def create(attributes_hash)
      #the tap method allows preconfigured methods and values to
      #be associated with the instance during instantiation while also automatically returning
      #the object after its creation is concluded.
      self.new.tap do |card|
        attributes_hash.each do |key, value|
          #sending the new instance the key name as a setter with the value
          card.send("#{key}=", value)
          #string interpolation is used as the method doesn't know the key name yet
          #but an = sign is implemented into the string in order to asssociate it as a setter
        end
        #saves the new instance into the database
        card.save
      end
    end
1022248
def save(self, **kwargs):
        
        # Guard against incorrect use of `serializer.save(commit=False)`
        assert 'commit' not in kwargs, (
            "'commit' is not a valid keyword argument to the 'save()' method. "
            "If you need to access data before committing to the database then "
            "inspect 'serializer.validated_data' instead. "
            "You can also pass additional keyword arguments to 'save()' if you "
            "need to set extra attributes on the saved model instance. "
            "For example: 'serializer.save(owner=request.user)'.'"
        )

        validated_data = [
            dict(list(attrs.items()) + list(kwargs.items()))
            for attrs in self.validated_data
        ]

        if self.instance is not None:
            self.instance = self.update(self.instance, validated_data)
            assert self.instance is not None, (
                '`update()` did not return an object instance.'
            )
        else:
            self.instance = self.create(validated_data)
            assert self.instance is not None, (
                '`create()` did not return an object instance.'
            )

        return self.instance
1228810
def create_record(attribute_names = @attributes.keys)
      record_timestamps_hardcoded
      attributes_values = self.changes.values.map(&:last)

      row_hash = Hash[ [ self.changes.keys, attributes_values ].transpose ]
      new_id =  SecureRandom.hex
      @rows =   {"rows"=> [{
                            "insertId"=> Time.now.to_i.to_s,
                            "json"=> row_hash.merge("id"=> new_id)
                          }]
                }
      conn_cfg = self.class.connection_config
      result = BigBroda::TableData.create(conn_cfg[:project],
        conn_cfg[:database],
        self.class.table_name ,
        @rows )

      #raise result["error"]["errors"].map{|o| "[#{o['domain']}]: #{o['reason']} #{o['message']}" }.join(", ") if result["error"].present?
      #here we output the IN MEMORY id , because of the BQ latency
      self.id = new_id #||= new_id if self.class.primary_key

      @new_record = false
      id
    end
163839
def save
      if loaded?
        self.class.update(@fields.format_for_update, jira_key)
      else
        response = self.class.create(@fields.format_for_create)
        self.jira_key = response.parsed_response["key"]
      end
      jira_key
    end
1134816
def update(attributes)
      load_attributes(
          Core::RestApi.instance.put(path, attributes, if_match_header))
    end
607282
def create
      upsert do
        # NOTE: create!() is not used because assign to @record to draw form.
        # Otherwise, @record would be in nil so failure at edgarj/_form rendering.
        #
        # NOTE2: valid? after create() calls validate_on_update.  This is not
        # an expected behavior.  So, new, valid?, then save.
        @record = model.new(permitted_params(:create))
        @record_saved = @record     # copy for possible later use
        on_upsert
       #upsert_files
        raise ActiveRecord::RecordNotSaved if !@record.valid?
        @record.save

        # clear @record values for next data-entry
        @record = model.new
      end
    end
951802
def put(self, resource):
        

        endpoint = self.endpoint

        if resource.id:
            endpoint = self._build_url(endpoint, resource.id)

        response = self.api.execute("PUT", endpoint, json=resource.as_dict())

        if not response.ok:
            raise Error.parse(response.json())

        return self._cls.parse(response.json())
437736
def _create_record
        # check if class has custom create method
        if self.class.custom_create_method
          # run before/after callbacks defined in model
          run_callbacks(:create) do
            # timestamp
            if self.record_timestamps
              current_time = current_time_from_proper_timezone

              all_timestamp_attributes_in_model.each do |column|
                if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
                  write_attribute(column.to_s, current_time)
                end
              end
            end
            # run
            create_using_custom_method
          end
        else
          super
        end
      end
1184054
async def save(self):
        

        if hasattr(self, "before_save"):
            self.before_save()

        query = r.table(self.table_name)

        if self._state.get("id"):
            query = query \
                .get(self._state.get("id")) \
                .update(self.__db_repr, return_changes=True)
        else:
            query = query \
                .insert(self.__db_repr, return_changes=True)

        resp = await query.run(await conn.get())

        try:
            changes = resp["changes"]

            if len(changes) > 0:
                self.wrap(resp["changes"][0]["new_val"])
        except KeyError:
            raise UnexpectedDbResponse()

        if resp["skipped"] > 0:
            raise UnexpectedDbResponse(
                "Model with id `%s` not found in the database." %
                self._state.get("id"))

        return self
107636
def do_create(options = {})
      attributes = options[:attributes] || params[:record]
      active_scaffold_config.model.transaction do
        @record = update_record_from_params(new_model, active_scaffold_config.create.columns, attributes)
        apply_constraints_to_record(@record, :allow_autosave => true)
        create_association_with_parent(@record) if nested?
        before_create_save(@record)
        # errors to @record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised
        self.successful = [@record.keeping_errors { @record.valid? }, @record.associated_valid?].all? # this syntax avoids a short-circuit
        create_save(@record) unless options[:skip_save]
      end
    rescue ActiveRecord::ActiveRecordError => ex
      flash[:error] = ex.message
      self.successful = false
      @record ||= new_model # ensure @record exists or display form will fail
    end
981875
def put(self, data, request, id):
        
        if not id:
            # can't update the whole container
            raise errors.MethodNotAllowed()
        userdata = self._dict_to_model(data)
        userdata.pk = id
        try:
            userdata.save(force_update=True)
        except DatabaseError:
            # can't udpate non-existing user
            raise errors.NotFound()