ActivitySmith Ruby SDK
The ActivitySmith Ruby SDK provides convenient access to the ActivitySmith API from Ruby applications.
Documentation
See API reference.
Installation
gem install activitysmithSetup
require "activitysmith"
activitysmith = ActivitySmith::Client.new(api_key: ENV.fetch("ACTIVITYSMITH_API_KEY"))Usage
Send a Push Notification
response = activitysmith.notifications.send(
{
title: "Build Failed",
message: "CI pipeline failed on main branch"
}
)
puts response.success
puts response.devices_notifiedStart a Live Activity
start = activitysmith.live_activities.start(
{
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "start",
number_of_steps: 4,
current_step: 1,
type: "segmented_progress",
color: "yellow"
}
}
)
activity_id = start.activity_idUpdate a Live Activity
update = activitysmith.live_activities.update(
{
activity_id: activity_id,
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "npm i & pm2",
current_step: 3
}
}
)
puts update.devices_notifiedEnd a Live Activity
finish = activitysmith.live_activities.end(
{
activity_id: activity_id,
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "done",
current_step: 4,
auto_dismiss_minutes: 3
}
}
)
puts finish.successError Handling
begin
activitysmith.notifications.send(
{ title: "Build Failed" }
)
rescue OpenapiClient::ApiError => err
puts "Request failed: #{err.code} #{err.message}"
endAPI Surface
activitysmith.notificationsactivitysmith.live_activities
Requirements
- Ruby 3.0+
License
MIT