Saves a element to keytech web api and returns the saved element.
 If anything goes wrong - a http response is returned
189820
def update(element)
      elementHash = element.to_hash
      parameter = { basic_auth: @auth,
                    body: elementHash.to_json,
                    headers: { 'Content-Type' => 'application/json; charset=utf-8 ' } }
      save_response = self.class.put("/elements/#{element.key}", parameter)
      if save_response.success?
        Element.new(save_response.parsed_response)
      else
        puts "Could not save element: #{save_response.headers['x-errordescription']}"
      end
    end
1000336
def save(self, data, xparent=None):
        
        if xparent is not None:
            elem = ElementTree.SubElement(xparent, 'bool')
        else:
            elem = ElementTree.Element('bool')

        elem.text = nstr(data)
        return elem
857102
public function saveAction(Request $request)
    {
        $id = $request->get('id');
        $ids = $request->get('ids');

        $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
        $elementtype = $elementtypeService->findElementtype($id);

        $elementtypeService->updateViability($elementtype, $ids);

        return new ResultResponse(true);
    }
933375
def save(self):
        
        if 'save' not in self._supports:
            raise AssertionError('Can not save this object type')

        values = {}
        for key in [key for key in self.keys() if key not in self._save_ignore]:
            if not getattr(self, key) and getattr(self, key) != False:
                continue

            if isinstance(getattr(self, key, None), list):
                value = list()
                for item in getattr(self, key):
                    if isinstance(item, dict):
                        value.append(item)
                    elif hasattr(item, '_save_as'):
                        value.append(item._save_as())
                    elif hasattr(item, '_ref') and getattr(item, '_ref'):
                        value.append(getattr(item, '_ref'))
                    else:
                        LOGGER.warning('Cant assign %r', item)
                values[key] = value
            elif getattr(self, key, None):
                values[key] = getattr(self, key)
        if not self._ref:
            response = self._session.post(self._path, values)
        else:
            values['_ref'] = self._ref
            response = self._session.put(self._path, values)
        LOGGER.debug('Response: %r, %r', response.status_code, response.content)
        if 200 <= response.status_code <= 201:
            self.fetch()
            return True
        else:
            try:
                error = response.json()
                raise exceptions.ProtocolError(error['text'])
            except ValueError:
                raise exceptions.ProtocolError(response.content)
907462
private HeaderElement getElement(HeaderKeys key) {
        HeaderElement elem = this.headerElements;
        if (null != elem) {
            // disconnect it from the rest of the free list
            this.headerElements = elem.nextInstance;
            elem.nextInstance = null;
            elem.init(key);
        } else {
            elem = new HeaderElement(key, this);
        }
        return elem;
    }
866256
function(params, callback) {
                var keyId;

                if (params) {
                    if (params.keyId != 'undefined') {
                        keyId = params.keyId;
                    }
                }

                var httpRequestParams = {
                    url: SERVICE_ADDRESSES.SSO_ADDRESS + SERVICES_PATH.SSO_GET_KEY + keyId,
                    method: 'GET',
                    headers: {
                        'Authorization': 'Bearer ' + token
                    }
                };

                httpRequest(httpRequestParams, function(result) {
                    if (!result.hasError) {
                        try {
                            var response = JSON.parse(result.result.responseText);
                        }
                        catch (e) {
                            console.log(e);
                        }

                        callback && callback({
                            hasError: false,
                            secretKey: response.secretKey
                        });
                    }
                    else {
                        callback && callback({
                            hasError: true,
                            code: result.errorCode,
                            message: result.errorMessage
                        });

                        fireEvent('error', {
                            code: result.errorCode,
                            message: result.errorMessage,
                            error: result
                        });
                    }
                });
            }
1272582
def save!
      response = HTTParty.put("#{users_base_path}/#{id}", timeout: timeout, headers: headers, body: to_json)
      get_body_from(response)
    end
405243
protected function SaveElement()
    {
        $this->confirm->SetErrorUrl($this->selectorError->Save($this->confirm->GetErrorUrl()));
        $this->confirm->SetSuccessUrl($this->selectorSuccess->Save($this->confirm->GetSuccessUrl()));
        return $this->confirm;
    }
866968
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # synchronous operation
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        check_required_fields(method, uri, body, ['name'])
        new_password_rule = console.password_rules.add(body)
        return {'element-uri': new_password_rule.uri}
464330
def save(connection)
      xml = connection.make_xml('TicketCreateRequest')
      xml.add_element(to_xml)

      response = connection.execute(xml, '1.2')
      @id = response.attributes['id'].to_i if response.success
    end
1182795
def send_special_keys(self, value):
        
        def send_keys_element():
            """
            Wrapper to send keys
            """
            return self.element.send_keys(value)
        self.execute_and_handle_webelement_exceptions(send_keys_element, 'send keys')
        return self
541174
def save_and_respond(resource, options={}, &block)
      creation = resource.new_record?
      resource.attributes = options[:attributes] unless options[:attributes].nil?
      respond_to do |format|
        # if ((block_given? and block.arity == 1) ? yield(resource) : (block_given? and block.arity == 2) ? yield(resource, format) : resource.save)
        if (block_given? ? yield(resource, format) : resource.save)
          status = (creation ? :created : :ok)
          response.headers["X-Return-Code"] = "success"
          response.headers["X-Saved-Record-Id"] = resource.id.to_s
          format.html { params[:dialog] ? head(status) : redirect_to(options[:url] || resource) }
          format.json { render :json => resource.to_json, :status => status, :location => resource}
          format.xml  { render  :xml => resource.to_xml,  :status => status, :location => resource }
        else
          response.headers["X-Return-Code"] = "invalid"
          format.html { render :action => (resource.new_record? ? "new" : "edit")}
          format.json { render :json => resource.errors.to_json, :status => :unprocessable_entity }
          format.xml  { render  :xml => resource.errors.to_xml,  :status => :unprocessable_entity }
        end
      end
    end
417850
def whereused(element_key, options = {})
      parameter = { query: options }
      parameter[:basic_auth] = @auth

      response = self.class.get("/elements/#{element_key}/whereused", parameter)
      if response.success?
        searchResponseHeader = SearchResponseHeader.new(response)
        return searchResponseHeader.elementList
      end
    end
1351121
public void save(HttpServletRequest req, HttpServletResponse res, AuthenticationResult authResult) {
		save(req, res, authResult, false);
	}
314962
private Response save(Response response) {
        String jsonBody;
        String key = response.request().url().toString();

        log("----- SAVE FOR OFFLINE : saving starts");
        log("---------- for request : " + key);
        log("---------- trying to parse response body");

        //Try to get response body
        BufferedReader reader;
        StringBuilder sb = new StringBuilder();
        log("---------- trying to parse response body");
        InputStream bodyStream = response.body().byteStream();
        InputStreamReader bodyReader = new InputStreamReader(bodyStream, Charset.forName("UTF-8"));
        reader = new BufferedReader(bodyReader);
        String line;
        try {
            while ((line = reader.readLine()) != null) {
                sb.append(line);
            }
            bodyReader.close();
            bodyReader.close();
            reader.close();
        } catch (IOException e) {
            Log.e(TAG, "IOException : " + e.getMessage());
        }


        jsonBody = sb.toString();


        log("---------- trying to save response body for offline");

        mCacheQueryHandler.put(key, jsonBody);

        log("---------- url : " + key);
        log("---------- body : " + jsonBody);
        log("----- SAVE FOR OFFLINE : saving ends");

        return response.newBuilder().body(ResponseBody.create(response.body().contentType(), jsonBody)).build();
    }
1211844
String getElementKeyString(Element element) {
		JsonKey key = element.getAnnotation(JsonKey.class);
		JsonModel model = element.getEnclosingElement().getAnnotation(JsonModel.class);
		if (!"".equals(key.value())) {
			return key.value();
		} else if ("".equals(key.value()) && key.decamelize()) {
			return decamelize(element.toString());
		} else if ("".equals(key.value()) && model.decamelize()) {
			return decamelize(element.toString());
		} else {
			return element.toString();
		}
	}
1275916
function(element, key) {
        var value = element.data((this.keyName + '-' + key).toLowerCase());

        if ($.type(value) === 'undefined') {
            value = this.options[key];
        }

        return value;
    }