Module: Oembed::Client

Defined in:
lib/oembed/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#httpObject



14
15
16
# File 'lib/oembed/client.rb', line 14

def http
  @http ||= Oembed::Http.new
end

Instance Method Details

#endpoint_uriObject

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/oembed/client.rb', line 10

def endpoint_uri
  raise NotImplementedError
end

#fetch(resource_uri, params = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/oembed/client.rb', line 18

def fetch(resource_uri, params = {})
  begin
    fetch!(resource_uri, params)
  rescue Oembed::Error
    nil
  end
end

#fetch!(resource_uri, params = {}) ⇒ Object



26
27
28
29
# File 'lib/oembed/client.rb', line 26

def fetch!(resource_uri, params = {})
  uri = Oembed::Uri.new(endpoint_uri, resource_uri, params)
  http.get(uri.to_s)
end