class Embedda::Filters::Provider

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/embedda/filters/provider.rb, line 10
def initialize(options)
  @options = options
end

Public Instance Methods

get(filter_name) click to toggle source
# File lib/embedda/filters/provider.rb, line 14
def get(filter_name)
  case filter_name
  when :vimeo
    Vimeo.new(protocol, video_width, video_height, vimeo_params)
  when :youtube
    Youtube.new(protocol, video_width, video_height)
  when :soundcloud
    Soundcloud.new
  else
    raise UnknownFilter.new(filter_name)
  end
end

Private Instance Methods

protocol() click to toggle source
# File lib/embedda/filters/provider.rb, line 29
def protocol
  options[:ssl] ? 'https' : 'http'
end
video_height() click to toggle source
# File lib/embedda/filters/provider.rb, line 37
def video_height
  options.fetch(:video_height, 315)
end
video_width() click to toggle source
# File lib/embedda/filters/provider.rb, line 33
def video_width
  options.fetch(:video_width, 560)
end
vimeo_params() click to toggle source
# File lib/embedda/filters/provider.rb, line 41
def vimeo_params
  options.fetch(:vimeo_params, nil)
end