StreamElements
This is a Ruby library for the StreamElements API. Currently in development
Installation
Add this line to your application's Gemfile:
gem "streamelements"
Usage
Set Client Details
Firstly you'll need to the access token, which can be an oAuth Token or JWT.
@client = StreamElements::Client.new(access_token: "abc123")
Resources
The gem maps as closely as we can to the StreamElements API so you can easily convert API examples to gem code.
Responses are created as objects like StreamElements::Channel
. Having types like StreamElements::User
is handy for understanding what
type of object you're working with. They're built using OpenStruct so you can easily access data in a Ruby-ish way.
Channels
@client.channels.me
Users
@client.users.current
@client.users.channels
Activities
@client.activities.list(channel: "channel-id", after:, before:, limit:, types:)
@client.activities.top(channel: "channel-id", period:, offset:, limit:, type:)
Tips
@client.tips.list(channel: "channel-id", after: "2024-01-01", sort: "createdAt", limit: 10)
@client.tips.retrieve(channel: "channel-id", id: "tip-id")
@client.tips.top(channel: "channel-id")
Song Requests
@client.song_requests.playing(channel: "channel-id")
@client.song_requests.queue(channel: "channel-id")
@client.song_requests.add(channel: "channel-id", video: "video-id")
@client.song_requests.pause(channel: "channel-id")
@client.song_requests.play(channel: "channel-id")
@client.song_requests.volume(channel: "channel-id", volume: 50)
@client.song_requests.skip(channel: "channel-id")
@client.song_requests.settings(channel: "channel-id")
@client.song_requests.update_settings(channel: "channel-id", settings: { max_requests: 5 })
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/streamelements.
License
The gem is available as open source under the terms of the MIT License.