class OEmbed::Response

def self.create_for(raw, provider, url, format)

format that needs to be decoded.
which is data from the provider, about the url, in the given
Create a new Response instance of the correct type given raw
def self.create_for(raw, provider, url, format)
  fields = OEmbed::Formatter.decode(format, raw)
  resp_type = case fields['type']
    when 'photo' then OEmbed::Response::Photo
    when 'video' then OEmbed::Response::Video
    when 'link'  then OEmbed::Response::Link
    when 'rich'  then OEmbed::Response::Rich
    else              self
  end
  resp_type.new(fields, provider, url, format)
end