Sha256: 7a4642794ec35e2ed3437ea09e028f633ef06a4316833287339e1605a5bbbf39

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 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 settings(channel:)
      get_request("songrequest/#{channel}/settings").body
    end

    def update_settings(channel:, settings:)
      response = put_request("songrequest/#{channel}/settings", body: settings)
      response.success?
    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.5.0 lib/stream_elements/resources/song_requests.rb