class FacebookAds::HTTPService::VideoRequest

Public Instance Methods

body_has_video?(body) click to toggle source
# File lib/facebook_ads/videos/video_request.rb, line 31
def body_has_video?(body)
  if body.respond_to?(:each) && !body.is_a?(String)
    (body.respond_to?(:values) ? body.values : body).any? do |val|
      val.is_a?(FacebookAds::VideoIO)
    end
  else
    false
  end
end
call(env) click to toggle source
# File lib/facebook_ads/videos/video_request.rb, line 24
def call(env)
  if env.body && body_has_video?(env.body)
    env.url.host = env.url.host.gsub(/^graph/, 'graph-video')
  end
  @app.call env
end