Method: GrandCloud::Video#create

Defined in:
lib/grand_cloud/video.rb

#create(title, pass_encoding = false, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/grand_cloud/video.rb', line 23

def create title, pass_encoding=false, &block
  creation = Base.send_request({
    :method => 'post',
    :uri => '/video',
    :additional_params => {
      :Title => title,
      :BypassEncoding => pass_encoding
    }
  })
  creation.callback { block.call(JSON.parse(creation.response)) }

  creation.errback do 
    GrandCloud.logger.error("Error is: #{creation.error}, requesting error...")
    block.call(nil)
  end
end