<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Class: Cloud::Projects — Documentation by YARD 0.8.7.6 </title> <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = '../'; framesUrl = "../frames.html#!Cloud/Projects.html"; </script> <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="../js/app.js"></script> </head> <body> <div id="header"> <div id="menu"> <a href="../_index.html">Index (P)</a> » <span class='title'><span class='object_link'><a href="../Cloud.html" title="Cloud (module)">Cloud</a></span></span> » <span class="title">Projects</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../class_list.html"> Class List </a> <a class="full_list_link" id="method_list_link" href="../method_list.html"> Method List </a> <a class="full_list_link" id="file_list_link" href="../file_list.html"> File List </a> </div> <div class="clear"></div> </div> <iframe id="search_frame"></iframe> <div id="content"><h1>Class: Cloud::Projects </h1> <dl class="box"> <dt class="r1">Inherits:</dt> <dd class="r1"> <span class="inheritName">Object</span> <ul class="fullTree"> <li>Object</li> <li class="next">Cloud::Projects</li> </ul> <a href="#" class="inheritanceTree">show all</a> </dd> <dt class="r2 last">Defined in:</dt> <dd class="r2 last">lib/cloud/projects.rb</dd> </dl> <div class="clear"></div> <h2> Instance Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#create_client-instance_method" title="#create_client (instance method)">- (Object) <strong>create_client</strong>(client_name, project_id, root) </a> </span> <span class="summary_desc"><div class='inline'> <p>Generate a new client that only contains the project mapping.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#create_pending_change-instance_method" title="#create_pending_change (instance method)">- (Object) <strong>create_pending_change</strong>(project_id) </a> </span> <span class="summary_desc"><div class='inline'> <p>If the user doesn't have a current pending change for the project, create one, and return that.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#fetch-instance_method" title="#fetch (instance method)">- (Object) <strong>fetch</strong>(id, env: nil) </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#fetch_by_name-instance_method" title="#fetch_by_name (instance method)">- (Object) <strong>fetch_by_name</strong>(name) </a> </span> <span class="summary_desc"><div class='inline'> <p>Returns the project's “details” based on the project name.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#find_latest_change_for_project-instance_method" title="#find_latest_change_for_project (instance method)">- (Object) <strong>find_latest_change_for_project</strong>(project_id) </a> </span> <span class="summary_desc"><div class='inline'> <p>Find the latest submitted change for the project.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#find_pending_change_for_project-instance_method" title="#find_pending_change_for_project (instance method)">- (Object) <strong>find_pending_change_for_project</strong>(project_id) </a> </span> <span class="summary_desc"><div class='inline'> <p>The HVE project 'changelist' is a pending changelist whose description is <code><em>hws[user]_[project_id]</em></code>.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#initialize-instance_method" title="#initialize (instance method)">- (Projects) <strong>initialize</strong>(env: nil) </a> </span> <span class="note title constructor">constructor</span> <span class="summary_desc"><div class='inline'> <p>A new instance of Projects.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#list-instance_method" title="#list (instance method)">- (Object) <strong>list</strong>(details: false, extension: nil, env: nil) </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#user-instance_method" title="#user (instance method)">- (Object) <strong>user</strong> </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> </ul> <div id="constructor_details" class="method_details_list"> <h2>Constructor Details</h2> <div class="method_details first"> <h3 class="signature first" id="initialize-instance_method"> - (<tt><span class='object_link'><a href="" title="Cloud::Projects (class)">Projects</a></span></tt>) <strong>initialize</strong>(env: nil) </h3><div class="docstring"> <div class="discussion"> <p>Returns a new instance of Projects</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 6 7 8 9 10</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 6</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>env:</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='ivar'>@env</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span> <span class='ivar'>@user</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>AUTH_CREDENTIALS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='ivar'>@token</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>AUTH_CREDENTIALS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="create_client-instance_method"> - (<tt>Object</tt>) <strong>create_client</strong>(client_name, project_id, root) </h3><div class="docstring"> <div class="discussion"> <p>Generate a new client that only contains the project mapping.</p> <p>The client name is a combination of user, project, and device. We prefix it with “_hve” just for clarity.</p> <p>We do not host lock the client.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>project_id</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'> <p>Our encoded project name</p> </div> </li> <li> <span class='name'>device</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'> <p>A device ID, like a hostname</p> </div> </li> <li> <span class='name'>root</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'> <p>The <code>Root</code> value for the client parameter</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 75 76 77 78 79 80 81 82 83 84 85 86 87 88</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 75</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_client'>create_client</span><span class='lparen'>(</span><span class='id identifier rubyid_client_name'>client_name</span><span class='comma'>,</span> <span class='id identifier rubyid_project_id'>project_id</span><span class='comma'>,</span> <span class='id identifier rubyid_root'>root</span><span class='rparen'>)</span> <span class='id identifier rubyid_project'>project</span> <span class='op'>=</span> <span class='id identifier rubyid_project_from_id'>project_from_id</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='id identifier rubyid_client_spec'>client_spec</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_fetch_client'>fetch_client</span><span class='lparen'>(</span><span class='id identifier rubyid_client_name'>client_name</span><span class='rparen'>)</span> <span class='id identifier rubyid_client_spec'>client_spec</span><span class='period'>.</span><span class='id identifier rubyid__root'>_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span> <span class='id identifier rubyid_client_spec'>client_spec</span><span class='period'>.</span><span class='id identifier rubyid__host'>_host</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='id identifier rubyid_client_spec'>client_spec</span><span class='period'>.</span><span class='id identifier rubyid__options'>_options</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>allwrite noclobber nocompress unlocked nomodtime rmdir</span><span class='tstring_end'>'</span></span><span class='semicolon'>;</span> <span class='id identifier rubyid_client_spec'>client_spec</span><span class='period'>.</span><span class='id identifier rubyid__stream'>_stream</span> <span class='op'>=</span> <span class='id identifier rubyid_project'>project</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stream</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_save_client'>save_client</span><span class='lparen'>(</span><span class='id identifier rubyid_client_spec'>client_spec</span><span class='rparen'>)</span> <span class='id identifier rubyid_client_name'>client_name</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="create_pending_change-instance_method"> - (<tt>Object</tt>) <strong>create_pending_change</strong>(project_id) </h3><div class="docstring"> <div class="discussion"> <p>If the user doesn't have a current pending change for the project, create one, and return that.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 117</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_pending_change'>create_pending_change</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='id identifier rubyid_change'>change</span> <span class='op'>=</span> <span class='id identifier rubyid_find_pending_change_for_project'>find_pending_change_for_project</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='id identifier rubyid_change'>change</span> <span class='kw'>if</span> <span class='id identifier rubyid_change'>change</span> <span class='id identifier rubyid_change_spec'>change_spec</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_fetch_change'>fetch_change</span> <span class='id identifier rubyid_change_spec'>change_spec</span><span class='period'>.</span><span class='id identifier rubyid__description'>_description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_hws_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_user'>user</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_project_id'>project_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='id identifier rubyid_save_results'>save_results</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_save_change'>save_change</span><span class='lparen'>(</span><span class='id identifier rubyid_change_spec'>change_spec</span><span class='rparen'>)</span> <span class='id identifier rubyid_change'>change</span> <span class='op'>=</span> <span class='id identifier rubyid_save_results'>save_results</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>Change (\d+) created.</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'># If we don't reset the client of this pending change, we won't be able </span> <span class='comment'># to cleanup the temporary client. </span> <span class='id identifier rubyid_change_spec'>change_spec</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_fetch_change'>fetch_change</span><span class='lparen'>(</span><span class='id identifier rubyid_change'>change</span><span class='rparen'>)</span> <span class='id identifier rubyid_change_spec'>change_spec</span><span class='period'>.</span><span class='id identifier rubyid__client'>_client</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>INVALID</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_save_change'>save_change</span><span class='lparen'>(</span><span class='id identifier rubyid_change_spec'>change_spec</span><span class='rparen'>)</span> <span class='id identifier rubyid_change'>change</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="fetch-instance_method"> - (<tt>Object</tt>) <strong>fetch</strong>(id, env: nil) </h3><table class="source_code"> <tr> <td> <pre class="lines"> 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 35</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='label'>env:</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='comment'># env.AUTH_CREDENTIALS has our token (in last) </span> <span class='comment'># GET (cloud url)/api/v1/project/:id </span> <span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_cloud_settings'>cloud_settings</span><span class='lbracket'>[</span><span class='symbol'>:helix_cloud_url</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>/api/v1/projects/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># auth.credentials.first == username </span> <span class='comment'># auth.credentials.last == session token </span> <span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@token</span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_http'>http</span><span class='op'>|</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>200</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_project'>project</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> <span class='comment'># project[:service] = self </span> <span class='kw'>return</span> <span class='id identifier rubyid_project'>project</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="fetch_by_name-instance_method"> - (<tt>Object</tt>) <strong>fetch_by_name</strong>(name) </h3><div class="docstring"> <div class="discussion"> <p>Returns the project's “details” based on the project name.</p> <p>No validation is done to ensure this directory actually exists in the system.</p> </div> </div> <div class="tags"> <p class="tag_title">Raises:</p> <ul class="raise"> <li> <span class='type'>(<tt>Exception</tt>)</span> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 60 61 62 63</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 60</span> <span class='kw'>def</span> <span class='id identifier rubyid_fetch_by_name'>fetch_by_name</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='comment'># TODO : do we need this? </span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exception</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="find_latest_change_for_project-instance_method"> - (<tt>Object</tt>) <strong>find_latest_change_for_project</strong>(project_id) </h3><div class="docstring"> <div class="discussion"> <p>Find the latest submitted change for the project</p> <p>Use the 'p4 changes -m 1 -s submitted [depot path]'</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>project_id</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'> <p>The encoded project ID</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 95 96 97 98 99 100</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 95</span> <span class='kw'>def</span> <span class='id identifier rubyid_find_latest_change_for_project'>find_latest_change_for_project</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='id identifier rubyid_project'>project</span> <span class='op'>=</span> <span class='id identifier rubyid_project_from_id'>project_from_id</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_run_changes'>run_changes</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-m</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-s</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>submitted</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_project'>project</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stream</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>/...</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>change</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="find_pending_change_for_project-instance_method"> - (<tt>Object</tt>) <strong>find_pending_change_for_project</strong>(project_id) </h3><div class="docstring"> <div class="discussion"> <p>The HVE project 'changelist' is a pending changelist whose description is <code><em>hws[user]_[project_id]</em></code></p> <p>We use 'changes -l' to find the change to match potentially long project names.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 107 108 109 110 111 112 113</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 107</span> <span class='kw'>def</span> <span class='id identifier rubyid_find_pending_change_for_project'>find_pending_change_for_project</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_p4'>p4</span><span class='period'>.</span><span class='id identifier rubyid_run_changes'>run_changes</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-l</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-u</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_user'>user</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-s</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>pending</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='id identifier rubyid_change'>change</span> <span class='op'>=</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>desc</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_project_id'>project_id</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='id identifier rubyid_change'>change</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>change</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_change'>change</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="list-instance_method"> - (<tt>Object</tt>) <strong>list</strong>(details: false, extension: nil, env: nil) </h3><table class="source_code"> <tr> <td> <pre class="lines"> 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 12</span> <span class='kw'>def</span> <span class='id identifier rubyid_list'>list</span><span class='lparen'>(</span><span class='label'>details:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>extension:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>env:</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='comment'># GET (cloud url)/api/v1/projects </span> <span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_cloud_settings'>cloud_settings</span><span class='lbracket'>[</span><span class='symbol'>:helix_cloud_url</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>/api/v1/projects</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># auth.credentials.first == username </span> <span class='comment'># auth.credentials.last == session token </span> <span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@token</span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_http'>http</span><span class='op'>|</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>200</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_list'>list</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_details'>details</span> <span class='kw'>return</span> <span class='id identifier rubyid_list'>list</span> <span class='kw'>else</span> <span class='kw'>return</span> <span class='id identifier rubyid_list'>list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='const'>HWSStrings</span><span class='period'>.</span><span class='id identifier rubyid_component_encode'>component_encode</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="user-instance_method"> - (<tt>Object</tt>) <strong>user</strong> </h3><table class="source_code"> <tr> <td> <pre class="lines"> 138 139 140</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/cloud/projects.rb', line 138</span> <span class='kw'>def</span> <span class='id identifier rubyid_user'>user</span> <span class='ivar'>@user</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Mon Oct 12 22:20:52 2015 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.7.6 (ruby-2.2.3). </div> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 16275 | Doug Scheirer | Merge from main | ||
#4 | 16196 | Doug Scheirer | Merge from main | ||
#3 | 16148 | Doug Scheirer | Merge from main | ||
#2 | 16114 | Doug Scheirer | Merge from main | ||
#1 | 16079 | Doug Scheirer | Merge from main | ||
//guest/perforce_software/helix-web-services/main/build/doc/helix_web_services/Cloud/Projects.html | |||||
#2 | 16077 | tjuricek |
HWS/NOARCH/2015.1.main/201510051630 Includes changes to trust behavior |
||
#1 | 16075 | tjuricek |
HWS/NOARCH/2015.1.main/201510051543 This includes a first implementation of the Helix Cloud integration with Helix Sync. |