Installation
To install the ActivitySmith Ruby SDK, you can use RubyGems:Ruby
Usage
- Create an API key
- Set the API key as an environment variable named
ACTIVITYSMITH_API_KEYor pass it directly toActivitySmith::Client.
Ruby
Send a Push Notification
Useactivitysmith.notifications.send with a push payload. title is required; message and subtitle are optional.
Ruby
Start a Live Activity
Start a Live Activity withactivitysmith.live_activities.start.
For segmented_progress, send number_of_steps, current_step, and type.
For progress, send type: "progress" with percentage or value plus upper_limit.
Ruby
Ruby
Update a Live Activity
Update a Live Activity withactivitysmith.live_activities.update using the activity_id.
For progress updates, send percentage or value plus upper_limit instead of current_step.
Ruby
Ruby
End a Live Activity
End a Live Activity withactivitysmith.live_activities.end. You can optionally set auto_dismiss_minutes in the content_state.
Ruby
Ruby
Channels
You can target specific channels when sending a push or starting a Live Activity.Ruby
Error Handling
Handle API errors withbegin/rescue around SDK calls:
Ruby