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)


16
17
18
19
20
21
22
23
24
25
# File 'lib/provider.rb', line 16

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)


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

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

Instance Method Details

#==(other) ⇒ Object



94
95
96
97
98
# File 'lib/provider.rb', line 94

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

#accessible?Boolean

Returns:

  • (Boolean)


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

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

#api_urlObject

Raises:

  • (NotImplementedError)


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

def api_url
  raise NotImplementedError
end

#descriptionObject

Raises:

  • (NotImplementedError)


62
63
64
# File 'lib/provider.rb', line 62

def description
  raise NotImplementedError
end

#durationObject

Raises:

  • (NotImplementedError)


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

def duration
  raise NotImplementedError
end

#embed_codeObject

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/provider.rb', line 50

def embed_code
  raise NotImplementedError
end

#embed_urlObject

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/provider.rb', line 46

def embed_url
  raise NotImplementedError
end

#playlist_idObject

Raises:

  • (NotImplementedError)


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

def playlist_id
  raise NotImplementedError
end

#providerObject

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/provider.rb', line 54

def provider
  raise NotImplementedError
end

#thumbnail_largeObject

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/provider.rb', line 82

def thumbnail_large
  raise NotImplementedError
end

#thumbnail_mediumObject

Raises:

  • (NotImplementedError)


78
79
80
# File 'lib/provider.rb', line 78

def thumbnail_medium
  raise NotImplementedError
end

#thumbnail_smallObject

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/provider.rb', line 74

def thumbnail_small
  raise NotImplementedError
end

#titleObject

Raises:

  • (NotImplementedError)


58
59
60
# File 'lib/provider.rb', line 58

def title
  raise NotImplementedError
end

#upload_dateObject

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/provider.rb', line 70

def upload_date
  raise NotImplementedError
end

#video_idObject

Raises:

  • (NotImplementedError)


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

def video_id
  raise NotImplementedError
end

#videosObject

Raises:

  • (NotImplementedError)


86
87
88
# File 'lib/provider.rb', line 86

def videos
  raise NotImplementedError
end