Install the SDK Package
Updated at:2025-11-03
Runtime environment
The Ruby SDK requires Ruby version 2.0 or higher to operate.
Install SDK
Method I: Install via gem
gem install baidubce-sdk
Method II: Install via bundler
- First, confirm that the bundle is installed. The installation command is:
gem install bundler - Add
gem 'baidubce-sdk', '~> 0.9.0'in Gemfile of your application, and runbundle install
Note:After installing the gem, users can enter the Ruby interactive command line by typing irb, then input
require 'baidubce/services/bos/bos_client'. If "true” is displayed, the SDK has been successfully installed.github source code link
SDK directory structure
Plain Text
1│──baidubce-sdk.gemspec //Dependent third-party gem
2├──lib
3│ └── baidubce
4 │ ├── auth //BCE signature
5 │ ├── http //BCE HTTP communication
6│ ├── services
7 │ │ └── bos // BOS main directory
8 │ │ ├── bos_client.rb //BOS operation class. All operations can be completed via BosClient class
9 │ │ ├── bos_constants.rb //BOS constant
10 │ │ └── sts //STS main directory
11 │ │ ├── sts_client.rb //STS operation class
12 │ ├── exception.rb //BCE client exception
13 │ ├── retry_policy.rb //BCE client retry mechanism
14 │ ├── bce_base_client.rb //BCE public client
15 │ └── utils //BCE common utilities
16 └──samples //Usage example
Uninstall SDK
When uninstalling the SDK, execute gem uninstall baidubce-sdk, and then delete the require and include statements in the script.
