zunnit 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/zunnit/api.rb +8 -1
- data/lib/zunnit/version.rb +1 -1
- data/spec/zunnit_spec.rb +30 -18
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/zunnit/api.rb
CHANGED
data/lib/zunnit/version.rb
CHANGED
data/spec/zunnit_spec.rb
CHANGED
@@ -4,23 +4,40 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
4
4
|
describe Zunnit do
|
5
5
|
# let(zunnit) { Zunnit::Api.new }
|
6
6
|
|
7
|
-
describe "get" do
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
describe "get" do
|
8
|
+
it "should instanciate a Zunnit::Api object" do
|
9
|
+
default_key = Zunnit.key
|
10
|
+
default_client = Zunnit.client
|
11
|
+
default_version = Zunnit.version
|
12
|
+
|
13
|
+
zunnit = Zunnit::Api.new do |z|
|
14
|
+
z.key = "new-key"
|
15
|
+
z.version = "1.1"
|
16
|
+
end
|
17
|
+
|
18
|
+
zunnit.class.should == Zunnit::Api
|
19
|
+
zunnit.client.should == default_client
|
20
|
+
zunnit.key.should == "new-key"
|
21
|
+
zunnit.version.should == "1.1"
|
22
|
+
|
23
|
+
Zunnit.client.should == default_client
|
24
|
+
Zunnit.key.should == default_key
|
25
|
+
Zunnit.version.should == default_version
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return related items" do
|
29
|
+
response = Zunnit.api.get(:related_items,
|
11
30
|
:item_id => "20275919", :user_id => "255")
|
12
31
|
validate_response(response, :items)
|
13
32
|
end
|
14
33
|
|
15
34
|
it "should get 400 error if :item_id is not given to related items" do
|
16
|
-
|
17
|
-
response = zunnit.get(:related_items)
|
35
|
+
response = Zunnit.api.get(:related_items)
|
18
36
|
response[:status].should == 400
|
19
37
|
end
|
20
38
|
|
21
39
|
it "should return recommendation items for user" do
|
22
|
-
|
23
|
-
response = zunnit.get(:recommendation_items_for_user,
|
40
|
+
response = Zunnit.api.get(:recommendation_items_for_user,
|
24
41
|
:user_id => "255")
|
25
42
|
validate_response(response, :items)
|
26
43
|
end
|
@@ -28,40 +45,35 @@ describe Zunnit do
|
|
28
45
|
|
29
46
|
it "should return recommendation groups for user" do
|
30
47
|
pending "404"
|
31
|
-
|
32
|
-
response = zunnit.get(:recommendation_groups_for_user,
|
48
|
+
response = Zunnit.api.get(:recommendation_groups_for_user,
|
33
49
|
:user_id => "255")
|
34
50
|
validate_response(response, :groups)
|
35
51
|
end
|
36
52
|
|
37
53
|
it "should return recommendation users for user" do
|
38
54
|
pending "404"
|
39
|
-
|
40
|
-
response = zunnit.get(:recommendation_groups_for_user,
|
55
|
+
response = Zunnit.api.get(:recommendation_groups_for_user,
|
41
56
|
:user_id => "2155")
|
42
57
|
validate_response(response, :users)
|
43
58
|
end
|
44
59
|
|
45
60
|
it "should return recommendation users for item" do
|
46
61
|
pending "It should return a collection of users but is returning items"
|
47
|
-
|
48
|
-
response = zunnit.get(:recommendation_items_for_user,
|
62
|
+
response = Zunnit.api.get(:recommendation_items_for_user,
|
49
63
|
:item_id => "20275919", :user_id => "255")
|
50
64
|
validate_response(response, :users)
|
51
65
|
end
|
52
66
|
|
53
67
|
it "should return recommendation tags for item" do
|
54
68
|
pending "404"
|
55
|
-
|
56
|
-
response = zunnit.get(:recommendation_tags_for_item,
|
69
|
+
response = Zunnit.api.get(:recommendation_tags_for_item,
|
57
70
|
:item_id => "20275919")
|
58
71
|
validate_response(response, :tags)
|
59
72
|
end
|
60
73
|
|
61
74
|
it "should return recommendation cluster for item" do
|
62
75
|
pending "404"
|
63
|
-
|
64
|
-
response = zunnit.get(:recommendation_cluster_for_item,
|
76
|
+
response = Zunnit.api.get(:recommendation_cluster_for_item,
|
65
77
|
:item_id => "20275919")
|
66
78
|
validate_response(response, :clusters)
|
67
79
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: zunnit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Marcelo Eden
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-23 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|