Class: Lumiere::Provider

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

Direct Known Subclasses

Dailymotion, Vimeo, VimeoPlaylist, YouTube, YouTubePlaylist

Constant Summary collapse

PROVIDERS =
%w(YouTubePlaylist VimeoPlaylist YouTube Vimeo Dailymotion)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.delegate(url) ⇒ Object

Raises:

  • (NotImplementedError)


10
11
12
13
14
15
16
17
18
19
# File 'lib/provider.rb', line 10

def self.delegate(url)
  PROVIDERS.each do |provider|
    provider_class = Object.const_get("Lumiere").const_get(provider)
    if provider_class.useable?(url)
      return provider_class.new(url)
    end
  end

  raise NotImplementedError
end

.useable?(url) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'lib/provider.rb', line 21

def self.useable?(url)
  delegate(url)
  true
rescue NotImplementedError
  false
end

Instance Method Details

#==(other) ⇒ Object



88
89
90
91
92
# File 'lib/provider.rb', line 88

def ==(other)
  if other.respond_to?(:video_id)
    video_id == other.video_id
  end
end

#accessible?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/provider.rb', line 84

def accessible?
  response.is_a?(Net::HTTPSuccess)
end

#api_urlObject

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/provider.rb', line 36

def api_url
  raise NotImplementedError
end

#descriptionObject

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/provider.rb', line 56

def description
  raise NotImplementedError
end

#durationObject

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/provider.rb', line 60

def duration
  raise NotImplementedError
end

#embed_codeObject

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/provider.rb', line 44

def embed_code
  raise NotImplementedError
end

#embed_urlObject

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/provider.rb', line 40

def embed_url
  raise NotImplementedError
end

#playlist_idObject

Raises:

  • (NotImplementedError)


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

def playlist_id
  raise NotImplementedError
end

#providerObject

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/provider.rb', line 48

def provider
  raise NotImplementedError
end

#thumbnail_largeObject

Raises:

  • (NotImplementedError)


76
77
78
# File 'lib/provider.rb', line 76

def thumbnail_large
  raise NotImplementedError
end

#thumbnail_mediumObject

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/provider.rb', line 72

def thumbnail_medium
  raise NotImplementedError
end

#thumbnail_smallObject

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/provider.rb', line 68

def thumbnail_small
  raise NotImplementedError
end

#titleObject

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/provider.rb', line 52

def title
  raise NotImplementedError
end

#upload_dateObject

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/provider.rb', line 64

def upload_date
  raise NotImplementedError
end

#video_idObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/provider.rb', line 28

def video_id
  raise NotImplementedError
end

#videosObject

Raises:

  • (NotImplementedError)


80
81
82
# File 'lib/provider.rb', line 80

def videos
  raise NotImplementedError
end