Class: Sproutvideo::LiveStream

Inherits:
Resource
  • Object
show all
Defined in:
lib/sproutvideo/live_stream.rb

Class Method Summary collapse

Methods inherited from Resource

api_key, base_url, delete, get, post, put, upload

Class Method Details

.create(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/sproutvideo/live_stream.rb', line 4

def self.create(options={})
  if options.include?(:custom_poster_frame)
    poster_frame = options.delete(:custom_poster_frame)
    upload("/live_streams", poster_frame, options, :custom_poster_frame)
  else
    post("/live_streams", options)
  end
end

.destroy(live_stream_id, options = {}) ⇒ Object



35
36
37
# File 'lib/sproutvideo/live_stream.rb', line 35

def self.destroy(live_stream_id, options={})
  delete("/live_streams/#{live_stream_id}", options)
end

.details(live_stream_id, options = {}) ⇒ Object



22
23
24
# File 'lib/sproutvideo/live_stream.rb', line 22

def self.details(live_stream_id, options={})
  get("/live_streams/#{live_stream_id}", options)
end

.end_stream(live_stream_id, options = {}) ⇒ Object



39
40
41
# File 'lib/sproutvideo/live_stream.rb', line 39

def self.end_stream(live_stream_id, options={})
  put("/live_streams/#{live_stream_id}/end_stream", options)
end

.list(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/sproutvideo/live_stream.rb', line 13

def self.list(options={})
  params = {
    :page => options.delete(:page) || 1,
    :per_page => options.delete(:per_page) || 25
  }
  params = params.merge(options)
  get("/live_streams", params)
end

.update(live_stream_id, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/sproutvideo/live_stream.rb', line 26

def self.update(live_stream_id, options={})
  if options.include?(:custom_poster_frame)
    poster_frame = options.delete(:custom_poster_frame)
    upload("/live_streams/#{live_stream_id}", poster_frame, options.merge({method: :PUT}), :custom_poster_frame)
  else
    put("/live_streams/#{live_stream_id}", options)
  end
end