StarDots-SDK-Ruby
Introduction
This project is used to help developers quickly access the StarDots platform and is written in Ruby.
Requirement
- Ruby version >= 2.6.0
Installation
# Install from RubyGems
gem install stardots-sdk-ruby
# Or add to your Gemfile
gem 'stardots-sdk-ruby'
# Or install from source
git clone https://github.com/stardots-io/stardots-sdk-ruby.git
cd stardots-sdk-ruby
bundle install
Quick Start
require 'stardots_sdk'
# Initialize the client
client_key = "Your client key"
client_secret = "Your client secret"
client = StardotsSdk::Client.new(client_key, client_secret)
# Get space list
space_list = client.get_space_list
# Create a new space
create_params = StardotsSdk::CreateSpaceReq.new(space: "my-space", public: true)
create_result = client.create_space(create_params)
# Upload a file
upload_params = StardotsSdk::UploadFileReq.new(
filename: "example.txt",
space: "my-space",
file_content: "Hello, StarDots!"
)
upload_result = client.upload_file(upload_params)
Examples
See the examples directory for more detailed usage examples:
- Basic Usage - Complete example showing all API operations
API Reference
-
StardotsSdk::Client.new(client_key, client_secret, endpoint = nil)
- Create a new client instance -
client.get_space_list(params = SpaceListReq.new)
- Get space list -
client.create_space(params)
- Create a new space -
client.delete_space(params)
- Delete an existing space -
client.toggle_space_accessibility(params)
- Toggle space accessibility -
client.get_space_file_list(params)
- Get space file list -
client.file_access_ticket(params)
- Get file access ticket -
client.upload_file(params)
- Upload file to space -
client.delete_file(params)
- Delete files from space
Request/Response Types
-
SpaceListReq
/SpaceListResp
- Space list operations -
CreateSpaceReq
/CreateSpaceResp
- Space creation -
DeleteSpaceReq
/DeleteSpaceResp
- Space deletion -
ToggleSpaceAccessibilityReq
/ToggleSpaceAccessibilityResp
- Space accessibility toggle -
SpaceFileListReq
/SpaceFileListResp
- File list operations -
FileAccessTicketReq
/FileAccessTicketResp
- File access ticket -
UploadFileReq
/UploadFileResp
- File upload -
DeleteFileReq
/DeleteFileResp
- File deletion
Development
# Install dependencies
bundle install
# Run tests
bundle exec rspec
# Run linting
bundle exec rubocop
# Build gem
gem build stardots-sdk-ruby.gemspec
Documentation
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.