<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> Bugzilla::WebService::Util</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" title="style" type="text/css" href="../.././../../../../style.css" media="all" > </head> <body id="pod"> <p class="backlinktop"><b><a name="___top" href="../../index.html" accesskey="1" title="All Documents"><<</a></b></p> <h1></h1> <div class='indexgroup'> <ul class='indexList indexList1'> <li class='indexItem indexItem1'><a href='#NAME'>NAME</a> <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a> <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a> <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a> <ul class='indexList indexList2'> <li class='indexItem indexItem2'><a href='#filter'>filter</a> <li class='indexItem indexItem2'><a href='#filter_wants'>filter_wants</a> <li class='indexItem indexItem2'><a href='#validate'>validate</a> <li class='indexItem indexItem2'><a href='#translate'>translate</a> <li class='indexItem indexItem2'><a href='#params_to_objects'>params_to_objects</a> <li class='indexItem indexItem2'><a href='#fix_credentials'>fix_credentials</a> <li class='indexItem indexItem2'><a href='#extract_flags'>extract_flags</a> </ul> <li class='indexItem indexItem1'><a href='#Methods_in_need_of_POD'>Methods in need of POD</a> </ul> </div> <h1><a class='u' href='#___top' title='click to go to top of document' name="NAME" >NAME</a></h1> <p>Bugzilla::WebService::Util - Utility functions used inside of the WebService code. These are <b>not</b> functions that can be called via the WebService.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="DESCRIPTION" >DESCRIPTION</a></h1> <p>This is somewhat like <a href="../../Bugzilla/Util.html" class="podlinkpod" >Bugzilla::Util</a>, but these functions are only used internally in the WebService code.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SYNOPSIS" >SYNOPSIS</a></h1> <pre class="code"> filter({ include_fields => ['id', 'name'], exclude_fields => ['name'] }, $hash); my $wants = filter_wants $params, 'field_name'; validate(@_, 'ids');</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="METHODS" >METHODS</a></h1> <h2><a class='u' href='#___top' title='click to go to top of document' name="filter" >filter</a></h2> <p>This helps implement the <code class="code">include_fields</code> and <code class="code">exclude_fields</code> arguments of WebService methods. Given a hash (the second argument to this subroutine), this will remove any keys that are <i>not</i> in <code class="code">include_fields</code> and then remove any keys that <i>are</i> in <code class="code">exclude_fields</code>.</p> <p>An optional third option can be passed that prefixes the field name to allow filtering of data two or more levels deep.</p> <p>For example, if you want to filter out the <code class="code">id</code> key/value in components returned by Product.get, you would use the value <code class="code">component.id</code> in your <code class="code">exclude_fields</code> list.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="filter_wants" >filter_wants</a></h2> <p>Returns <code class="code">1</code> if a filter would preserve the specified field when passing a hash to <a href="#filter" class="podlinkpod" >"filter"</a>, <code class="code">0</code> otherwise.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="validate" >validate</a></h2> <p>This helps in the validation of parameters passed into the WebService methods. Currently it converts listed parameters into an array reference if the client only passed a single scalar value. It modifies the parameters hash in place so other parameters should be unaltered.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="translate" >translate</a></h2> <p>WebService methods frequently take parameters with different names than the ones that we use internally in Bugzilla. This function takes a hashref that has field names for keys and returns a hashref with those keys renamed according to the mapping passed in with the second parameter (which is also a hashref).</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="params_to_objects" >params_to_objects</a></h2> <p>Creates objects of the type passed in as the second parameter, using the parameters passed to a WebService method (the first parameter to this function). Helps make life simpler for WebService methods that internally create objects via both "ids" and "names" fields. Also de-duplicates objects that were loaded by both "ids" and "names". Returns an arrayref of objects.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="fix_credentials" >fix_credentials</a></h2> <p>Allows for certain parameters related to authentication such as Bugzilla_login, Bugzilla_password, and Bugzilla_token to have shorter named equivalents passed in. This function converts the shorter versions to their respective internal names.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="extract_flags" >extract_flags</a></h2> <p>Subroutine that takes a list of hashes that are potential flag changes for both bugs and attachments. Then breaks the list down into two separate lists based on if the change is to add a new flag or to update an existing flag.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="Methods_in_need_of_POD" ><b>Methods in need of POD</b></a></h1> <dl> <dt><a name="taint_data" >taint_data</a></dt> </dl> <p class="backlinkbottom"><b><a name="___bottom" href="../../index.html" title="All Documents"><<</a></b></p> <!-- end doc --> </body></html>