2011-04-28 4 views
0

나는 내 레일 앱에서 ruby-1.8.7 및 rails 2.3.5를 사용하고 있습니다. 사용자가 youtube_it 보석을 사용중인 YouTube에 자신의 동영상을 업로드 할 수 있도록하는 요구 사항이 있습니다. 하지만 내가 문서화를 제대로 따르고 있는지 확실하지 않습니다.youtube_it gem in rails app

여기 내 컨트롤러 코드입니다 :

class VideosController < ApplicationController 

    def upload 
    @upload_info = YouTubeIt::Client.new.upload_token(params, videos_url) 
# params represent what values here, the doc says title, description but do i have to #build another form to get these values, i really need a working example. 
    end 

여기 내 양식이다 :

<% form_tag @upload_info[:url], :multipart => true do %> 
    <%= hidden_field_tag :token, @upload_info[:token] %> 
    <%= label_tag :file %> 
    <%= file_field_tag :file %> 
    <%= submit_tag "Upload video" %> 
    <% end %> 

내 다른 질문은 어디에서 나를 위해 새로운 클라이언트를 초기화합니다 다음 문을 지정하기로하고 있습니다 :

client = YouTubeIt::Client.new(:dev_key => "developer_key") 

여기에 도움이 필요합니다.

답변

0

당신이

컨트롤러 및 호출이를 보내 바로 비디오 예를 들어

1 단계) 제목과 설명을 요청주고 제목과 설명을위한 첫 번째 단계가 누락 가까운 방법

@upload_info = YouTubeIt::Client.new.upload_token(params[:first_step], videos_url) 

및이 두 번째 단계를

로 호출해야

2 단계) 당신이

<% form_tag @upload_info[:url], :multipart => true do %> 
    <%= hidden_field_tag :token, @upload_info[:token] %> 
    <%= label_tag :file %> 
    <%= file_field_tag :file %> 
    <%= submit_tag "Upload video" %> 
<% end %> 

했다 않는 형태는 당신이 당신의 application_controller에서 클라이언트를 초기화 할 수 있습니다 마지막 질문에 대한 실제 예를

https://gist.github.com/1051122

당신에게 요점을 줄 것이다. rb, 당신은 요점에서 그것을 볼 수 있습니다

나는 그것이 당신을 도울 희망, 행운을 빌어 요! 여기