howcast 0.4.1 → 0.4.3

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.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.4.3 2009-03-02
2
+
3
+ * Compatibility with ruby 1.9 - replacing dependency on hpricot with why-hpricot as github as the ruby 1.9 hpricot gem
4
+
5
+ == 0.4.2 2009-02-04
6
+
7
+ * Adding embed code to video object
8
+
1
9
  == 0.4.1 2008-11-05
2
10
 
3
11
  * Support for finding a category ancestor trail from a category object
data/Manifest.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  History.txt
2
2
  License.txt
3
3
  Manifest.txt
4
- README.txt
4
+ README.markdown
5
5
  Rakefile
6
6
  config/hoe.rb
7
7
  config/requirements.rb
data/README.markdown ADDED
@@ -0,0 +1,46 @@
1
+ # Howcast API Ruby Wrapper
2
+
3
+ Copyright (c) 2008 Howcast Media Inc.
4
+
5
+ Author: Michael Murray <michael@howcast.com>
6
+
7
+ ## Installing
8
+
9
+ sudo gem install howcast
10
+
11
+ ## Example
12
+
13
+ require 'rubygems'
14
+ require 'howcast'
15
+
16
+ hc = Howcast::Client.new(:key => "INSERT API KEY HERE")
17
+ # Will print out the video titles of the first page of recent howcast studios videos
18
+ puts "Recent Howcast Studios Videos"
19
+ hc.videos.each do |v|
20
+ puts v.title
21
+ end
22
+
23
+ puts "2nd Page of Recent Featured Videos"
24
+ # Will print out the video titles of the 2nd page of recent featured videos
25
+ hc.videos(:page => 2, :sort => "most_recent", :filter => "featured").each do |v|
26
+ puts v.title
27
+ end
28
+
29
+ puts "Videos matching 'origami'"
30
+ hc.video_search("origami").each do |v|
31
+ puts v.title
32
+ end
33
+
34
+ puts "Video with id 946"
35
+ puts hc.video(946).title
36
+
37
+ # Category API
38
+ piano = hc.category(1105)
39
+ puts "The parent category of Piano is #{hc.category(piano.parent_id).name}"
40
+
41
+ ancestors = piano.parents.map{|c| c[:name]}
42
+ # Ancestors will be an array of hash metadata:
43
+ # => [{:name=>"Performing Arts", :id=>"1048"},
44
+ # {:name=>"Musical Instruments", :id=>"1095"},
45
+ # {:name=>"Keyboards", :id=>"1103"}]
46
+ puts "The ancestors of piano are: #{ancestors.join(" -> ")}"
data/config/hoe.rb CHANGED
@@ -58,7 +58,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
58
58
 
59
59
  # == Optional
60
60
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
61
- p.extra_deps = [['hpricot', '>= 0.6']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
61
+ p.extra_deps = [['why-hpricot', '>= 0.6']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
62
 
63
63
  # p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
64
 
@@ -38,7 +38,7 @@ class Howcast::Client
38
38
  extend WatchAttrAccessors
39
39
  attr_accessor :id, :title, :permalink, :thumbnail_url, :category_id,
40
40
  :views, :username, :duration, :created_at, :rating, :description, :width, :height,
41
- :badges, :easy_steps
41
+ :badges, :easy_steps, :embed
42
42
  # Creates a new Video object which is used to encapsulate all the attributes available
43
43
  # from the Howcast Video API
44
44
  #
@@ -2,7 +2,7 @@ module Howcast #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 1
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  class << self
@@ -36,6 +36,10 @@ describe Howcast::Client, "video" do
36
36
  @hc.video(2).should be_nil
37
37
  end
38
38
 
39
+ it "should set the embed attribute in the video model response" do
40
+ @hc.video(2).embed.should == %(<object width="425" height="352" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="howcastplayer"><param name="movie" value="http://www.howcast.com/flash/howcast_player.swf?file=233"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.howcast.com/flash/howcast_player.swf?file=233" type="application/x-shockwave-flash" width="425" height="352" allowFullScreen="true" allowScriptAccess="always" ></embed></object>)
41
+ end
42
+
39
43
  it "should set the title attribute in the video model response" do
40
44
  @hc.video(2).title.should == "How To Do a Noble Pose"
41
45
  end
data/spec/spec_helper.rb CHANGED
@@ -94,6 +94,9 @@ Spec::Runner.configure do |config|
94
94
  <easy-steps>true</easy-steps>
95
95
  <badges>Howcast Studios</badges>
96
96
  <title>How To Do a Noble Pose</title>
97
+ <embed>
98
+ <![CDATA[<object width="425" height="352" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="howcastplayer"><param name="movie" value="http://www.howcast.com/flash/howcast_player.swf?file=233"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.howcast.com/flash/howcast_player.swf?file=233" type="application/x-shockwave-flash" width="425" height="352" allowFullScreen="true" allowScriptAccess="always" ></embed></object>]]>
99
+ </embed>
97
100
  <description>
98
101
  <![CDATA[You recognize the Noble Pose as the dreaded "sit-and-reach" from your childhood gym class. A sample <a href="howcast.com">link</a>]]>
99
102
  </description>
data/website/index.html CHANGED
@@ -33,30 +33,16 @@
33
33
  <h1></h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/howcast"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/howcast" class="numbers">0.4.1</a>
36
+ <a href="http://rubyforge.org/projects/howcast" class="numbers">0.4.3</a>
37
37
  </div>
38
38
  <h2>Howcast <span class="caps">API</span> Rubygem</h2>
39
-
40
-
41
- <h2>What</h2>
42
-
43
-
44
- <p>Howcast Rubygem is a Ruby library for interacting with the <a href="http://groups.google.com/group/howcast-developers">Howcast <span class="caps">API</span></a></p>
45
-
46
-
47
- <h2>Installing</h2>
48
-
49
-
50
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">howcast</span></pre></p>
51
-
52
-
53
- <p>After installing you will need to get an <span class="caps">API</span> Key from: <a href="http://www.howcast.com/api_keys/new">http://www.howcast.com/api_keys/new</a></p>
54
-
55
-
56
- <h2>Demonstration of usage</h2>
57
-
58
-
59
- <p><pre class='syntax'>
39
+ <h2>What</h2>
40
+ <p>Howcast Rubygem is a Ruby library for interacting with the <a href="http://groups.google.com/group/howcast-developers">Howcast <span class="caps">API</span></a></p>
41
+ <h2>Installing</h2>
42
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">howcast</span></pre></p>
43
+ <p>After installing you will need to get an <span class="caps">API</span> Key from: <a href="http://www.howcast.com/api_keys/new">http://www.howcast.com/api_keys/new</a></p>
44
+ <h2>Demonstration of usage</h2>
45
+ <p><pre class='syntax'>
60
46
  <span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span>
61
47
  <span class="ident">require</span> <span class="punct">'</span><span class="string">howcast</span><span class="punct">'</span>
62
48
 
@@ -80,33 +66,31 @@
80
66
 
81
67
  <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string">Video with id 946</span><span class="punct">&quot;</span>
82
68
  <span class="ident">puts</span> <span class="ident">hc</span><span class="punct">.</span><span class="ident">video</span><span class="punct">(</span><span class="number">946</span><span class="punct">).</span><span class="ident">title</span>
83
- </pre></p>
84
69
 
70
+ <span class="comment"># Category API</span>
71
+ <span class="ident">piano</span> <span class="punct">=</span> <span class="ident">hc</span><span class="punct">.</span><span class="ident">category</span><span class="punct">(</span><span class="number">1105</span><span class="punct">)</span>
72
+ <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string">The parent category of Piano is <span class="expr">#{hc.category(piano.parent_id).name}</span></span><span class="punct">&quot;</span>
85
73
 
86
- <h2>Forum, Support and Questions</h2>
87
-
88
-
89
- <p><a href="http://groups.google.com/group/howcast-developers">http://groups.google.com/group/howcast-developers</a></p>
90
-
91
-
92
- <h2>How to check out the code</h2>
93
-
94
-
95
- <p>The trunk repository is <code>svn://rubyforge.org/var/svn/howcast/trunk</code> for anonymous access.</p>
96
-
97
-
98
- <h2>License</h2>
99
-
100
-
101
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
102
-
103
-
104
- <h2>Contact</h2>
105
-
106
-
107
- <p>Comments are welcome. Send an email to <a href="mailto:michael@howcast.com">Michael Murray</a>.</p>
74
+ <span class="ident">ancestors</span> <span class="punct">=</span> <span class="ident">piano</span><span class="punct">.</span><span class="ident">parents</span><span class="punct">.</span><span class="ident">map</span><span class="punct">{|</span><span class="ident">c</span><span class="punct">|</span> <span class="ident">c</span><span class="punct">[</span><span class="symbol">:name</span><span class="punct">]}</span>
75
+ <span class="comment"># Ancestors will be an array of hash metadata: </span>
76
+ <span class="comment"># =&gt; [{:name=&gt;&quot;Performing Arts&quot;, :id=&gt;&quot;1048&quot;}, </span>
77
+ <span class="comment"># {:name=&gt;&quot;Musical Instruments&quot;, :id=&gt;&quot;1095&quot;}, </span>
78
+ <span class="comment"># {:name=&gt;&quot;Keyboards&quot;, :id=&gt;&quot;1103&quot;}]</span>
79
+ <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string">The ancestors of piano are: <span class="expr">#{ancestors.join(&quot; -&gt; &quot;)}</span></span><span class="punct">&quot;</span>
80
+ </pre></p>
81
+ <h2>Forum, Support and Questions</h2>
82
+ <ul>
83
+ <li><a href="http://howcast.rubyforge.org/rdoc">RDoc</a></li>
84
+ <li><a href="http://groups.google.com/group/howcast-developers">http://groups.google.com/group/howcast-developers</a></li>
85
+ </ul>
86
+ <h2>How to check out the code</h2>
87
+ <p>The git repository is <code>git://github.com/howcast/howcast-gem.git</code> for anonymous access.</p>
88
+ <h2>License</h2>
89
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
90
+ <h2>Contact</h2>
91
+ <p>Comments are welcome. Send an email to <a href="mailto:michael@howcast.com">Michael Murray</a>.</p>
108
92
  <p class="coda">
109
- <a href="mailto:michael@howcast.com">Michael Murray</a>, 3rd June 2008<br>
93
+ <a href="mailto:michael@howcast.com">Michael Murray</a>, 6th November 2008<br>
110
94
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
111
95
  </p>
112
96
  </div>
data/website/index.txt CHANGED
@@ -38,15 +38,27 @@ end
38
38
 
39
39
  puts "Video with id 946"
40
40
  puts hc.video(946).title
41
+
42
+ # Category API
43
+ piano = hc.category(1105)
44
+ puts "The parent category of Piano is #{hc.category(piano.parent_id).name}"
45
+
46
+ ancestors = piano.parents.map{|c| c[:name]}
47
+ # Ancestors will be an array of hash metadata:
48
+ # => [{:name=>"Performing Arts", :id=>"1048"},
49
+ # {:name=>"Musical Instruments", :id=>"1095"},
50
+ # {:name=>"Keyboards", :id=>"1103"}]
51
+ puts "The ancestors of piano are: #{ancestors.join(" -> ")}"
41
52
  </pre>
42
53
 
43
54
  h2. Forum, Support and Questions
44
55
 
45
- "http://groups.google.com/group/howcast-developers":http://groups.google.com/group/howcast-developers
56
+ * "RDoc":http://howcast.rubyforge.org/rdoc
57
+ * "http://groups.google.com/group/howcast-developers":http://groups.google.com/group/howcast-developers
46
58
 
47
59
  h2. How to check out the code
48
60
 
49
- The trunk repository is <code>svn://rubyforge.org/var/svn/howcast/trunk</code> for anonymous access.
61
+ The git repository is <code>git://github.com/howcast/howcast-gem.git</code> for anonymous access.
50
62
 
51
63
  h2. License
52
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howcast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Murray
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-06 00:00:00 -08:00
12
+ date: 2009-03-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: hpricot
16
+ name: why-hpricot
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,13 +43,12 @@ extra_rdoc_files:
43
43
  - History.txt
44
44
  - License.txt
45
45
  - Manifest.txt
46
- - README.txt
47
46
  - website/index.txt
48
47
  files:
49
48
  - History.txt
50
49
  - License.txt
51
50
  - Manifest.txt
52
- - README.txt
51
+ - README.markdown
53
52
  - Rakefile
54
53
  - config/hoe.rb
55
54
  - config/requirements.rb
@@ -105,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
104
  requirements: []
106
105
 
107
106
  rubyforge_project: howcast
108
- rubygems_version: 1.2.0
107
+ rubygems_version: 1.3.1
109
108
  signing_key:
110
109
  specification_version: 2
111
110
  summary: Howcast API Ruby Wrapper
data/README.txt DELETED
@@ -1,30 +0,0 @@
1
- Howcast API Ruby Wrapper
2
- Copyright (c) 2008 Howcast Media Inc.
3
-
4
- == Example
5
-
6
- An example ruby script to get some howcast videos
7
-
8
- require 'rubygems'
9
- require 'howcast'
10
-
11
- hc = Howcast::Client.new(:key => "INSERT API KEY HERE")
12
- # Will print out the video titles of the first page of recent howcast studios videos
13
- puts "Recent Howcast Studios Videos"
14
- hc.videos.each do |v|
15
- puts v.title
16
- end
17
-
18
- puts "2nd Page of Recent Featured Videos"
19
- # Will print out the video titles of the 2nd page of recent featured videos
20
- hc.videos(:page => 2, :sort => "most_recent", :filter => "featured").each do |v|
21
- puts v.title
22
- end
23
-
24
- puts "Videos matching 'origami'"
25
- hc.video_search("origami").each do |v|
26
- puts v.title
27
- end
28
-
29
- puts "Video with id 946"
30
- puts hc.video(946).title