Sha256: 9b9359c98b191000747197b2eef9e98a62d11d11c8d11c8a4c143442f61c8610

Contents?: true

Size: 707 Bytes

Versions: 11

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

require 'oembed_proxy/first_party'
require 'oembed_proxy/utility'

module OembedProxy
  # Embedly provider
  class Embedly < FirstParty
    EMBEDLY_URL = 'https://api.embed.ly/1/oembed'

    def initialize(embedly_key)
      # Import the expected embed.ly providers.
      @pattern_hash = {}
      @embedly_key = embedly_key

      File.open(File.expand_path('../providers/embedly_patterns.def', __dir__), 'r') do |f|
        f.each do |line|
          regex = Utility.clean_pattern(line)
          @pattern_hash[regex] = EMBEDLY_URL
        end
      end
    end

    def get_data(url, other_params = {})
      other_params[:key] = @embedly_key
      super
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
oembed_proxy-0.3 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.6 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.5 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.4 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.3 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.2 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.1 lib/oembed_proxy/embedly.rb
oembed_proxy-0.2.0 lib/oembed_proxy/embedly.rb
oembed_proxy-0.1.4 lib/oembed_proxy/embedly.rb
oembed_proxy-0.1.3 lib/oembed_proxy/embedly.rb
oembed_proxy-0.1.2 lib/oembed_proxy/embedly.rb