downthetube 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +7 -0
  2. data/downthetube.gemspec +1 -1
  3. data/lib/video.rb +3 -2
  4. metadata +3 -3
data/README CHANGED
@@ -58,6 +58,13 @@ irb(main):031:0> itapua.title
58
58
  irb(main):032:0> itapua.url
59
59
  => "http://www.youtube.com/watch?v=5Pg6a3TbF68"
60
60
 
61
+ You can also get the video object to return a hash of its important info by calling to_h:
62
+
63
+ irb(main):009:0> vid = Youtube::Video.new "QSiGw6noULA"
64
+ => #<Youtube::Video:0x7fec0cbc9300 @url="http://gdata.youtube.com/feeds/api/videos/QSiGw6noULA?v=2">
65
+
66
+ irb(main):010:0> vid.to_h
67
+ => {:title=>"Semente do Jogo de Angola - Tradição - Parte 1", :small_thumbnail=>"http://i.ytimg.com/vi/QSiGw6noULA/default.jpg", :description=>"Video produzido pelo Grupo de capoeira Semente do Jogo de Angola - Mestre Jogo de Dentro\nwww.sementedojogodeangola.org.br", :large_thumbnail=>"http://i.ytimg.com/vi/QSiGw6noULA/hqdefault.jpg", :uploader=>"valmirmauricio", :duration=>"120", :url=>"http://www.youtube.com/watch?v=QSiGw6noULA", :id=>"QSiGw6noULA"}
61
68
 
62
69
  LICENSE:
63
70
 
data/downthetube.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  specification = Gem::Specification.new do |spec|
2
2
  # Descriptive and source information for this gem.
3
3
  spec.name = "downthetube"
4
- spec.version = "0.0.6"
4
+ spec.version = "0.0.7"
5
5
  spec.description = "A library to make downloading playlists and videos from Youtube less nasty."
6
6
  spec.summary = "Downloads playlists and videos from Youtube."
7
7
  spec.author = "Mike Williamson"
data/lib/video.rb CHANGED
@@ -83,9 +83,10 @@ module Youtube
83
83
  end
84
84
 
85
85
  def to_h
86
- h = {}
86
+ populate_attrs unless @xml
87
+ h = {}
87
88
  instance_variables.each do |var|
88
- h[var.gsub('@', '').to_sym]= self.instance_variable_get(var.to_sym) unless var == "@client"
89
+ h[var.gsub('@', '').to_sym]= self.instance_variable_get(var.to_sym) unless %w( @client @xml ).include? var
89
90
  end
90
91
  h
91
92
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: downthetube
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Williamson