Class: Hooloo::Video
- Inherits:
-
MozartHash
- Object
- MozartHash
- Hooloo::Video
- Defined in:
- lib/hooloo/video.rb
Instance Method Summary collapse
- #copyright ⇒ Object
-
#initialize(id) ⇒ Video
constructor
A new instance of Video.
- #oembed ⇒ Object
Methods inherited from MozartHash
bool, cast, date, field_mapping, float, #inspect, #method_missing, #respond_to?, uri
Constructor Details
#initialize(id) ⇒ Video
Returns a new instance of Video.
3 4 5 6 7 8 |
# File 'lib/hooloo/video.rb', line 3 def initialize(id) super if id.is_a? Fixnum @obj = Hooloo.request("videos/#{id}")['data'][0]['video'] end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hooloo::MozartHash
Instance Method Details
#copyright ⇒ Object
12 13 14 |
# File 'lib/hooloo/video.rb', line 12 def copyright @obj['copyright'].split(',').map(&:strip) end |
#oembed ⇒ Object
9 10 11 |
# File 'lib/hooloo/video.rb', line 9 def Hooloo.request '/api/oembed.json', url: "http://www.hulu.com/watch/#{@obj['id']}" end |