module Videos

lib/chili_player/videos.rb

Public Instance Methods

delete(video_id) click to toggle source
# File lib/chili_player/videos.rb, line 26
def delete(video_id)
  JSON.parse RestClient.delete(endpoint_url + video_id.to_s, header_request)
end
update(video_id, options) click to toggle source
# File lib/chili_player/videos.rb, line 21
def update(video_id, options)
  JSON.parse RestClient.patch(endpoint_url + video_id.to_s, params(options),
                              header_request)
end
upload(name, video, options = {}) click to toggle source
# File lib/chili_player/videos.rb, line 16
def upload(name, video, options = {})
  JSON.parse RestClient.post(endpoint_url, params(options, name, video),
                             header_request)
end
video(video_id) click to toggle source
# File lib/chili_player/videos.rb, line 12
def video(video_id)
  JSON.parse RestClient.get(endpoint_url + video_id.to_s, header_request)
end
videos() click to toggle source
# File lib/chili_player/videos.rb, line 8
def videos
  JSON.parse RestClient.get(endpoint_url, header_request)
end

Private Instance Methods

params(options, name = nil, video = nil) click to toggle source
# File lib/chili_player/videos.rb, line 32
def params(options, name = nil, video = nil)
  data = { video: {} }
  options.delete(:data)
  data[:video].merge!(options)
  data[:video][:name] = name unless name.nil?
  data[:video][:data] = File.new(video, 'rb') unless video.nil?
  data
end