{"id":28379181,"url":"https://github.com/qingstor/qingstor-sdk-ruby","last_synced_at":"2025-09-02T11:40:28.755Z","repository":{"id":43003819,"uuid":"75469417","full_name":"qingstor/qingstor-sdk-ruby","owner":"qingstor","description":"The official QingStor SDK for Ruby programming language.","archived":false,"fork":false,"pushed_at":"2024-01-10T14:30:28.000Z","size":167,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-14T02:49:24.402Z","etag":null,"topics":["qingstor","qingstor-sdk","ruby","sdk"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qingstor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-03T11:22:48.000Z","updated_at":"2024-01-19T04:44:20.000Z","dependencies_parsed_at":"2022-09-02T17:09:08.347Z","dependency_job_id":null,"html_url":"https://github.com/qingstor/qingstor-sdk-ruby","commit_stats":null,"previous_names":["yunify/qingstor-sdk-ruby"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/qingstor/qingstor-sdk-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingstor%2Fqingstor-sdk-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingstor%2Fqingstor-sdk-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingstor%2Fqingstor-sdk-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingstor%2Fqingstor-sdk-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qingstor","download_url":"https://codeload.github.com/qingstor/qingstor-sdk-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qingstor%2Fqingstor-sdk-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259751313,"owners_count":22905949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qingstor","qingstor-sdk","ruby","sdk"],"created_at":"2025-05-30T02:30:24.392Z","updated_at":"2025-09-02T11:40:28.745Z","avatar_url":"https://github.com/qingstor.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QingStor::SDK\n\n[![Build Status](https://github.com/qingstor/qingstor-sdk-ruby/workflows/Unit%20Test/badge.svg?branch=master)](https://github.com/qingstor/qingstor-sdk-ruby/actions?query=workflow%3A%22Unit+Test%22)\n[![Gem Version](https://badge.fury.io/rb/qingstor-sdk.svg)](http://badge.fury.io/rb/qingstor-sdk)\n[![API Reference](http://img.shields.io/badge/api-reference-green.svg)](https://docsv4.qingcloud.com/user_guide/storage/object_storage/)\n[![License](http://img.shields.io/badge/license-apache%20v2-blue.svg)](https://github.com/yunify/qingstor-sdk-ruby/blob/master/LICENSE)\n[![Join the chat](https://img.shields.io/badge/chat-online-blue?style=flat\u0026logo=zulip)](https://qingstor.zulipchat.com/join/odapi42t7xhqc7v4gb2wfgjx/)\n\nThe official QingStor SDK for Ruby programming language.\n\n## Installation\n\nThis Gem uses Ruby's _keyword arguments_ feature, thus Ruby v2.1.5 or higher is\nrequired.  See [this article](https://robots.thoughtbot.com/ruby-2-keyword-arguments)\nfor more details about _keyword arguments_.\n\n_Notice:_ As of sdk v2.4, we no longer support Ruby 2.4 and earlier versions since Ruby 2.4 has been marked as EOL. \nIf you are still using Ruby 2.4 and earlier, you may not be able to use some new features of our sdk, \nso please upgrade your version of Ruby as soon as possible.\n\n### Install from RubyGems\n\n``` bash\n$ gem install qingstor-sdk\n```\n\n### Install with Bundler\n\nSpecify `qingstor-sdk` as dependency in your application's Gemfile:\n\n``` ruby\ngem 'qingstor-sdk'\n```\n\nEnsure `qingstor-sdk` is installed as dependency with `bundle install`:\n\n``` bash\n$ bundle install\n```\n\n### Install from Source Code\n\nGet code from GitHub:\n\n``` bash\n$ git clone git@github.com:yunify/qingstor-sdk-ruby.git\n```\n\nBuild and install with bundler:\n\n``` bash\n$ cd qingstor-sdk-ruby\n$ bundle install\n$ bundle exec rake install\n```\n\n### Uninstall\n\n``` bash\n$ gem uninstall qingstor-sdk\n```\n\n## Usage\n\nBefore using the SDK, please make sure you already have QingCloud API access key,\napply one from [QingCloud Console](https://console.qingcloud.com/access_keys/)\notherwise.\n\n___API Access Key Example:___\n\n``` yaml\naccess_key_id: 'ACCESS_KEY_ID_EXAMPLE'\nsecret_access_key: 'SECRET_ACCESS_KEY_EXAMPLE'\n```\n\n### Code Example\n\n```ruby\nrequire 'qingstor/sdk'\nrequire 'digest/md5'\n\n# Create a config object with access_key_id and secret_access_key defined as\n# environment variables.\nconfig = QingStor::SDK::Config.init ENV['ENV_ACCESS_KEY_ID'],\n                                    ENV['ENV_SECRET_ACCESS_KEY']\n\n# Initialize QingStor service with the config object.\nqs_service = QingStor::SDK::Service.new config\n\n# List buckets\nresult = qs_service.list_buckets\n# Print HTTP status code\nputs result[:status_code]\n# Print bucket count\nputs result[:buckets].length\n# Print the first bucket name\nputs result[:buckets][0][:name]\n\n# Initialize a QingStor bucket\nbucket = qs_service.bucket 'test-bucket', 'pek3a'\n\n# List objects\nresult = bucket.list_objects\n# Print HTTP status code\nputs result[:status_code]\n# Print keys count\nputs result[:keys].length\n\n\n# Upload an object\nfile_path = File.expand_path '~/Desktop/Screenshot.jpg'\nmd5_string = Digest::MD5.file(file_path).to_s\nresult = bucket.put_object 'Screenshot.jpg',\n                           content_md5: md5_string,\n                           body:        File.open(file_path)\n# Print HTTP status code.\nputs result[:status_code]\n```\n\n### More Configuration\n\nExcept access_key_id and secret_access_key, you can also configure the API\nserver (in case of QingStor is deployed in private environment, thus has\ndifferent endpoint with public QingStor) either in the config file, or in\nthe program dynamically.\n\n**Notice:** config will not be checked available when `new`, `load` and `update`, \nwhich will be done right before initializing `service` or `bucket`. \nIf you need to check config, you should call `config.check` whenever you want.\nIf `check` failed, a `ConfigurationError` will be raised.\n\n___Code Example:___\n\n``` ruby\nrequire 'qingstor/sdk'\n\n# Load default configuration\nconfig = QingStor::SDK::Config.new.load_default_config\n\n# Create with default value\n# priority from high to low: param \u003e env \u003e user config \u003e default config\nconfig = QingStor::SDK::Config.new({\n  host:      'qingstor.dev',\n  log_level: 'debug',\n})\n\n# Create a configuration from AccessKeyID and SecretAccessKey\nconfig = QingStor::SDK::Config.init ENV['ENV_ACCESS_KEY_ID'],\n                                    ENV['ENV_SECRET_ACCESS_KEY']\n\n# Load configuration from config file\nconfig = QingStor::SDK::Config.new\nconfig = config.load_config_from_file '~/qingstor/config.yaml'\n\n# Load configuration from env variable:\n# QINGSTOR_ACCESS_KEY_ID for access_key_id\n# QINGSTOR_SECRET_ACCESS_KEY for secret_access_key\n# QINGSTOR_ENABLE_VIRTUAL_HOST_STYLE for enable_virtual_host_style\n# QINGSTOR_ENDPOINT for endpoint\nconfig = QingStor::SDK::Config.new.load_env_config\n\n# Change API server\nconfig.update({host: 'test.qingstor.com'})\n```\n\n___Default Configuration File:___\n\n``` yaml\n# QingStor services configuration\n\naccess_key_id: 'ACCESS_KEY_ID'\nsecret_access_key: 'SECRET_ACCESS_KEY'\n\nhost: 'qingstor.com'\nport: 443\nprotocol: 'https'\n# or set endpoint directly\n# endpoint: https://qingstor.com:443\n\nconnection_retries: 3\n\n# Additional User-Agent\nadditional_user_agent: \"\"\n\n# Valid log levels are \"debug\", \"info\", \"warn\", \"error\", and \"fatal\".\nlog_level: warn\n\n# SDK will use virtual host style for all API calls if enabled\nenable_virtual_host_style: false\n```\n\n## Change Log\nAll notable changes to QingStor SDK for Ruby will be documented here.\n\n### [v2.5.0] - 2021-02-09\n\n### Added\n\n- config: Add env variable support (#52)\n- signer: Add support for anonymous API call (#53)\n- config: Add support for endpoint (#55)\n- config: Add support for enable_vhost_style (#56)\n\n### Changed\n\n- Request: Modify Metadata in header to apply rfc 02 (#49)\n- config: Refactor config check (#54)\n\n### [v2.4.0] - 2021-01-05\n\n### Added\n\n- Support to set x-qs-metadata-directive header (#29)\n- Add support for bucket replication (#45)\n\n### Changed\n\n- ci: Transfer ci into github action (#30)\n\n### Fixed\n\n- Fix metadata added into signature when empty (#44)\n\n### [v2.3.0] - 2020-05-11\n\n### Added\n\n- Add support for lifecycle and notification.\n- Add support for bucket logging, bucket cname and append object. (#24)\n\n### Fixed\n\n- Modify content-type check for application/json. (#21)\n- Fix sub-resources not be recognized when generate signature. (#25)\n- Fix meta data not work as intended. (#26)\n- Reverse fix of empty map in template, should not compact empty hash when sign. (#28)\n\n### [v2.2.3] - 2017-03-28\n\n### Fixed\n\n- Fix status code of DELETE CORS API.\n\n### [v2.2.2] - 2017-03-10\n\n### Fixed\n\n- Resource is not mandatory in bucket policy statement.\n\n### [v2.2.1] - 2017-03-10\n\n#### Added\n\n- Allow user to append additional info to User-Agent.\n\n### [v2.2.0] - 2017-02-28\n\n#### Added\n\n- Add ListMultipartUploads API.\n\n#### Fixed\n\n- Fix request builder \u0026 signer.\n\n### [v2.1.1] - 2017-01-16\n\n#### Fixed\n\n- Fix signer bug.\n\n### [v2.1.0] - 2016-12-24\n\n#### Changed\n\n- Fix signer bug.\n- Add more parameters to sign.\n\n#### Added\n\n- Add request parameters for GET Object.\n- Add IP address conditions for bucket policy.\n\n### [v2.0.1] - 2016-12-16\n\n#### Changed\n\n- Improve the implementation of deleting multiple objects.\n\n### v2.0.0 - 2016-12-14\n\n#### Added\n\n- QingStor SDK for the Ruby programming language.\n\n## Reference Documentations\n\n- [QingStor Documentation](https://docsv4.qingcloud.com/user_guide/storage/object_storage/intro/product/)\n- [QingStor Guide](https://docsv4.qingcloud.com/user_guide/storage/object_storage/)\n- [QingStor APIs](https://docsv4.qingcloud.com/user_guide/storage/object_storage/api/)\n\n## Contributing\n\n1. Fork it ( https://github.com/yunify/qingstor-sdk-ruby/fork )\n2. Create your feature branch (`git checkout -b new-feature`)\n3. Commit your changes (`git commit -asm 'Add some feature'`)\n4. Push to the branch (`git push origin new-feature`)\n5. Create a new Pull Request\n\n## LICENSE\n\nThe Apache License (Version 2.0, January 2004).\n\n[compatible]: https://github.com/yunify/qingstor-sdk-ruby/tree/compatible\n[v2.5.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.4.0...v2.5.0\n[v2.4.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.3.0...v2.4.0\n[v2.3.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.2.3...v2.3.0\n[v2.2.3]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.2.2...v2.2.3\n[v2.2.2]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.2.1...v2.2.2\n[v2.2.1]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.2.0...v2.2.1\n[v2.2.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.1.1...v2.2.0\n[v2.1.1]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.1.0...v2.1.1\n[v2.1.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.0.1...v2.1.0\n[v2.0.1]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.0.0...v2.0.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqingstor%2Fqingstor-sdk-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqingstor%2Fqingstor-sdk-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqingstor%2Fqingstor-sdk-ruby/lists"}