Class: FilmSnob::VideoSite
- Inherits:
-
Object
- Object
- FilmSnob::VideoSite
show all
- Defined in:
- lib/film_snob/video_site.rb
Overview
TODO(2015-11-15): rename to something more general we’re using this for things like Instagram
Constant Summary
collapse
- SUBCLASSES =
[]
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(url, options = {}) ⇒ VideoSite
Returns a new instance of VideoSite.
9
10
11
12
|
# File 'lib/film_snob/video_site.rb', line 9
def initialize(url, options = {})
@url = url
@options = options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8
9
10
|
# File 'lib/film_snob/video_site.rb', line 8
def options
@options
end
|
#url ⇒ Object
Returns the value of attribute url.
8
9
10
|
# File 'lib/film_snob/video_site.rb', line 8
def url
@url
end
|
Class Method Details
.http ⇒ Object
39
40
41
42
43
|
# File 'lib/film_snob/video_site.rb', line 39
def self.http
Net::HTTP.new(uri.host, uri.port).tap do |uri|
uri.use_ssl = use_ssl?
end
end
|
.inherited(base) ⇒ Object
23
24
25
|
# File 'lib/film_snob/video_site.rb', line 23
def self.inherited(base)
SUBCLASSES << base
end
|
.oembed_endpoint ⇒ Object
35
36
37
|
# File 'lib/film_snob/video_site.rb', line 35
def self.oembed_endpoint
""
end
|
.subclasses ⇒ Object
27
28
29
|
# File 'lib/film_snob/video_site.rb', line 27
def self.subclasses
SUBCLASSES
end
|
.use_ssl? ⇒ Boolean
45
46
47
|
# File 'lib/film_snob/video_site.rb', line 45
def self.use_ssl?
"https" == uri.scheme
end
|
.valid_url_patterns ⇒ Object
31
32
33
|
# File 'lib/film_snob/video_site.rb', line 31
def self.valid_url_patterns
[]
end
|
Instance Method Details
#html ⇒ Object
53
54
55
|
# File 'lib/film_snob/video_site.rb', line 53
def html
lookup :html
end
|
#id ⇒ Object
14
15
16
|
# File 'lib/film_snob/video_site.rb', line 14
def id
@id ||= matching_pattern.match(url)[1]
end
|
#site ⇒ Object
18
19
20
|
# File 'lib/film_snob/video_site.rb', line 18
def site
@site ||= self.class.to_s.split("::").last.downcase.to_sym
end
|
#title ⇒ Object
49
50
51
|
# File 'lib/film_snob/video_site.rb', line 49
def title
lookup :title
end
|