0.0
The project is in a healthy, maintained state
Official ActivitySmith Ruby SDK
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 5.0
>= 13.0

Runtime

>= 2.3
>= 1.0
 Project Readme

ActivitySmith Ruby SDK

The ActivitySmith Ruby SDK provides convenient access to the ActivitySmith API from Ruby applications.

Documentation

See API reference.

Installation

gem install activitysmith

Setup

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_notified

Start 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_id

Update 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_notified

End 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.success

Error Handling

begin
  activitysmith.notifications.send(
    { title: "Build Failed" }
  )
rescue OpenapiClient::ApiError => err
  puts "Request failed: #{err.code} #{err.message}"
end

API Surface

  • activitysmith.notifications
  • activitysmith.live_activities

Requirements

  • Ruby 3.0+

License

MIT