ruby_api_pack_cloudways is a Ruby gem for interacting with the Cloudways
API. It provides easy access to providers, server sizes, apps, and packages,
with built-in OAuth authentication for secure API requests.
Maintained by PHCDevworks. It is built on
ruby_api_pack_core, which supplies its shared HTTP client, response
validation, and configuration pattern.
| Field | Value |
|---|---|
| Project team | project-ruby |
| Repository role | Cloudways API client |
| Package/artifact | ruby_api_pack_cloudways |
| Current version/status | 0.4.0 |
- Read AGENTS.md, then the agent-specific guide for the task.
- Check TODO.md and ROADMAP.md for current scope.
- Make the smallest repo-local change that satisfies the task.
- Run
bundle exec rspec,bundle exec rubocop, andgem build ruby_api_pack_cloudways.gemspecwhen validation is required or practical. - Update docs and changelog history only when behavior, public contracts, or release-relevant metadata changed.
| Guide | Path |
|---|---|
| Agent rules | AGENTS.md |
| Claude Code | CLAUDE.md |
| Codex | CODEX.md |
| Copilot | COPILOT.md |
| Jules | JULES.md |
| Roadmap | ROADMAP.md |
| Todo | TODO.md |
| Changelog | CHANGELOG.md |
| Security | SECURITY.md |
| Code of Conduct | CODE_OF_CONDUCT.md |
| Contributing | CONTRIBUTING.md |
ruby_api_pack_cloudways is a Ruby gem for working with the Cloudways API from
Ruby and Rails applications. It centralizes Cloudways credentials, OAuth token
fetching, authenticated requests, response parsing, list endpoints, and server
operations behind a small service-style API.
Contributing | Code of Conduct | Changelog | Roadmap | Security Policy | AI Guide
The public behavior of this gem is defined by the configuration object, the Cloudways connection layer, API endpoint wrappers, response validation, and RSpec coverage. Keep those surfaces aligned whenever endpoint behavior changes.
| Layer | Path | Rule |
|---|---|---|
| Gem entry point | lib/ruby_api_pack_cloudways.rb |
Loads dependencies and exposes configuration |
| Configuration | lib/ruby_api_pack_cloudways/configuration.rb |
Owns Cloudways API URL, token path, email, and API key settings |
| Token handling | lib/ruby_api_pack_cloudways/connection/cw_token.rb |
Fetches and caches Cloudways OAuth access tokens |
| HTTP connection | lib/ruby_api_pack_cloudways/connection/cw_connect.rb |
Performs authenticated GET and POST requests |
| List endpoints | lib/ruby_api_pack_cloudways/api/cw_lists.rb |
Public list helpers for Cloudways metadata |
| Server endpoints | lib/ruby_api_pack_cloudways/api/cw_server.rb |
Public server-management helpers |
| Response validation | lib/ruby_api_pack_cloudways/handlers/response_validator.rb |
Normalizes expected list responses and logs validation failures |
| Specs | spec/ |
Contract and regression coverage for configuration, connection, handlers, and API wrappers |
After behavior changes, run:
bundle exec rspec
bundle exec rubocop
gem build ruby_api_pack_cloudways.gemspec- Cloudways API configuration for Ruby and Rails consumers
- OAuth token fetching and short-lived token caching
- Authenticated JSON GET and POST requests through HTTParty
- Cloudways list helpers for apps, providers, regions, packages, settings, and monitoring metadata
- Cloudways server helpers for listing, details, lifecycle actions, cloning, scaling, block storage, upgrades, and labels
- Response validation for list-style Cloudways responses
- Cloudways account setup, billing, provider availability, or API permissions
- Host application credential storage
- Host application authorization policy around server actions
- UI components, admin dashboards, or deployment workflows
- Long-running job orchestration around Cloudways operations
Add the gem to your application's Gemfile:
gem "ruby_api_pack_cloudways"Install dependencies:
bundle installOr install it directly:
gem install ruby_api_pack_cloudwaysConfigure the gem before making API calls. In Rails, this usually belongs in an
initializer such as config/initializers/ruby_api_pack_cloudways.rb.
RubyApiPackCloudways.configure do |config|
config.api_url = "https://api.cloudways.com/api/v1"
config.api_path_token = "/oauth/access_token"
config.api_email = ENV.fetch("CLOUDWAYS_API_EMAIL")
config.api_key = ENV.fetch("CLOUDWAYS_API_KEY")
endDo not commit real Cloudways API keys. Use Rails credentials, environment variables, or your deployment secret manager.
List helpers return arrays from Cloudways metadata endpoints.
providers = RubyApiPackCloudways::Api::CwLists.provider_list
sizes = RubyApiPackCloudways::Api::CwLists.server_size_list
apps = RubyApiPackCloudways::Api::CwLists.app_list
packages = RubyApiPackCloudways::Api::CwLists.package_list
regions = RubyApiPackCloudways::Api::CwLists.region_listAvailable list helpers:
| Method | Cloudways resource |
|---|---|
app_list |
Applications |
backup_frequency_list |
Backup frequencies |
country_list |
Countries |
monitor_duration_list |
Monitoring durations |
monitor_target_list |
Monitoring targets |
package_list |
Packages |
provider_list |
Providers |
region_list |
Regions |
server_size_list |
Server sizes |
setting_list |
Settings |
Server helpers call Cloudways server-management endpoints.
servers = RubyApiPackCloudways::Api::CwServer.server_list
details = RubyApiPackCloudways::Api::CwServer.server_details("123")
RubyApiPackCloudways::Api::CwServer.restart_server("123")
RubyApiPackCloudways::Api::CwServer.update_server_label("123", label: "Production")Available server helpers:
| Method | Purpose |
|---|---|
server_list |
List servers |
server_details(server_id) |
Fetch server details |
create_server(params) |
Create a server |
clone_server(server_id, params) |
Clone a server |
delete_server(server_id) |
Delete a server |
start_server(server_id) |
Start a server |
stop_server(server_id) |
Stop a server |
restart_server(server_id) |
Restart a server |
disk_usage(server_id) |
Fetch disk usage |
attach_block_storage(server_id, params) |
Attach block storage |
scale_block_storage(server_id, params) |
Scale block storage |
scale_volume_size(server_id, params) |
Scale volume size |
update_server_label(server_id, params) |
Update a server label |
upgrade_server(server_id, params) |
Upgrade a server |
Install dependencies:
bundle installRun the test suite:
bundle exec rspecRun style checks:
bundle exec rubocopBuild the gem locally:
gem build ruby_api_pack_cloudways.gemspecRSpec uses WebMock and VCR. Keep specs isolated from live Cloudways calls unless a maintainer explicitly asks for live API verification.
This repository uses the standardized PHCDevworks documentation model adapted
from phcdevworks/spectre-tokens and the Rails/Ruby guidance in
phcdevworks/phcdevworks_accounts_stytch:
AGENTS.mddefines shared AI boundaries.CLAUDE.md,CODEX.md,COPILOT.md, andJULES.mddefine agent-specific working rules..github/copilot-instructions.mdand.github/codex-instructions.mdprovide GitHub-integrated assistant guidance.CHANGELOG.md,ROADMAP.md, andTODO.mdkeep release and planning context visible.
See CONTRIBUTING.md for setup, coding standards, pull request expectations, and release hygiene.
Please do not report vulnerabilities through public issues. Follow SECURITY.md for responsible disclosure.
The gem is available as open source under the terms of the MIT License.