Sha256: 5c1c594379d257aa6bab85219fbba3dd4e3bc29de696256432e6db017b7c142d

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module StreamElements
  class SongRequestsResource < Resource

    def playing(channel:)
      SongRequest.new get_request("songrequest/#{channel}/playing").body
    end

    def queue(channel:)
      response = get_request("songrequest/#{channel}/queue")
      Collection.from_response(response, type: SongRequest)
    end

    def history(channel:, **params)
      response = get_request("songrequest/#{channel}/history", params: params)
      Collection.from_response(response, type: SongRequest, name: "history")
    end

    def add(channel:, video:)
      SongRequest.new post_request("songrequest/#{channel}/queue", body: { video: video }).body
    end

    def pause(channel:)
      response = post_request("songrequest/#{channel}/player/pause", body: {})
      response.success?
    end

    def play(channel:)
      response = post_request("songrequest/#{channel}/player/play", body: {})
      response.success?
    end

    def volume(channel:, volume:)
      response = post_request("songrequest/#{channel}/player/volume", body: {volume: volume})
      response.success?
    end

    def skip(channel:)
      response = post_request("songrequest/#{channel}/skip", body: {})
      response.success?
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
streamelements-0.1.0 lib/stream_elements/resources/song_requests.rb