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:
@@ -31,4 +31,6 @@ s3.listBuckets(function(err, data) {
|
||||
console.log(data); // successful response
|
||||
}
|
||||
});
|
||||
```
|
||||
```
|
||||
|
||||
Grab it here (example-list-buckets.js)[https://github.com/Minio-io/mc/blob/master/docs/sdks/js/example-list-buckets.js]
|
||||
@@ -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]
|
||||
10
docs/sdks/ruby/example-list-buckets.rb
Normal file
10
docs/sdks/ruby/example-list-buckets.rb
Normal 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
37
docs/sdks/ruby/ruby.md
Normal 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]
|
||||
Reference in New Issue
Block a user