Files
mc/site/sdks/ruby/ruby/index.html
T

214 lines
6.6 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ruby - Minio Client Documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="../../../css/highlight.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script type="text/javascript" src="../../../js/highlight.pack.js"></script>
<script src="../../../js/theme.js"></script>
<script src="../../../sdks/js/example-bucket-policy.js"></script>
<script src="../../../sdks/js/example-list.js"></script>
<style>
body {font-size: 90%;}
pre, code {font-size: 100%;}
h3, h4, h5, h6 {color: #2980b9; font-weight: 300}
</style>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="../../.." class="icon icon-home"> Minio Client Documentation</a>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<span>Commands</span>
<li class="toctree-l1 ">
<a class="" href="../../../commands/config">config</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../../commands/ls">ls</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../../commands/cp">cp</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../../commands/mb">mb</a>
</li>
<span>SDKs</span>
<li class="toctree-l1 ">
<a class="" href="../../js/javascript">Js</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../python/python">Python</a>
</li>
<li class="toctree-l1 current">
<a class="current" href=".">Ruby</a>
<ul>
<li class="toctree-l2"><a href="#using-aws-sdk-for-ruby-version-2">Using AWS SDK for Ruby - Version 2</a></li>
<li><a class="toctree-l3" href="#install">Install</a></li>
</ul>
</li>
<li class="toctree-l1 ">
<a class="" href="../../../contributing">Contributing</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../../debugging">Debugging</a>
</li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="icon icon-reorder"></i>
<a href="../../.."></a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../..">Docs</a> &raquo;</li>
<li>Ruby</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="using-aws-sdk-for-ruby-version-2">Using AWS SDK for Ruby - Version 2</h1>
<h2 id="install">Install</h2>
<h3 id="in-ruby-19">In Ruby 1.9</h3>
<pre><code>gem install aws-sdk
</code></pre>
<h3 id="example">Example</h3>
<p>Next, set up credentials (in e.g. <code>~/.aws/credentials</code>)::</p>
<pre><code>[default]
aws_access_key_id = YOUR_MINIO_ACCESS_ID
aws_secret_access_key = YOUR_MINIO_SECRET_KEY
</code></pre>
<pre><code>#!/usr/bin/env ruby
require 'aws-sdk'
s3 = Aws::S3::Client.new(endpoint: &quot;http://127.0.0.1:9000/&quot;,
require_https_for_sse_cpk: false,
region: &quot;minio&quot;)
resp = s3.list_buckets
resp.buckets.each do |bucket|
puts &quot;#{bucket.name} =&gt; #{bucket.creation_date}&quot;
end
</code></pre>
<h4 id="note">NOTE:</h4>
<p>ruby <code>aws-sdk</code> requires region name should be set, please use any name which
makes sense. Specifically for this example we choose <code>minio</code></p>
<p>Grab it here <a href="https://github.com/Minio-io/mc/blob/master/docs/sdks/ruby/example-list-buckets.rb">example-list-buckets.rb</a></p>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../../../contributing" class="btn btn-neutral float-right" title="Contributing"/>Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../../python/python" class="btn btn-neutral" title="Python"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
<!-- Copyright etc -->
</p>
</div>
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">
<span><a href="../../python/python" style="color: #fcfcfc;">&laquo; Previous</a></span>
<span style="margin-left: 15px"><a href="../../../contributing" style="color: #fcfcfc">Next &raquo;</a></span>
</span>
</div>
</body>
</html>