Class: Embedly::Oembed

Inherits:
Object
  • Object
show all
Defined in:
lib/embedly/oembed.rb

Constant Summary collapse

ENDPOINT_URL =
'/1/oembed'
ATTRIBUTES =
[
  :provider_url,
  :description,
  :title,
  :author_name,
  :height,
  :width,
  :html,
  :thumbnail_width,
  :version,
  :provider_name,
  :thumbnail_url,
  :type,
  :thumbnail_height,
  :author_url
]

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Oembed

Returns a new instance of Oembed.



34
35
36
# File 'lib/embedly/oembed.rb', line 34

def initialize(options)
  @options = options
end

Class Attribute Details

.keyObject

Returns the value of attribute key.



29
30
31
# File 'lib/embedly/oembed.rb', line 29

def key
  @key
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



32
33
34
# File 'lib/embedly/oembed.rb', line 32

def options
  @options
end

#requestObject

Returns the value of attribute request.



32
33
34
# File 'lib/embedly/oembed.rb', line 32

def request
  @request
end

Instance Method Details

#configurationObject



66
67
68
# File 'lib/embedly/oembed.rb', line 66

def configuration
  Embedly.configuration
end

#connectionObject



58
59
60
61
62
63
64
# File 'lib/embedly/oembed.rb', line 58

def connection
  Faraday.new API_URL do |builder|
    builder.use Faraday::Response::Mashify
    builder.use Faraday::Response::ParseJson
    builder.adapter :net_http
  end
end

#urlObject



42
43
44
# File 'lib/embedly/oembed.rb', line 42

def url
  options[:url]
end

#video?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/embedly/oembed.rb', line 38

def video?
  true
end