Files
ngrok-api-ruby/docs/file.README.html
T
2026-01-23 21:38:12 +00:00

176 lines
15 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: README
&mdash; Documentation by YARD 0.9.36
</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 = "README";
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="file_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</a> &raquo;
<span class="title">File: README</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"><div id='filecontents'><!-- Code generated for API Clients. DO NOT EDIT. -->
<h1 id="label-ngrok+API+client+library+for+Ruby">ngrok API client library for Ruby</h1>
<p>This library wraps the <a href="https://ngrok.com/docs/api">ngrok HTTP API</a> to make it easier to consume in Ruby.</p>
<h2 id="label-Installation">Installation</h2>
<p>This library is published on <a href="https://rubygems.org/gems/ngrok-api">Rubygems</a></p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_ngrok'>ngrok</span><span class='op'>-</span><span class='id identifier rubyid_api'>api</span>
</code></pre>
<h2 id="label-Support">Support</h2>
<p>The best place to get support using this library is through the <a href="https://ngrok.com/slack">ngrok Slack Community</a>. If you find any bugs, please contribute by opening a <a href="https://github.com/ngrok/ngrok-api-ruby/issues/new/choose">new GitHub issue</a>.</p>
<h2 id="label-Documentation">Documentation</h2>
<p>A quickstart guide and a full API reference are included in the <a href="https://ruby-api.docs.ngrok.com">ngrok Ruby API documentation</a></p>
<h2 id="label-Quickstart">Quickstart</h2>
<p>Please consult the <a href="https://ruby-api.docs.ngrok.com">documentation</a> for additional examples.</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ngrokapi</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NgrokAPI.html" title="NgrokAPI (module)">NgrokAPI</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Client.html" title="NgrokAPI::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="NgrokAPI/Client.html#initialize-instance_method" title="NgrokAPI::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>api_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;API KEY&gt;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='comment'># Get an instance of the api_keys client and list all API keys
</span><span class='id identifier rubyid_keys_client'>keys_client</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_api_keys'>api_keys</span>
<span class='id identifier rubyid_keys_client'>keys_client</span><span class='period'>.</span><span class='id identifier rubyid_list'>list</span>
<span class='comment'># Or set up an edge and backend with the ability to change your configuration later
</span><span class='id identifier rubyid_edge'>edge</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_edges'>edges</span><span class='period'>.</span><span class='id identifier rubyid_https'>https</span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span>
<span class='label'>description:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A Ruby Created Edge</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>metadata:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{&quot;client&quot;: &quot;ruby&quot;}</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
<span class='label'>hostports:</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>your-subdomain.ngrok.io:443</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_backend'>backend</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_backends'>backends</span><span class='period'>.</span><span class='id identifier rubyid_tunnel_group'>tunnel_group</span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span>
<span class='label'>description:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A Ruby Created Backend</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>labels:</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>client_example</span><span class='label_end'>&quot;:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ruby</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_route'>route</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_edges'>edges</span><span class='period'>.</span><span class='id identifier rubyid_https_routes'>https_routes</span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span>
<span class='label'>edge_id:</span> <span class='id identifier rubyid_edge'>edge</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span>
<span class='label'>match_type:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>path_prefix</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>match:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>description:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Root</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>backend:</span> <span class='const'><span class='object_link'><a href="NgrokAPI.html" title="NgrokAPI (module)">NgrokAPI</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models.html" title="NgrokAPI::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models/EndpointBackendMutate.html" title="NgrokAPI::Models::EndpointBackendMutate (class)">EndpointBackendMutate</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="NgrokAPI/Models/EndpointBackendMutate.html#initialize-instance_method" title="NgrokAPI::Models::EndpointBackendMutate#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>attrs:</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled</span><span class='label_end'>&quot;:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>backend_id</span><span class='label_end'>&quot;:</span> <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>compression:</span> <span class='const'><span class='object_link'><a href="NgrokAPI.html" title="NgrokAPI (module)">NgrokAPI</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models.html" title="NgrokAPI::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models/EndpointCompression.html" title="NgrokAPI::Models::EndpointCompression (class)">EndpointCompression</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="NgrokAPI/Models/EndpointCompression.html#initialize-instance_method" title="NgrokAPI::Models::EndpointCompression#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>attrs:</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled</span><span class='label_end'>&quot;:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_edge_modules'>edge_modules</span><span class='period'>.</span><span class='id identifier rubyid_https_edge_route_compression'>https_edge_route_compression</span><span class='period'>.</span><span class='id identifier rubyid_replace!'>replace!</span><span class='lparen'>(</span>
<span class='label'>edge_id:</span> <span class='id identifier rubyid_edge'>edge</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span>
<span class='label'>id:</span> <span class='id identifier rubyid_route'>route</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span>
<span class='label'>a_module:</span> <span class='const'><span class='object_link'><a href="NgrokAPI.html" title="NgrokAPI (module)">NgrokAPI</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models.html" title="NgrokAPI::Models (module)">Models</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NgrokAPI/Models/EndpointCompression.html" title="NgrokAPI::Models::EndpointCompression (class)">EndpointCompression</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="NgrokAPI/Models/EndpointCompression.html#initialize-instance_method" title="NgrokAPI::Models::EndpointCompression#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>attrs:</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled</span><span class='label_end'>&quot;:</span> <span class='kw'>false</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='rparen'>)</span>
</code></pre>
<h2 id="label-Local+Documentation">Local Documentation</h2>
<p>Documentation can be generated with the command:</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_bundle'>bundle</span> <span class='id identifier rubyid_exec'>exec</span> <span class='id identifier rubyid_yard'>yard</span> <span class='id identifier rubyid_doc'>doc</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>lib/**/*.rb</span><span class='tstring_end'>&#39;</span></span>
</code></pre>
<p>This will generate documentation which can be viewed within the doc folder.</p>
<h2 id="label-Specs">Specs</h2>
<p>Specs can be run with the command:</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_bundle'>bundle</span> <span class='id identifier rubyid_exec'>exec</span> <span class='id identifier rubyid_rake'>rake</span>
</code></pre>
<p>This will generate a coverage report which can be viewed within the coverage folder.</p>
<h2 id="label-Rubocop">Rubocop</h2>
<p>Rubocop can be run with the command:</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># Run rubocop on lib folder
</span><span class='id identifier rubyid_bundle'>bundle</span> <span class='id identifier rubyid_exec'>exec</span> <span class='id identifier rubyid_rubocop'>rubocop</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>lib</span><span class='tstring_end'>&#39;</span></span>
<span class='comment'># Run rubcop on all files
</span><span class='id identifier rubyid_bundle'>bundle</span> <span class='id identifier rubyid_exec'>exec</span> <span class='id identifier rubyid_rubocop'>rubocop</span>
</code></pre>
<h2 id="label-Building+-28internal-29">Building (internal)</h2>
<p>This is intended for ngrok employees who are updating this client library.</p>
<p>On a standard Ubuntu machine, you will need these packages to get gems to build/install properly:</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_sudo'>sudo</span> <span class='id identifier rubyid_apt'>apt</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_gcc'>gcc</span> <span class='id identifier rubyid_make'>make</span> <span class='id identifier rubyid_ruby'>ruby</span><span class='op'>-</span><span class='id identifier rubyid_dev'>dev</span>
</code></pre>
<p>Then to actually install:</p>
<pre class="code ruby"><code class="ruby">gem install bundler --user-install
# may need to change the ruby version here if yours is different
~/.local/share/gem/ruby/3.0.0/bin/bundle install --path &quot;$HOME/.local/share/gem&quot;
</code></pre>
<p>This will update the Gemfile.lock as a side-effect.</p>
</div></div>
<div id="footer">
Generated on Fri Jan 23 21:38:00 2026 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.3.10).
</div>
</div>
</body>
</html>