Class: Resizing::Rails::VideosController

Inherits:
ApplicationController show all
Defined in:
app/controllers/resizing/rails/videos_controller.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



18
19
20
# File 'app/controllers/resizing/rails/videos_controller.rb', line 18

def client
  @client ||= Resizing::Video::Client.new
end

#indexObject



7
8
9
10
# File 'app/controllers/resizing/rails/videos_controller.rb', line 7

def index
  @videos = Resizing::Rails::Video.order('created_at desc').page(params[:page]).per(20)
  render text: 'index'
end

#prepareObject



12
13
14
15
16
# File 'app/controllers/resizing/rails/videos_controller.rb', line 12

def prepare
  response = client.prepare
  video = Resizing::Rails::Video.create!(data: response)
  render json: video
end

#showObject



22
23
24
# File 'app/controllers/resizing/rails/videos_controller.rb', line 22

def show
  @video = Resizing::Rails::Video.find(params[:id])
end