1
0
mirror of https://github.com/minio/mc.git synced 2025-11-14 23:42:27 +03:00

Merge pull request #43 from harshavardhana/pr_out_add_ruby_example

This commit is contained in:
Harshavardhana
2015-02-09 18:17:53 -08:00
4 changed files with 52 additions and 1 deletions

View File

@@ -32,3 +32,5 @@ s3.listBuckets(function(err, data) {
}
});
```
Grab it here (example-list-buckets.js)[https://github.com/Minio-io/mc/blob/master/docs/sdks/js/example-list-buckets.js]

View File

@@ -30,3 +30,5 @@ bucket1
bucket2
bucket3
```
Grab it here (example-list-buckets.py)[https://github.com/Minio-io/mc/blob/master/docs/sdks/python/example-list-buckets.py]

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env ruby
require 'aws-sdk'
s3 = Aws::S3::Client.new(endpoint: "http://127.0.0.1:9000/",
require_https_for_sse_cpk: false,
region: "minio")
resp = s3.list_buckets
resp.buckets.each do |bucket|
puts "#{bucket.name} => #{bucket.creation_date}"
end

37
docs/sdks/ruby/ruby.md Normal file
View File

@@ -0,0 +1,37 @@
# Using AWS SDK for Ruby - Version 2
## Install
### In Ruby 1.9
```
gem install aws-sdk
```
### Example
Next, set up credentials (in e.g. ``~/.aws/credentials``)::
[default]
aws_access_key_id = YOUR_MINIO_ACCESS_ID
aws_secret_access_key = YOUR_MINIO_SECRET_KEY
```
#!/usr/bin/env ruby
require 'aws-sdk'
s3 = Aws::S3::Client.new(endpoint: "http://127.0.0.1:9000/",
require_https_for_sse_cpk: false,
region: "minio")
resp = s3.list_buckets
resp.buckets.each do |bucket|
puts "#{bucket.name} => #{bucket.creation_date}"
end
```
NOTE:
ruby ``aws-sdk`` requires region name should be set, please use any name which
makes sense. Specifically for this example we choose ``minio``
Grab it here (example-list-buckets.rb)[https://github.com/Minio-io/mc/blob/master/docs/sdks/ruby/example-list-buckets.rb]