Class: VgMyspace

Inherits:
Object show all
Defined in:
lib/acts_as_unvlogable/vg_myspace.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = {}) ⇒ VgMyspace

Returns a new instance of VgMyspace.



9
10
11
12
13
14
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 9

def initialize(url=nil, options={})
  @url = url
  @video_id = @url.query_param('videoid').blank? ? @url.query_param('VideoID') : @url.query_param('videoid')
  res = Net::HTTP.get(URI.parse("http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=#{@video_id}"))
  @feed = REXML::Document.new(res)
end

Instance Method Details

#download_urlObject



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

def download_url
  nil
end

#durationObject



24
25
26
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 24

def duration
  nil
end

#embed_html(width = 425, height = 344, options = {}) ⇒ Object



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

def embed_html(width=425, height=344, options={})
  "<embed src='#{embed_url}' type='application/x-shockwave-flash' width='#{width}' height='#{height}'></embed>"
end

#embed_urlObject



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

def embed_url
  "http://lads.myspace.com/videos/vplayer.swf?m=#{REXML::XPath.first( @feed, "//myspace:itemID" )[0]}&v=2&type=video"
end

#flvObject



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

def flv
  REXML::XPath.first(@feed, "//media:content").attributes['url']
end

#serviceObject



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

def service
  "Myspace"
end

#thumbnailObject



20
21
22
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 20

def thumbnail
  REXML::XPath.first(@feed, "//media:thumbnail").attributes['url']
end

#titleObject



16
17
18
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 16

def title
  REXML::XPath.first(@feed, "//item/title")[0].to_s
end