Class: Hooloo::Video

Inherits:
MozartHash show all
Defined in:
lib/hooloo/video.rb

Instance Method Summary collapse

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.

Parameters:

  • id (Fixnum)


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



12
13
14
# File 'lib/hooloo/video.rb', line 12

def copyright
  @obj['copyright'].split(',').map(&:strip)
end

#oembedObject



9
10
11
# File 'lib/hooloo/video.rb', line 9

def oembed
  Hooloo.request '/api/oembed.json', url: "http://www.hulu.com/watch/#{@obj['id']}"
end