partydrone/connect-sdk-ruby

View on GitHub
docs/OpConnect/Connection.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>
  Module: OpConnect::Connection
  
    &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::Connection";
  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">Connection</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>Module: OpConnect::Connection
  
  
  
</h1>
<div class="box_info">
  

  
  
  
  
  

  
  <dl>
    <dt>Included in:</dt>
    <dd><span class='object_link'><a href="Client.html" title="OpConnect::Client (class)">Client</a></span></dd>
  </dl>
  

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

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Network layer for API clients.</p>


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

</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="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong>  &#x21d2; Faraday::Client </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Connection object for the 1Password Connect API.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong>(url, params: {}, headers: {})  &#x21d2; Faraday::Response </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Make an HTTP DELETE request.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get-instance_method" title="#get (instance method)">#<strong>get</strong>(url, params: {}, headers: {})  &#x21d2; Faraday::Response </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Make an HTTP GET request.</p>
</div></span>
  
</li>

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

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Response for the last HTTP request.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#patch-instance_method" title="#patch (instance method)">#<strong>patch</strong>(url, body:, headers: {})  &#x21d2; Faraday::Response </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Make an HTTP PATCH request.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#post-instance_method" title="#post (instance method)">#<strong>post</strong>(url, body:, headers: {})  &#x21d2; Faraday::Response </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Make an HTTP POST request.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#put-instance_method" title="#put (instance method)">#<strong>put</strong>(url, body:, headers: {})  &#x21d2; Faraday::Response </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Make an HTTP PUT request.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="connection-instance_method">
  
    #<strong>connection</strong>  &#x21d2; <tt>Faraday::Client</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Connection object for the 1Password Connect API.</p>


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

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


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 69</span>

<span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
  <span class='ivar'>@connection</span> <span class='op'>||=</span> <span class='const'>Faraday</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_api_endpoint'>api_endpoint</span><span class='rparen'>)</span> <span class='kw'>do</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_headers'>headers</span><span class='lbracket'>[</span><span class='symbol'>:user_agent</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_user_agent'>user_agent</span>

    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span> <span class='symbol'>:authorization</span><span class='comma'>,</span> <span class='symbol'>:Bearer</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span>
    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span> <span class='symbol'>:json</span>

    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</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="Response.html" title="OpConnect::Response (module)">Response</a></span></span><span class='op'>::</span><span class='const'>RaiseError</span>

    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span> <span class='symbol'>:dates</span>
    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span> <span class='symbol'>:json</span><span class='comma'>,</span> <span class='label'>content_type:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_adapter'>adapter</span> <span class='id identifier rubyid_adapter'>adapter</span><span class='comma'>,</span> <span class='ivar'>@stubs</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete-instance_method">
  
    #<strong>delete</strong>(url, params: {}, headers: {})  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Make an HTTP DELETE request.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path, relative to #api_endpoint.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Query params for the request.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>headers</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Header params for the request.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Faraday::Response</tt>)</span>
      
      
      
    </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/connection.rb', line 61</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_request'>request</span> <span class='symbol'>:delete</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get-instance_method">
  
    #<strong>get</strong>(url, params: {}, headers: {})  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Make an HTTP GET request.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path, relative to #api_endpoint.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Query parameters for the request.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>headers</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Header params for the request.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Faraday::Response</tt>)</span>
      
      
      
    </li>
  
</ul>

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


13
14
15</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 13</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_request'>request</span> <span class='symbol'>:get</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="last_response-instance_method">
  
    #<strong>last_response</strong>  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Response for the last HTTP request.</p>


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

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


89
90
91</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 89</span>

<span class='kw'>def</span> <span class='id identifier rubyid_last_response'>last_response</span>
  <span class='ivar'>@last_response</span> <span class='kw'>if</span> <span class='kw'>defined?</span> <span class='ivar'>@last_response</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="patch-instance_method">
  
    #<strong>patch</strong>(url, body:, headers: {})  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Make an HTTP PATCH request.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path, relative to #api_endpoint.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>body</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Body params for the request.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>headers</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Header params for the request.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Faraday::Response</tt>)</span>
      
      
      
    </li>
  
</ul>

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


49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 49</span>

<span class='kw'>def</span> <span class='id identifier rubyid_patch'>patch</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>body:</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_request'>request</span> <span class='symbol'>:patch</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="post-instance_method">
  
    #<strong>post</strong>(url, body:, headers: {})  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Make an HTTP POST request.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path, relative to #api_endpoint.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>body</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Body params for the request.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>headers</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Header params for the request.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Faraday::Response</tt>)</span>
      
      
      
    </li>
  
</ul>

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


25
26
27</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 25</span>

<span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>body:</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_request'>request</span> <span class='symbol'>:post</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="put-instance_method">
  
    #<strong>put</strong>(url, body:, headers: {})  &#x21d2; <tt>Faraday::Response</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Make an HTTP PUT request.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path, relative to #api_endpoint.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>body</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Body params for the request.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>headers</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>Header params for the request.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Faraday::Response</tt>)</span>
      
      
      
    </li>
  
</ul>

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


37
38
39</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/op_connect/connection.rb', line 37</span>

<span class='kw'>def</span> <span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>body:</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_request'>request</span> <span class='symbol'>:put</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</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>