Class: OembedProxy::Embedly

Inherits:
FirstParty show all
Defined in:
lib/oembed_proxy/embedly.rb

Overview

Embedly provider

Constant Summary collapse

EMBEDLY_URL =
'https://api.embed.ly/1/oembed'

Constants inherited from FirstParty

FirstParty::USER_AGENT

Instance Method Summary collapse

Methods inherited from FirstParty

#handles_url?

Constructor Details

#initialize(embedly_key) ⇒ Embedly

Returns a new instance of Embedly.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/oembed_proxy/embedly.rb', line 11

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

Instance Method Details

#get_data(url, other_params = {}) ⇒ Object



24
25
26
27
# File 'lib/oembed_proxy/embedly.rb', line 24

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