simple_youtube 1.0.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ HTTP/1.1 200 OK
2
+
3
+ <?xml version="1.0" encoding="UTF-8"?>
4
+ <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007">
5
+ <id>http://gdata.youtube.com/feeds/api/users/NeoDracco</id>
6
+ <published>2007-07-01T01:40:23.000-07:00</published>
7
+ <updated>2011-05-16T04:56:29.000-07:00</updated>
8
+ <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#userProfile"/>
9
+ <category scheme="http://gdata.youtube.com/schemas/2007/channeltypes.cat" term="Guru"/>
10
+ <title type="text">NeoDracco Channel</title>
11
+ <link rel="http://gdata.youtube.com/schemas/2007#user.vlog" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/playlists/3E7AE4AE52B6A5F6"/>
12
+ <link rel="http://gdata.youtube.com/schemas/2007#featured-video" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/DOw62EREnCg"/>
13
+ <link rel="related" type="text/html" href="http://utopianreality.spaces.live.com/"/>
14
+ <link rel="alternate" type="text/html" href="http://www.youtube.com/profile?user=NeoDracco"/>
15
+ <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/NeoDracco"/>
16
+ <author>
17
+ <name>NeoDracco</name>
18
+ <uri>http://gdata.youtube.com/feeds/api/users/neodracco</uri>
19
+ </author>
20
+ <yt:age>38</yt:age>
21
+ <yt:books>El libro gordo de Petete :D</yt:books>
22
+ <yt:company>Robotecnia evolucionada</yt:company>
23
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.favorites" href="http://gdata.youtube.com/feeds/api/users/neodracco/favorites" countHint="66"/>
24
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.contacts" href="http://gdata.youtube.com/feeds/api/users/neodracco/contacts" countHint="167"/>
25
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.inbox" href="http://gdata.youtube.com/feeds/api/users/neodracco/inbox"/>
26
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.playlists" href="http://gdata.youtube.com/feeds/api/users/neodracco/playlists"/>
27
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.subscriptions" href="http://gdata.youtube.com/feeds/api/users/neodracco/subscriptions" countHint="54"/>
28
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.uploads" href="http://gdata.youtube.com/feeds/api/users/neodracco/uploads" countHint="51"/>
29
+ <gd:feedLink rel="http://gdata.youtube.com/schemas/2007#user.newsubscriptionvideos" href="http://gdata.youtube.com/feeds/api/users/neodracco/newsubscriptionvideos"/>
30
+ <yt:firstName>Carlo</yt:firstName>
31
+ <yt:gender>m</yt:gender>
32
+ <yt:hobbies>Musica,Rol,Animacion Japonesa,Dibujante aficionado,Games,hacer reir a mi gente,y despues pienso mas... ^^</yt:hobbies>
33
+ <yt:hometown>Natal City</yt:hometown>
34
+ <yt:lastName>Rossi</yt:lastName>
35
+ <yt:location>Retro City, AR</yt:location>
36
+ <yt:movies>Despues la pongo</yt:movies>
37
+ <yt:music>Downtempo, electronica, alternativa ,Ambient , Trip Hop , Trance, etc.</yt:music>
38
+ <yt:occupation>Tecnico de Pc</yt:occupation>
39
+ <yt:school>SDF-1</yt:school>
40
+ <yt:statistics lastWebAccess="2011-01-04T14:38:13.000-08:00" subscriberCount="207" videoWatchCount="0" viewCount="9378" totalUploadViews="1271699"/>
41
+ <media:thumbnail url="http://i4.ytimg.com/i/OAUvSmXa17rURtWkY-ZYiQ/1.jpg"/>
42
+ <yt:username>NeoDracco</yt:username>
43
+ </entry>
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ HTTP/1.1 200 OK
2
+
3
+ <?xml version="1.0" encoding="UTF-8"?>
4
+ <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007">
5
+ <id>http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8</id>
6
+ <published>2010-08-01T20:44:18.000Z</published>
7
+ <updated>2011-04-03T21:22:14.000Z</updated>
8
+ <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#video"/>
9
+ <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Music" label="Music"/>
10
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Michael"/>
11
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Watford"/>
12
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="So"/>
13
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Into"/>
14
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="You"/>
15
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Atlantic"/>
16
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="DMD"/>
17
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="2069"/>
18
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Inner"/>
19
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="City"/>
20
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Club"/>
21
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Mix"/>
22
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Dub"/>
23
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Classic"/>
24
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Radio"/>
25
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Electronic"/>
26
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="House"/>
27
+ <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Deep"/>
28
+ <title type="text">Michael Watford - So Into You (Dub Mix)</title>
29
+ <content type="text">♣ Artist: Michael Watford</content>
30
+ <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=wOzOc0xxJu8&amp;feature=youtube_gdata"/>
31
+ <link rel="http://gdata.youtube.com/schemas/2007#video.responses" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8/responses"/>
32
+ <link rel="http://gdata.youtube.com/schemas/2007#video.related" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8/related"/>
33
+ <link rel="http://gdata.youtube.com/schemas/2007#mobile" type="text/html" href="http://m.youtube.com/details?v=wOzOc0xxJu8"/>
34
+ <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8"/>
35
+ <author>
36
+ <name>vinylpusherman</name>
37
+ <uri>http://gdata.youtube.com/feeds/api/users/vinylpusherman</uri>
38
+ </author>
39
+ <gd:comments>
40
+ <gd:feedLink href="http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8/comments" countHint="0"/>
41
+ </gd:comments>
42
+ <media:group>
43
+ <media:category label="Music" scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Music</media:category>
44
+ <media:content url="http://www.youtube.com/v/wOzOc0xxJu8?f=videos&amp;app=youtube_gdata" type="application/x-shockwave-flash" medium="video" isDefault="true" expression="full" duration="324" yt:format="5"/>
45
+ <media:content url="rtsp://v7.cache2.c.youtube.com/CiILENy73wIaGQnvJnFMc87swBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp" type="video/3gpp" medium="video" expression="full" duration="324" yt:format="1"/>
46
+ <media:content url="rtsp://v4.cache5.c.youtube.com/CiILENy73wIaGQnvJnFMc87swBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp" type="video/3gpp" medium="video" expression="full" duration="324" yt:format="6"/>
47
+ <media:description type="plain">♣ Artist: Michael Watford</media:description>
48
+ <media:keywords>Michael, Watford, So, Into, You, Atlantic, DMD, 2069, Inner, City, Club, Mix, Dub, Classic, Radio, Electronic, House, Deep</media:keywords>
49
+ <media:player url="http://www.youtube.com/watch?v=wOzOc0xxJu8&amp;feature=youtube_gdata_player"/>
50
+ <media:thumbnail url="http://i.ytimg.com/vi/wOzOc0xxJu8/0.jpg" height="240" width="320" time="00:02:42"/>
51
+ <media:thumbnail url="http://i.ytimg.com/vi/wOzOc0xxJu8/1.jpg" height="90" width="120" time="00:01:21"/>
52
+ <media:thumbnail url="http://i.ytimg.com/vi/wOzOc0xxJu8/2.jpg" height="90" width="120" time="00:02:42"/>
53
+ <media:thumbnail url="http://i.ytimg.com/vi/wOzOc0xxJu8/3.jpg" height="90" width="120" time="00:04:03"/>
54
+ <media:title type="plain">Michael Watford - So Into You (Dub Mix)</media:title>
55
+ <yt:duration seconds="324"/>
56
+ </media:group>
57
+ <yt:statistics favoriteCount="0" viewCount="74"/>
58
+ </entry>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <entry xmlns="http://www.w3.org/2005/Atom"
3
+ xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:yt="http://gdata.youtube.com/schemas/2007">
5
+ <media:group>
6
+ <media:title type="plain">Michael Watford - So Into You (Dub Mix)</media:title>
7
+ <media:description type="plain">&#9827; Artist: Michael Watford
8
+ </media:description>
9
+ <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Music</media:category>
10
+ <media:keywords>Michael,Watford,So,Into,You,Atlantic,DMD,2069,Inner,City,Club,Mix,Dub,Classic,Radio,Electronic,House,Deep</media:keywords>
11
+ </media:group>
12
+ <yt:accessControl action="comment" permission="allowed"/>
13
+ <yt:accessControl action="commentVote" permission="allowed"/>
14
+ <yt:accessControl action="videoRespond" permission="moderated"/>
15
+ <yt:accessControl action="rate" permission="allowed"/>
16
+ <yt:accessControl action="list" permission="allowed"/>
17
+ <yt:accessControl action="embed" permission="allowed"/>
18
+ <yt:accessControl action="syndicate" permission="allowed"/>
19
+ </entry>
@@ -0,0 +1,126 @@
1
+ require File.dirname(__FILE__) + "/../lib/" + "simple_youtube"
2
+ require File.dirname(__FILE__) + "/fakeweb_helper"
3
+
4
+ describe 'YoutubeFindSpec' do
5
+
6
+ include FakewebHelper
7
+
8
+ it "finds video search for uid" do
9
+ stub_get('http://gdata.youtube.com/feeds/api/videos/wOzOc0xxJu8?v=2', 'video_uid.xml')
10
+ video_uid = Youtube::Video.find(:scope => 'wOzOc0xxJu8', :params => {:v => '2'})
11
+ video_uid.entry.size.should == 1
12
+ video_uid.entry[0].title.should == "Michael Watford - So Into You (Dub Mix)"
13
+ end
14
+
15
+ it "finds video search for top 5 ruby on rails videos" do
16
+ stub_get('http://gdata.youtube.com/feeds/api/videos?q=ruby+on+rails&max-results=5&v=2', 'video_search.xml')
17
+ video_search = Youtube::Video.find(:params => {:q => 'ruby on rails', :"max-results" => '5', :v => '2'})
18
+ video_search.entry.size.should == 5
19
+ video_search.title.should == "YouTube Videos matching query: ruby on rails"
20
+ video_search.entry[3].link[1].href.should == "http://gdata.youtube.com/feeds/api/videos/UCB57Npj9U0/responses?v=2"
21
+ end
22
+
23
+ it "finds video search for related videos" do
24
+ stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/related?v=2', 'video_related.xml')
25
+ video_related = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'related', :params => {:v => '2'})
26
+ video_related.entry.size.should == 25
27
+ video_related.entry[24].author.uri.should == "http://gdata.youtube.com/feeds/api/users/neodracco"
28
+ end
29
+
30
+ it "finds video search for video responses" do
31
+ stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/responses?v=2', 'video_responses.xml')
32
+ video_responses = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'responses', :params => {:v => '2'})
33
+ video_responses.entry[1].group.category.should == "Music"
34
+ end
35
+
36
+ it "finds video search for video comments" do
37
+ stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/comments?v=2', 'video_comments.xml')
38
+ video_comments = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'comments', :params => {:v => '2'})
39
+ video_comments.entry[0].content.should == "Come up to my first ever e on this about 14-15 years ago, ahh too long..."
40
+ end
41
+
42
+ it "finds video search for top 11 videos in Comedy category" do
43
+ stub_get('http://gdata.youtube.com/feeds/api/videos?category=Comedy&max-results=11&v=2', 'video_category_comedy.xml')
44
+ video_category = Youtube::Video.find(:params => {:category => 'Comedy', :"max-results" => '11', :v => '2'})
45
+ video_category.entry.size.should == 11
46
+ video_category.entry[9].category[2].term.should == "Harry Potter"
47
+ video_category.entry[0].category[1].term.should == "Comedy"
48
+ end
49
+
50
+ it "finds video search for top 5 videos in Comedy category excluding Film category" do
51
+ stub_get('http://gdata.youtube.com/feeds/api/videos?category=Comedy%2C-Film&max-results=5&v=2', 'video_category_comedy_exclude_film.xml')
52
+ video_category_comedy_exclude_film = Youtube::Video.find(:params => {:category => 'Comedy,-Film', :"max-results" => '5', :v => '2'})
53
+ video_category_comedy_exclude_film.entry[1].category.size.should == 18
54
+ video_category_comedy_exclude_film.entry[1].category.each { |category|
55
+ category.term.should_not == "Film"
56
+ }
57
+ end
58
+
59
+ it "finds video search for videos in david beckham News or Sports category" do
60
+ stub_get('http://gdata.youtube.com/feeds/api/videos?category=david%2Cbeckham%2CNews%7CSports&v=2', 'video_category_david_beckham_news_or_sports.xml')
61
+ video_category_david_beckham_news_or_sports = Youtube::Video.find(:params => {:category => 'david,beckham,News|Sports', :v => '2'})
62
+ video_category_david_beckham_news_or_sports.entry[7].category[1].label.should == "Sports"
63
+ video_category_david_beckham_news_or_sports.entry[7].category[2].term.should == "david"
64
+ video_category_david_beckham_news_or_sports.entry[7].category[3].term.should == "beckham"
65
+ video_category_david_beckham_news_or_sports.entry[8].category[1].term.should == "News"
66
+ video_category_david_beckham_news_or_sports.entry[8].category[9].term.should == "David Beckham"
67
+ end
68
+
69
+ it "finds standardfeed search for top rated videos from today" do
70
+ stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&v=2', 'standardfeed_toprated_today.xml')
71
+ standardfeed_topratedtoday = Youtube::Standardfeed.find(:type => 'top_rated', :params => {:time => 'today', :v => '2'})
72
+ standardfeed_topratedtoday.entry[16].author.name.should == "ZOMGitsCriss"
73
+ end
74
+
75
+ it "finds standardfeed search for top rated videos from jp" do
76
+ stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?v=2', 'standardfeed_toprated_jp.xml')
77
+ standardfeed_toprated_jp = Youtube::Standardfeed.find(:scope => 'JP', :type => 'top_rated', :params => {:v => '2'})
78
+ standardfeed_toprated_jp.id.should == "tag:youtube.com,2008:standardfeed:jp:top_rated"
79
+ standardfeed_toprated_jp.entry[1].link[4].href.should == "http://gdata.youtube.com/feeds/api/standardfeeds/jp/top_rated/v/BQ9YtJC-Kd8?v=2"
80
+ end
81
+
82
+ it "finds standardfeed search for top rated comedy videos from jp" do
83
+ stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?category=Comedy&max-results=11&v=2', 'standardfeed_toprated_jp_comedy.xml')
84
+ standardfeed_toprated_jp_comedy = Youtube::Standardfeed.find(:scope => 'JP', :type => 'top_rated', :params => {:category => 'Comedy', :"max-results" => '11', :v => '2'})
85
+ standardfeed_toprated_jp_comedy.entry[1].link[4].href.should == "http://gdata.youtube.com/feeds/api/standardfeeds/jp/top_rated/v/7hYGkqc1gqE?v=2"
86
+ end
87
+
88
+ it "finds user feed for single user" do
89
+ stub_get("http://gdata.youtube.com/feeds/api/users/neodracco", 'user_neodracco.xml')
90
+ user_search = Youtube::User.find(:scope => 'neodracco')
91
+ user_search.entry.size.should == 1
92
+ end
93
+
94
+ it "finds user search for ionysis favourite videos" do
95
+ stub_get('http://gdata.youtube.com/feeds/api/users/ionysis/favorites?v=2', 'user_ionysis_favourites.xml')
96
+ user_ionysis_favourites = Youtube::User.find(:scope => 'ionysis', :type => 'favorites', :params => {:v => '2'})
97
+ user_ionysis_favourites.entry[7].statistics.favoriteCount.should == "9586"
98
+ user_ionysis_favourites.entry[7].rating[1].numLikes.should == "2568"
99
+ end
100
+
101
+ it "finds user search for cyanure1982 playlists" do
102
+ stub_get('http://gdata.youtube.com/feeds/api/users/cyanure1982/playlists?v=2', 'user_cyanure1982_playlists.xml')
103
+ user_cyanure1982_playlists = Youtube::User.find(:scope => 'cyanure1982', :type => 'playlists', :params => {:v => '2'})
104
+ user_cyanure1982_playlists.entry[2].title.should == "shinnenkai"
105
+ end
106
+
107
+ it "finds user search for ionysis subscriptions" do
108
+ stub_get('http://gdata.youtube.com/feeds/api/users/ionysis/subscriptions?v=2', 'user_ionysis_subscriptions.xml')
109
+ user_ionysis_subscriptions = Youtube::User.find(:scope => 'ionysis', :type => 'subscriptions', :params => {:v => '2'})
110
+ user_ionysis_subscriptions.entry[0].title.should == "Videos published by : vinyljunkie07"
111
+ end
112
+
113
+ it "finds user search for vinyljunkie07 contacts" do
114
+ stub_get('http://gdata.youtube.com/feeds/api/users/vinyljunkie07/contacts?v=2', 'user_vinyljunkie07_contacts.xml')
115
+ user_vinyljunkie07_contacts = Youtube::User.find(:scope => 'vinyljunkie07', :type => 'contacts', :params => {:v => '2'})
116
+ user_vinyljunkie07_contacts.entry[18].id.should == "tag:youtube.com,2008:user:vinyljunkie07:contact:CrackerSchool"
117
+ end
118
+
119
+ it "finds playlist search for the cyanure1982 playlist shinnenkai D00BDE6AA710D50C" do
120
+ stub_get('http://gdata.youtube.com/feeds/api/playlists/D00BDE6AA710D50C?max-results=14&v=2', 'playlist_cyanure1982.xml')
121
+ playlist_cyanure1982 = Youtube::Playlist.find(:scope => 'D00BDE6AA710D50C', :params => {:"max-results" => '14', :v => '2'})
122
+ playlist_cyanure1982.entry.size.should == 14
123
+ playlist_cyanure1982.entry[7].group.keywords.should == "nu, jazz, club, house, Jazztronik, dj, Yukihiro, Fukutomi, Mondo, Grosso, Daishi, Dance, FreeTEMPO, FPM, KJM, Kentaro, Takizawa"
124
+ end
125
+
126
+ end
@@ -0,0 +1,31 @@
1
+ require File.dirname(__FILE__) + "/../lib/" + "simple_youtube"
2
+
3
+ describe 'YoutubeUpdateSpec' do
4
+
5
+ it "updates a video on youtube" do
6
+
7
+ consumer = double("consumer")
8
+ access_token = double("access_token")
9
+ host = "www.host.com"
10
+ host_secret = "host_secret"
11
+ oauth_token = "oauth_token"
12
+ oauth_token_secret = "oauth_token_secret"
13
+ x_gdata_key = "x_gdata_key"
14
+ video_uid = "video_uid"
15
+ user_name = "user_name"
16
+ update_xml = IO.read('fixture/video_update.xml')
17
+
18
+ OAuth::Consumer.should_receive(:new).with(host, host_secret, {:site=>"https://www.google.com", :request_token_path=>"/accounts/OAuthGetRequestToken", :authorize_path=>"/accounts/OAuthAuthorizeToken", :access_token_path=>"/accounts/OAuthGetAccessToken"}).and_return(consumer)
19
+
20
+ OAuth::AccessToken.should_receive(:new).with(consumer, oauth_token, oauth_token_secret).and_return(access_token)
21
+
22
+ access_token.should_receive(:put).with("http://gdata.youtube.com/feeds/api/users/#{user_name}/uploads/#{video_uid}", update_xml, {'Accept' => 'application/atom+xml', 'Content-Type' => 'application/atom+xml', 'X-GData-Key' => x_gdata_key}).and_return(Net::HTTPResponse.new(1.0, 200, "OK")
23
+ )
24
+
25
+ response = Youtube::Video.update(video_uid, user_name, update_xml, oauth_token, oauth_token_secret, x_gdata_key, host, host_secret)
26
+
27
+ response.code.should == 200
28
+
29
+ end
30
+
31
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_youtube
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
4
+ prerelease:
5
+ version: 2.0.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - James Shipton
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-07-04 00:00:00 +01:00
13
+ date: 2011-07-24 00:00:00 +01:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -24,49 +19,45 @@ dependencies:
24
19
  requirement: &id001 !ruby/object:Gem::Requirement
25
20
  none: false
26
21
  requirements:
27
- - - ">="
22
+ - - "="
28
23
  - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 2
32
- - 3
33
- - 5
34
- version: 2.3.5
24
+ version: 3.0.5
35
25
  type: :runtime
36
26
  version_requirements: *id001
37
27
  - !ruby/object:Gem::Dependency
38
- name: fakeweb
28
+ name: oauth
39
29
  prerelease: false
40
30
  requirement: &id002 !ruby/object:Gem::Requirement
41
31
  none: false
42
32
  requirements:
43
- - - ">="
33
+ - - "="
44
34
  - !ruby/object:Gem::Version
45
- hash: 15
46
- segments:
47
- - 1
48
- - 2
49
- - 8
50
- version: 1.2.8
51
- type: :development
35
+ version: 0.4.4
36
+ type: :runtime
52
37
  version_requirements: *id002
53
38
  - !ruby/object:Gem::Dependency
54
- name: test-unit
39
+ name: fakeweb
55
40
  prerelease: false
56
41
  requirement: &id003 !ruby/object:Gem::Requirement
57
42
  none: false
58
43
  requirements:
59
- - - ">="
44
+ - - "="
60
45
  - !ruby/object:Gem::Version
61
- hash: 25
62
- segments:
63
- - 1
64
- - 2
65
- - 3
66
- version: 1.2.3
46
+ version: 1.2.8
67
47
  type: :development
68
48
  version_requirements: *id003
69
- description: ActiveResource extension to Youtube API gdata, Read only, no Create, Update, Delete access and no API Key required.
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: "2.5"
58
+ type: :development
59
+ version_requirements: *id004
60
+ description: ActiveResource extension to Youtube API gdata, anonymous Reads, Updates using your API key and OAuth, no Create or Delete access.
70
61
  email:
71
62
  - ionysis@gmail.com
72
63
  executables: []
@@ -77,25 +68,31 @@ extra_rdoc_files: []
77
68
 
78
69
  files:
79
70
  - lib/simple_youtube/activeyoutube.rb
71
+ - lib/simple_youtube/entry_interface_shim.rb
80
72
  - lib/simple_youtube/youtube.rb
81
73
  - lib/simple_youtube.rb
82
- - test/fakeweb_helper.rb
83
- - test/fixture/playlist_cyanure1982.xml
84
- - test/fixture/standardfeed_toprated_jp.xml
85
- - test/fixture/standardfeed_toprated_jp_comedy.xml
86
- - test/fixture/standardfeed_toprated_today.xml
87
- - test/fixture/user_cyanure1982_playlists.xml
88
- - test/fixture/user_ionysis_favourites.xml
89
- - test/fixture/user_ionysis_subscriptions.xml
90
- - test/fixture/user_vinyljunkie07_contacts.xml
91
- - test/fixture/video_category_comedy.xml
92
- - test/fixture/video_category_comedy_exclude_film.xml
93
- - test/fixture/video_category_david_beckham_news_or_sports.xml
94
- - test/fixture/video_comments.xml
95
- - test/fixture/video_related.xml
96
- - test/fixture/video_responses.xml
97
- - test/fixture/video_search.xml
98
- - test/youtube_test.rb
74
+ - spec/fakeweb_helper.rb
75
+ - spec/fixture/playlist_cyanure1982.xml
76
+ - spec/fixture/standardfeed_toprated_jp.xml
77
+ - spec/fixture/standardfeed_toprated_jp_comedy.xml
78
+ - spec/fixture/standardfeed_toprated_today.xml
79
+ - spec/fixture/user_cyanure1982_playlists.xml
80
+ - spec/fixture/user_ionysis_favourites.xml
81
+ - spec/fixture/user_ionysis_subscriptions.xml
82
+ - spec/fixture/user_mike6011_uploads.xml
83
+ - spec/fixture/user_neodracco.xml
84
+ - spec/fixture/user_vinyljunkie07_contacts.xml
85
+ - spec/fixture/video_category_comedy.xml
86
+ - spec/fixture/video_category_comedy_exclude_film.xml
87
+ - spec/fixture/video_category_david_beckham_news_or_sports.xml
88
+ - spec/fixture/video_comments.xml
89
+ - spec/fixture/video_related.xml
90
+ - spec/fixture/video_responses.xml
91
+ - spec/fixture/video_search.xml
92
+ - spec/fixture/video_uid.xml
93
+ - spec/fixture/video_update.xml
94
+ - spec/youtube_read_spec.rb
95
+ - spec/youtube_update_spec.rb
99
96
  has_rdoc: true
100
97
  homepage: http://github.com/ionysis/simple_youtube
101
98
  licenses: []
@@ -110,41 +107,40 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
107
  requirements:
111
108
  - - ">="
112
109
  - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
110
  version: "0"
117
111
  required_rubygems_version: !ruby/object:Gem::Requirement
118
112
  none: false
119
113
  requirements:
120
114
  - - ">="
121
115
  - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 0
125
116
  version: "0"
126
117
  requirements: []
127
118
 
128
119
  rubyforge_project:
129
- rubygems_version: 1.3.7
120
+ rubygems_version: 1.6.2
130
121
  signing_key:
131
122
  specification_version: 3
132
123
  summary: ActiveResource extension to Youtube API gdata.
133
124
  test_files:
134
- - test/fakeweb_helper.rb
135
- - test/fixture/playlist_cyanure1982.xml
136
- - test/fixture/standardfeed_toprated_jp.xml
137
- - test/fixture/standardfeed_toprated_jp_comedy.xml
138
- - test/fixture/standardfeed_toprated_today.xml
139
- - test/fixture/user_cyanure1982_playlists.xml
140
- - test/fixture/user_ionysis_favourites.xml
141
- - test/fixture/user_ionysis_subscriptions.xml
142
- - test/fixture/user_vinyljunkie07_contacts.xml
143
- - test/fixture/video_category_comedy.xml
144
- - test/fixture/video_category_comedy_exclude_film.xml
145
- - test/fixture/video_category_david_beckham_news_or_sports.xml
146
- - test/fixture/video_comments.xml
147
- - test/fixture/video_related.xml
148
- - test/fixture/video_responses.xml
149
- - test/fixture/video_search.xml
150
- - test/youtube_test.rb
125
+ - spec/fakeweb_helper.rb
126
+ - spec/fixture/playlist_cyanure1982.xml
127
+ - spec/fixture/standardfeed_toprated_jp.xml
128
+ - spec/fixture/standardfeed_toprated_jp_comedy.xml
129
+ - spec/fixture/standardfeed_toprated_today.xml
130
+ - spec/fixture/user_cyanure1982_playlists.xml
131
+ - spec/fixture/user_ionysis_favourites.xml
132
+ - spec/fixture/user_ionysis_subscriptions.xml
133
+ - spec/fixture/user_mike6011_uploads.xml
134
+ - spec/fixture/user_neodracco.xml
135
+ - spec/fixture/user_vinyljunkie07_contacts.xml
136
+ - spec/fixture/video_category_comedy.xml
137
+ - spec/fixture/video_category_comedy_exclude_film.xml
138
+ - spec/fixture/video_category_david_beckham_news_or_sports.xml
139
+ - spec/fixture/video_comments.xml
140
+ - spec/fixture/video_related.xml
141
+ - spec/fixture/video_responses.xml
142
+ - spec/fixture/video_search.xml
143
+ - spec/fixture/video_uid.xml
144
+ - spec/fixture/video_update.xml
145
+ - spec/youtube_read_spec.rb
146
+ - spec/youtube_update_spec.rb
data/test/youtube_test.rb DELETED
@@ -1,108 +0,0 @@
1
- require "test/unit"
2
- require File.dirname(__FILE__) + "/../lib/" + "simple_youtube"
3
- require File.dirname(__FILE__) + "/fakeweb_helper"
4
-
5
- class YoutubeTest < Test::Unit::TestCase
6
-
7
- include FakewebHelper
8
-
9
- def test_video
10
- ## search for top 5 'ruby on rails' videos
11
- stub_get('http://gdata.youtube.com/feeds/api/videos?q=ruby+on+rails&max-results=5&v=2', 'video_search.xml')
12
- video_search = Youtube::Video.find(:params => {:q => 'ruby on rails', :"max-results" => '5', :v => '2'})
13
- assert_equal(5, video_search.entry.size)
14
- assert_equal("YouTube Videos matching query: ruby on rails", video_search.title)
15
- assert_equal("http://gdata.youtube.com/feeds/api/videos/UCB57Npj9U0/responses?v=2", video_search.entry[3].link[1].href)
16
-
17
- ## search for related videos
18
- stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/related?v=2', 'video_related.xml')
19
- video_related = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'related', :params => {:v => '2'})
20
- assert_equal(25, video_related.entry.size)
21
- assert_equal("http://gdata.youtube.com/feeds/api/users/neodracco", video_related.entry[24].author.uri)
22
-
23
- ## search for video responses
24
- stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/responses?v=2', 'video_responses.xml')
25
- video_responses = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'responses', :params => {:v => '2'})
26
- assert_equal("Music", video_responses.entry[1].group.category)
27
-
28
- ## search for video comments
29
- stub_get('http://gdata.youtube.com/feeds/api/videos/rFVHjZYoq4Q/comments?v=2', 'video_comments.xml')
30
- video_comments = Youtube::Video.find(:scope => 'rFVHjZYoq4Q', :type => 'comments', :params => {:v => '2'})
31
- assert_equal("Come up to my first ever e on this about 14-15 years ago, ahh too long...", video_comments.entry[0].content)
32
-
33
- ## search for top 11 videos in Comedy category/tag
34
- stub_get('http://gdata.youtube.com/feeds/api/videos?category=Comedy&max-results=11&v=2', 'video_category_comedy.xml')
35
- video_category = Youtube::Video.find(:params => {:category => 'Comedy', :"max-results" => '11', :v => '2'})
36
- assert_equal(11, video_category.entry.size)
37
- assert_equal("Harry Potter", video_category.entry[9].category[2].term)
38
- assert_equal("Comedy", video_category.entry[0].category[1].term)
39
-
40
- ## search for top 5 videos in Comedy category/tag, excluding Film category/tag
41
- stub_get('http://gdata.youtube.com/feeds/api/videos?category=Comedy%2C-Film&max-results=5&v=2', 'video_category_comedy_exclude_film.xml')
42
- video_category_comedy_exclude_film = Youtube::Video.find(:params => {:category => 'Comedy,-Film', :"max-results" => '5', :v => '2'})
43
- assert_equal(18, video_category_comedy_exclude_film.entry[1].category.size)
44
- video_category_comedy_exclude_film.entry[1].category.each { |category|
45
- assert_not_equal("Film", category.term)
46
- }
47
-
48
- ## search for videos in david, beckham,(News or Sports) category/tags
49
- stub_get('http://gdata.youtube.com/feeds/api/videos?category=david%2Cbeckham%2CNews%7CSports&v=2', 'video_category_david_beckham_news_or_sports.xml')
50
- video_category_david_beckham_news_or_sports = Youtube::Video.find(:params => {:category => 'david,beckham,News|Sports', :v => '2'})
51
- assert_equal("Sports", video_category_david_beckham_news_or_sports.entry[7].category[1].label)
52
- assert_equal("david", video_category_david_beckham_news_or_sports.entry[7].category[2].term)
53
- assert_equal("beckham", video_category_david_beckham_news_or_sports.entry[7].category[3].term)
54
- assert_equal("News", video_category_david_beckham_news_or_sports.entry[8].category[1].term)
55
- assert_equal("David Beckham", video_category_david_beckham_news_or_sports.entry[8].category[9].term)
56
- end
57
-
58
- def test_standardfeed
59
- ## search for top rated videos from today
60
- stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&v=2', 'standardfeed_toprated_today.xml')
61
- standardfeed_topratedtoday = Youtube::Standardfeed.find(:type => 'top_rated', :params => {:time => 'today', :v => '2'})
62
- assert_equal("ZOMGitsCriss", standardfeed_topratedtoday.entry[16].author.name)
63
-
64
- ## search for top rated videos from jp
65
- stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?v=2', 'standardfeed_toprated_jp.xml')
66
- standardfeed_toprated_jp = Youtube::Standardfeed.find(:scope => 'JP', :type => 'top_rated', :params => {:v => '2'})
67
- assert_equal("tag:youtube.com,2008:standardfeed:jp:top_rated", standardfeed_toprated_jp.id)
68
- assert_equal("http://gdata.youtube.com/feeds/api/standardfeeds/jp/top_rated/v/BQ9YtJC-Kd8?v=2", standardfeed_toprated_jp.entry[1].link[4].href)
69
-
70
- ## search for top rated comedy videos from jp
71
- stub_get('http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?category=Comedy&max-results=11&v=2', 'standardfeed_toprated_jp_comedy.xml')
72
- standardfeed_toprated_jp_comedy = Youtube::Standardfeed.find(:scope => 'JP', :type => 'top_rated', :params => {:category => 'Comedy', :"max-results" => '11', :v => '2'})
73
- assert_equal("http://gdata.youtube.com/feeds/api/standardfeeds/jp/top_rated/v/7hYGkqc1gqE?v=2", standardfeed_toprated_jp_comedy.entry[1].link[4].href)
74
- end
75
-
76
- def test_user
77
- ## search for ionysis favourite videos
78
- stub_get('http://gdata.youtube.com/feeds/api/users/ionysis/favorites?v=2', 'user_ionysis_favourites.xml')
79
- user_ionysis_favourites = Youtube::User.find(:scope => 'ionysis', :type => 'favorites', :params => {:v => '2'})
80
- assert_equal("9586", user_ionysis_favourites.entry[7].statistics.favoriteCount)
81
- assert_equal("2568", user_ionysis_favourites.entry[7].rating[1].numLikes)
82
-
83
- ## search for cyanure1982 playlists
84
- stub_get('http://gdata.youtube.com/feeds/api/users/cyanure1982/playlists?v=2', 'user_cyanure1982_playlists.xml')
85
- user_cyanure1982_playlists = Youtube::User.find(:scope => 'cyanure1982', :type => 'playlists', :params => {:v => '2'})
86
- assert_equal("shinnenkai", user_cyanure1982_playlists.entry[2].title)
87
-
88
- ## search for ionysis subscriptions
89
- stub_get('http://gdata.youtube.com/feeds/api/users/ionysis/subscriptions?v=2', 'user_ionysis_subscriptions.xml')
90
- user_ionysis_subscriptions = Youtube::User.find(:scope => 'ionysis', :type => 'subscriptions', :params => {:v => '2'})
91
- assert_equal("Videos published by : vinyljunkie07", user_ionysis_subscriptions.entry[0].title)
92
-
93
- ## search for vinyljunkie07 contacts
94
- stub_get('http://gdata.youtube.com/feeds/api/users/vinyljunkie07/contacts?v=2', 'user_vinyljunkie07_contacts.xml')
95
- user_vinyljunkie07_contacts = Youtube::User.find(:scope => 'vinyljunkie07', :type => 'contacts', :params => {:v => '2'})
96
- assert_equal("tag:youtube.com,2008:user:vinyljunkie07:contact:CrackerSchool", user_vinyljunkie07_contacts.entry[18].id)
97
- end
98
-
99
- def test_playlist
100
- ## search for the cyanure1982 playlist - shinnenkai(D00BDE6AA710D50C)
101
- stub_get('http://gdata.youtube.com/feeds/api/playlists/D00BDE6AA710D50C?max-results=14&v=2', 'playlist_cyanure1982.xml')
102
- playlist_cyanure1982 = Youtube::Playlist.find(:scope => 'D00BDE6AA710D50C', :params => {:"max-results" => '14', :v => '2'})
103
- assert_equal(14, playlist_cyanure1982.entry.size)
104
- assert_equal("nu, jazz, club, house, Jazztronik, dj, Yukihiro, Fukutomi, Mondo, Grosso, Daishi, Dance, FreeTEMPO, FPM, KJM, Kentaro, Takizawa",
105
- playlist_cyanure1982.entry[7].group.keywords)
106
- end
107
-
108
- end