partydrone/connect-sdk-ruby

View on GitHub
docs/OpConnect/Client.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: OpConnect::Client
  
    &mdash; Documentation by YARD 0.9.27
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" />

<script type="text/javascript">
  pathId = "OpConnect::Client";
  relpath = '../';
</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 class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../OpConnect.html" title="OpConnect (module)">OpConnect</a></span></span>
     &raquo; 
    <span class="title">Client</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: OpConnect::Client
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">OpConnect::Client</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  <dl>
      <dt>Includes:</dt>
      <dd>Files, Items, Vaults, <span class='object_link'><a href="Configurable.html" title="OpConnect::Configurable (module)">Configurable</a></span>, <span class='object_link'><a href="Connection.html" title="OpConnect::Connection (module)">Connection</a></span></dd>
  </dl>
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/op_connect/client.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Client for the OpConnect API.</p>


  </div>
</div>
<div class="tags">
  

</div>





  <h2>Instance Attribute Summary</h2>
  
  <h3 class="inherited">Attributes included from <span class='object_link'><a href="Configurable.html" title="OpConnect::Configurable (module)">Configurable</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Configurable.html#access_token-instance_method" title="OpConnect::Configurable#access_token (method)">#access_token</a></span>, <span class='object_link'><a href="Configurable.html#adapter-instance_method" title="OpConnect::Configurable#adapter (method)">#adapter</a></span>, <span class='object_link'><a href="Configurable.html#api_endpoint-instance_method" title="OpConnect::Configurable#api_endpoint (method)">#api_endpoint</a></span>, <span class='object_link'><a href="Configurable.html#stubs-instance_method" title="OpConnect::Configurable#stubs (method)">#stubs</a></span>, <span class='object_link'><a href="Configurable.html#user_agent-instance_method" title="OpConnect::Configurable#user_agent (method)">#user_agent</a></span></p>


  
    <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="#activity-instance_method" title="#activity (instance method)">#<strong>activity</strong>(**params)  &#x21d2; Array&lt;APIRequest&gt; </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Retrieve a list of API requests that have been made.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#health-instance_method" title="#health (instance method)">#<strong>health</strong>  &#x21d2; ServerHealth </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Query the state of the server and its service dependencies.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#heartbeat-instance_method" title="#heartbeat (instance method)">#<strong>heartbeat</strong>  &#x21d2; Boolean </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Simple “ping” endpoint to check whether the server is active.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options = {})  &#x21d2; Client </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A new instance of Client.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Text representation of the client, masking tokens.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#metrics-instance_method" title="#metrics (instance method)">#<strong>metrics</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Returns Prometheus metrics collected by the server.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Connection.html" title="OpConnect::Connection (module)">Connection</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Connection.html#connection-instance_method" title="OpConnect::Connection#connection (method)">#connection</a></span>, <span class='object_link'><a href="Connection.html#delete-instance_method" title="OpConnect::Connection#delete (method)">#delete</a></span>, <span class='object_link'><a href="Connection.html#get-instance_method" title="OpConnect::Connection#get (method)">#get</a></span>, <span class='object_link'><a href="Connection.html#last_response-instance_method" title="OpConnect::Connection#last_response (method)">#last_response</a></span>, <span class='object_link'><a href="Connection.html#patch-instance_method" title="OpConnect::Connection#patch (method)">#patch</a></span>, <span class='object_link'><a href="Connection.html#post-instance_method" title="OpConnect::Connection#post (method)">#post</a></span>, <span class='object_link'><a href="Connection.html#put-instance_method" title="OpConnect::Connection#put (method)">#put</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Configurable.html" title="OpConnect::Configurable (module)">Configurable</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Configurable.html#configure-instance_method" title="OpConnect::Configurable#configure (method)">#configure</a></span>, <span class='object_link'><a href="Configurable.html#keys-class_method" title="OpConnect::Configurable.keys (method)">keys</a></span>, <span class='object_link'><a href="Configurable.html#reset!-instance_method" title="OpConnect::Configurable#reset! (method)">#reset!</a></span>, <span class='object_link'><a href="Configurable.html#same_options%3F-instance_method" title="OpConnect::Configurable#same_options? (method)">#same_options?</a></span></p>
<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">
  
    #<strong>initialize</strong>(options = {})  &#x21d2; <tt><span class='object_link'><a href="" title="OpConnect::Client (class)">Client</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns a new instance of Client.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17
18
19
20</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 15</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='const'><span class='object_link'><a href="../OpConnect.html" title="OpConnect (module)">OpConnect</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Configurable.html" title="OpConnect::Configurable (module)">Configurable</a></span></span><span class='period'>.</span><span class='id identifier rubyid_keys'><span class='object_link'><a href="Configurable.html#keys-class_method" title="OpConnect::Configurable.keys (method)">keys</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
    <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='const'><span class='object_link'><a href="../OpConnect.html" title="OpConnect (module)">OpConnect</a></span></span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='symbol'>:&quot;@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:&quot;@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
  <span class='kw'>end</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="activity-instance_method">
  
    #<strong>activity</strong>(**params)  &#x21d2; <tt>Array&lt;<span class='object_link'><a href="APIRequest.html" title="OpConnect::APIRequest (class)">APIRequest</a></span>&gt;</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Retrieve a list of API requests that have been made.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Optional parameters.</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>**params</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:limit</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>How many API Events should be returned in a single request.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:offset</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>How far into the collection of API Events should the response start.</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="APIRequest.html" title="OpConnect::APIRequest (class)">APIRequest</a></span>&gt;</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


42
43
44</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 42</span>

<span class='kw'>def</span> <span class='id identifier rubyid_activity'>activity</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>activity</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</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_a'>a</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="APIRequest.html" title="OpConnect::APIRequest (class)">APIRequest</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="APIRequest.html#initialize-instance_method" title="OpConnect::APIRequest#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="health-instance_method">
  
    #<strong>health</strong>  &#x21d2; <tt><span class='object_link'><a href="ServerHealth.html" title="OpConnect::ServerHealth (class)">ServerHealth</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Query the state of the server and its service dependencies.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="ServerHealth.html" title="OpConnect::ServerHealth (class)">ServerHealth</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Returns a ‘ServerHealth` object.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 61</span>

<span class='kw'>def</span> <span class='id identifier rubyid_health'>health</span>
  <span class='const'><span class='object_link'><a href="ServerHealth.html" title="OpConnect::ServerHealth (class)">ServerHealth</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ServerHealth.html#initialize-instance_method" title="OpConnect::ServerHealth#initialize (method)">new</a></span></span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/health</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="heartbeat-instance_method">
  
    #<strong>heartbeat</strong>  &#x21d2; <tt>Boolean</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Simple “ping” endpoint to check whether the server is active.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Returns true if the server is active, false otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


50
51
52
53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 50</span>

<span class='kw'>def</span> <span class='id identifier rubyid_heartbeat'>heartbeat</span>
  <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/heartbeat</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='int'>200</span>
  <span class='kw'>false</span>
<span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="../OpConnect.html" title="OpConnect (module)">OpConnect</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Error.html" title="OpConnect::Error (class)">Error</a></span></span>
  <span class='kw'>false</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="inspect-instance_method">
  
    #<strong>inspect</strong>  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Text representation of the client, masking tokens.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28
29
30</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 26</span>

<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
  <span class='id identifier rubyid_inspected'>inspected</span> <span class='op'>=</span> <span class='kw'>super</span>
  <span class='id identifier rubyid_inspected'>inspected</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='ivar'>@access_token</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>*</span><span class='tstring_end'>&quot;</span></span> <span class='op'>*</span> <span class='int'>24</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@access_token</span>
  <span class='id identifier rubyid_inspected'>inspected</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="metrics-instance_method">
  
    #<strong>metrics</strong>  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns Prometheus metrics collected by the server.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Returns a plain text list of Prometheus metrics.</p>
</div>
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><a href="https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format" target="_parent" title="Prometheus documentation">Prometheus documentation</a></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


72
73
74</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/client.rb', line 72</span>

<span class='kw'>def</span> <span class='id identifier rubyid_metrics'>metrics</span>
  <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/metrics</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Mon Mar 21 03:39:12 2022 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.27 (ruby-3.1.1).
</div>

    </div>
  </body>
</html>