msp-youtube-g 0.4.8.4 → 0.4.8.6

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.
@@ -26,5 +26,5 @@ require File.dirname(__FILE__) + '/youtube_g/request/video_search'
26
26
  require File.dirname(__FILE__) + '/youtube_g/response/video_search'
27
27
 
28
28
  class YouTubeG #:nodoc:
29
- VERSION = '0.4.8.4'
29
+ VERSION = '0.4.8.6'
30
30
  end
@@ -10,7 +10,10 @@ class YouTubeG
10
10
  # made available and allows looking them up by format code number.
11
11
  class Format
12
12
  @@formats = Hash.new
13
-
13
+
14
+ attr_reader :format_code
15
+ attr_reader :name
16
+
14
17
  # Instantiates a new video format object.
15
18
  #
16
19
  # == Parameters
@@ -65,13 +65,15 @@ class YouTubeG
65
65
 
66
66
  app_control_element = entry.elements["app:control"]
67
67
  app_control = nil
68
- if app_control_element
68
+ if app_control_element && app_control_element.elements["yt:state"]
69
69
  app_control = YouTubeG::Model::Video::AppControl.new(
70
70
  :draft => app_control_element.elements["app:draft"].text,
71
71
  :state => app_control_element.elements["yt:state"].attributes["name"],
72
72
  :reason => app_control_element.elements["yt:state"].attributes["reasonCode"],
73
73
  :help_url => app_control_element.elements["yt:state"].attributes["helpUrl"],
74
- :description => app_control_element.elements["yt:state"].text)
74
+ :description => app_control_element.elements["yt:state"].text)
75
+ else
76
+ app_control = YouTubeG::Model::Video::AppControl.new({})
75
77
  end
76
78
 
77
79
  # parse the category and keyword lists
@@ -6,6 +6,7 @@ class TestParser < Test::Unit::TestCase
6
6
  UPLOAD_XML = File.new(File.dirname(__FILE__) +"/upload.xml")
7
7
  SEARCH_XML = File.new(File.dirname(__FILE__) +"/search.xml")
8
8
  YOUTUBE_STATUS_XML = File.new(File.dirname(__FILE__) +"/status.xml")
9
+ YOUTUBE_STATUS_COMPLETE_XML = File.new(File.dirname(__FILE__) +"/complete.xml")
9
10
 
10
11
  YT_VALIDATION = "yt:validation"
11
12
  REQUIRED = "required"
@@ -22,6 +23,10 @@ class TestParser < Test::Unit::TestCase
22
23
  # video feed error
23
24
  @vfe_parser = YouTubeG::Parser::VideoFeedParser.new(YOUTUBE_STATUS_XML.path)
24
25
  @vfe_parser_result = @vfe_parser.parse
26
+
27
+ # upload complete
28
+ @vfc_parser = YouTubeG::Parser::VideoFeedParser.new(YOUTUBE_STATUS_COMPLETE_XML.path)
29
+ @vfc_parser_result = @vfc_parser.parse
25
30
 
26
31
  @vfs_parser = YouTubeG::Parser::VideosFeedParser.new(SEARCH_XML.path)
27
32
  @vfs_parser_result = @vfs_parser.parse
@@ -86,7 +91,8 @@ class TestParser < Test::Unit::TestCase
86
91
  assert_equal("application/x-shockwave-flash",video.media_content[0].mime_type)
87
92
 
88
93
  # Thumbs
89
- assert_equal(4,video.thumbnails.length)
94
+ assert_equal(4,video.thumbnails.length)
95
+
90
96
  # first thumb
91
97
  assert_equal("http://img.youtube.com/vi/32_mQ0PRT9I/2.jpg",video.thumbnails[0].url)
92
98
  assert_equal(97,video.thumbnails[0].height)
@@ -164,6 +170,17 @@ class TestParser < Test::Unit::TestCase
164
170
  assert_equal("http://www.youtube.com/t/community_guidelines", video.app_control.help_url)
165
171
  assert_equal("Video is too long.", video.app_control.description)
166
172
  end
173
+
174
+ def test_video_feed_parser_with_complete_status
175
+ video = @vfc_parser_result
176
+
177
+ assert_instance_of(YouTubeG::Model::Video, video)
178
+
179
+ assert_equal("http://gdata.youtube.com/feeds/api/videos/_N97t50dld8",video.video_id)
180
+ assert_equal(false, video.app_control.nil?)
181
+ assert_equal(true, video.app_control.state.nil?)
182
+
183
+ end
167
184
 
168
185
  def well_formed_errors_xml
169
186
  errors_xml = ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msp-youtube-g
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8.4
4
+ version: 0.4.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Vitarana
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2008-07-25 00:00:00 -07:00
16
+ date: 2008-09-11 00:00:00 -07:00
17
17
  default_executable:
18
18
  dependencies: []
19
19