howcast 0.4.15 → 0.4.16
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/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/howcast.gemspec +2 -4
- data/lib/howcast/client/category.rb +2 -2
- data/spec/howcast/client/category_spec.rb +5 -1
- data/spec/xml_fixtures_helper.rb +11 -17
- metadata +3 -5
- data/howcast-0.4.13.gem +0 -0
- data/howcast-0.4.14.gem +0 -0
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.16
|
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.16"
|
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-03-
|
12
|
+
s.date = %q{2010-03-16}
|
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,8 +31,6 @@ Gem::Specification.new do |s|
|
|
31
31
|
"README.markdown",
|
32
32
|
"Rakefile",
|
33
33
|
"VERSION",
|
34
|
-
"howcast-0.4.13.gem",
|
35
|
-
"howcast-0.4.14.gem",
|
36
34
|
"howcast.gemspec",
|
37
35
|
"lib/howcast.rb",
|
38
36
|
"lib/howcast/client.rb",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
class Howcast::Client
|
25
25
|
class Category
|
26
26
|
extend WatchAttrAccessors
|
27
|
-
attr_accessor :id, :name, :parent_id, :parents
|
27
|
+
attr_accessor :id, :name, :parent_id, :parents, :permalink
|
28
28
|
|
29
29
|
# Creates a new Category object which is used to encapsulate all the attributes available
|
30
30
|
# from the Howcast Category API. The parents attribute will be an array of category
|
@@ -98,7 +98,7 @@ class Howcast::Client
|
|
98
98
|
node_name = attribute.to_s.gsub("_", "-") # xml schema uses hyphens for spaces, but ruby uses underscores
|
99
99
|
hash[attribute] = !xml.at(node_name).nil? ? xml.at(node_name).inner_text.strip : ""
|
100
100
|
end
|
101
|
-
hash[:parents] = (xml.at('parents')/:category).map{ |c| {:id => c
|
101
|
+
hash[:parents] = (xml.at('parents')/:category).map{ |c| {:id => c.at('id').inner_text.strip, :name => c.at('name').inner_text.strip, :permalink => c.at('permalink').inner_text.strip }} unless xml.at('parents').nil?
|
102
102
|
hash.values.all?{|v| v==""} ? nil : Category.new(hash)
|
103
103
|
end
|
104
104
|
end
|
@@ -40,7 +40,11 @@ describe Howcast::Client, "category" do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should set the parents metadata hash" do
|
43
|
-
@hc.category(2).parents.should == [{:id => "1571", :name => "Travel"}, {:id => "1584", :name => "African Travel"}]
|
43
|
+
@hc.category(2).parents.should == [{:id => "1571", :name => "Travel", :permalink => "http://www.howcast.com/categories/1571-Travel"}, {:id => "1584", :name => "African Travel", :permalink => "http://www.howcast.com/categories/1584-African-Travel"}]
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should set the permalink" do
|
47
|
+
@hc.category(2).permalink.should == "http://www.howcast.com/categories/1585-General-African-Travel"
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
data/spec/xml_fixtures_helper.rb
CHANGED
@@ -43,30 +43,24 @@ module XmlFixturesHelper
|
|
43
43
|
<?xml version="1.0" encoding="UTF-8"?>
|
44
44
|
<howcast version="0.1">
|
45
45
|
<category>
|
46
|
-
<id>
|
46
|
+
<id>1585</id>
|
47
47
|
<name>General African Travel</name>
|
48
48
|
<parent-id>1584</parent-id>
|
49
|
+
<permalink>http://www.howcast.com/categories/1585-General-African-Travel</permalink>
|
49
50
|
<parents>
|
50
|
-
<category id="1571">Travel</category>
|
51
|
-
<category parent_id="1571" id="1584">African Travel</category>
|
52
|
-
</parents>
|
53
|
-
<subcategories>
|
54
|
-
<category>
|
55
|
-
<id>1265</id>
|
56
|
-
<name>African Travel</name>
|
57
|
-
</category>
|
58
51
|
<category>
|
59
|
-
<id>
|
60
|
-
<name>
|
52
|
+
<id>1571</id>
|
53
|
+
<name>Travel</name>
|
54
|
+
<permalink>http://www.howcast.com/categories/1571-Travel</permalink>
|
61
55
|
</category>
|
62
56
|
<category>
|
63
|
-
<id>
|
64
|
-
<name>
|
65
|
-
|
66
|
-
|
67
|
-
<id>1311</id>
|
68
|
-
<name>General U.S. Travel</name>
|
57
|
+
<id>1584</id>
|
58
|
+
<name>African Travel</name>
|
59
|
+
<parent-id>1571</parent-id>
|
60
|
+
<permalink>http://www.howcast.com/categories/1584-African-Travel</permalink>
|
69
61
|
</category>
|
62
|
+
</parents>
|
63
|
+
<subcategories>
|
70
64
|
</subcategories>
|
71
65
|
</category>
|
72
66
|
</howcast>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 16
|
9
|
+
version: 0.4.16
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jingshen Jimmy Zhang
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-16 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -57,8 +57,6 @@ files:
|
|
57
57
|
- README.markdown
|
58
58
|
- Rakefile
|
59
59
|
- VERSION
|
60
|
-
- howcast-0.4.13.gem
|
61
|
-
- howcast-0.4.14.gem
|
62
60
|
- howcast.gemspec
|
63
61
|
- lib/howcast.rb
|
64
62
|
- lib/howcast/client.rb
|
data/howcast-0.4.13.gem
DELETED
Binary file
|
data/howcast-0.4.14.gem
DELETED
Binary file
|