module Embedder

Constants

VERSION

Public Class Methods

parse(url) click to toggle source
# File lib/embedder.rb, line 5
def self.parse(url)
  connection.get("/1/oembed", {
    url: url,
    maxwidth: 500,
  }).body
end

Private Class Methods

connection() click to toggle source
# File lib/embedder.rb, line 14
def self.connection
  @connection ||= Faraday.new('http://api.embed.ly/') do |c|
    c.use FaradayMiddleware::ParseJson, content_type: 'application/json'
    c.params = {
      key: ENV['EMBEDLY_KEY'],
    }
    c.adapter Faraday.default_adapter
  end
end