howcast 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/howcast-0.4.10.gem +0 -0
- data/howcast.gemspec +3 -2
- data/lib/howcast/client/video.rb +19 -19
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.11
|
data/howcast-0.4.10.gem
ADDED
Binary file
|
data/howcast.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{howcast}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jingshen Jimmy Zhang", "Ian Smith-Heisters"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-20}
|
13
13
|
s.description = %q{ Howcast offers an Application Programming Interface (API) which allows
|
14
14
|
developers to build applications that interface with Howcast. The Howcast
|
15
15
|
API is RESTful (REpresentational State Transfer) and users of this API will
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"README.markdown",
|
32
32
|
"Rakefile",
|
33
33
|
"VERSION",
|
34
|
+
"howcast-0.4.10.gem",
|
34
35
|
"howcast.gemspec",
|
35
36
|
"lib/howcast.rb",
|
36
37
|
"lib/howcast/client.rb",
|
data/lib/howcast/client/video.rb
CHANGED
@@ -28,17 +28,17 @@ class Howcast::Client
|
|
28
28
|
@attr_accessors ||= []
|
29
29
|
@attr_accessors += args
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def attr_accessors
|
33
33
|
@attr_accessors || []
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
class Video
|
38
38
|
extend WatchAttrAccessors
|
39
|
-
attr_accessor :id, :title, :permalink, :thumbnail_url, :category_id,
|
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, :embed
|
41
|
+
:badges, :easy_steps, :embed, :type
|
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
|
#
|
@@ -47,7 +47,7 @@ class Howcast::Client
|
|
47
47
|
# * <tt>attributes</tt> -- A hash to set the various attributes of the video object
|
48
48
|
#
|
49
49
|
# === Examples
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# Initialize a video with title "hello" and rating 20
|
52
52
|
# Video.new :title => "hello", :rating => 20
|
53
53
|
def initialize(attributes={})
|
@@ -55,38 +55,38 @@ class Howcast::Client
|
|
55
55
|
self.send("#{k}=", v) if self.respond_to?(k)
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
# Return true if the video contains easy step by step directions, else false
|
60
60
|
def easy_steps?
|
61
61
|
easy_steps == "true"
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
# Provides access to the Howcast video API.
|
66
|
-
#
|
66
|
+
#
|
67
67
|
# === Inputs
|
68
68
|
#
|
69
69
|
# * <tt>id</tt> -- The id of the video to lookup
|
70
70
|
#
|
71
71
|
# === Outputs
|
72
|
-
#
|
72
|
+
#
|
73
73
|
# Video object if the id exists or nil if the id doesn't exist or is malformed
|
74
74
|
#
|
75
75
|
# === Exceptions
|
76
|
-
#
|
76
|
+
#
|
77
77
|
# * <tt>Howcast::ApiNotFound</tt>
|
78
78
|
#
|
79
79
|
# === Examples
|
80
|
-
#
|
80
|
+
#
|
81
81
|
# Get the Howcast video with id 2
|
82
82
|
# Howcast::Client.new.video(2)
|
83
83
|
def video(id)
|
84
84
|
response = establish_connection("videos/#{id}.xml")
|
85
85
|
parse_single_xml(response.at(:video), Video)
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
# Provides access to the Howcast list videos API.
|
89
|
-
#
|
89
|
+
#
|
90
90
|
# === Inputs
|
91
91
|
#
|
92
92
|
# The options are:
|
@@ -102,17 +102,17 @@ class Howcast::Client
|
|
102
102
|
#
|
103
103
|
# === Examples
|
104
104
|
#
|
105
|
-
# Get the first page of most recent howcast studios videos.
|
105
|
+
# Get the first page of most recent howcast studios videos.
|
106
106
|
# Howcast::Client.new.videos
|
107
107
|
# Get the third page of top favorites which are featured
|
108
108
|
# Howcast::Client.new.videos(:page => 3, :sort => "top_favorites", :filter => "top_rated")
|
109
|
-
|
109
|
+
def videos(options = {})
|
110
110
|
uri = videos_url(options)
|
111
111
|
(establish_connection(uri)/:video).inject([]){ |r, i| r << parse_single_xml(i, Video)}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
def videos_url(options={})
|
116
116
|
defaults = {:page => nil, :sort => "most_recent", :filter => "howcast_studios", :category_id => nil}
|
117
117
|
options = defaults.update(options)
|
118
118
|
"videos/#{options[:sort]}/#{options[:filter]}#{"/#{options[:category_id]}" if options[:category_id]}#{"/#{options[:page]}" if options[:page]}.xml"
|
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.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jingshen Jimmy Zhang
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01-
|
13
|
+
date: 2010-01-20 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- README.markdown
|
49
49
|
- Rakefile
|
50
50
|
- VERSION
|
51
|
+
- howcast-0.4.10.gem
|
51
52
|
- howcast.gemspec
|
52
53
|
- lib/howcast.rb
|
53
54
|
- lib/howcast/client.rb
|