zunnit 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zunnit/setup.rb +1 -0
- data/lib/zunnit/version.rb +1 -1
- data/spec/zunnit_spec.rb +29 -1
- metadata +2 -2
data/lib/zunnit/setup.rb
CHANGED
@@ -11,6 +11,7 @@ module Zunnit
|
|
11
11
|
:recommendation_users_for_item => "/recommendation/users/for_item",
|
12
12
|
:recommendation_tags_for_item => "/recommendation/tags/for_item",
|
13
13
|
:recommendation_cluster_for_item => "/recommendation/cluster/for_item",
|
14
|
+
:recommendation_products_for_item => "/recommendations/products/for_item",
|
14
15
|
:action_items_add => "/action/items/add",
|
15
16
|
:action_items_rate => "/action/items/rate",
|
16
17
|
:action_items_view => "/action/items/view",
|
data/lib/zunnit/version.rb
CHANGED
data/spec/zunnit_spec.rb
CHANGED
@@ -79,6 +79,33 @@ describe Zunnit do
|
|
79
79
|
:item_id => "20275919"
|
80
80
|
validate_response(response, :cluster)
|
81
81
|
end
|
82
|
+
|
83
|
+
it "should return recommendation product for item" do
|
84
|
+
intercept_request_to :get,
|
85
|
+
:action => :recommendation_products_for_item,
|
86
|
+
:params => { :item_id => "2121" },
|
87
|
+
:response => {
|
88
|
+
:status => 200,
|
89
|
+
:body => {
|
90
|
+
:msg => 'Ok',
|
91
|
+
:status => 200,
|
92
|
+
:rec_id => "dba158a81706dbd",
|
93
|
+
:products => [
|
94
|
+
{
|
95
|
+
:id => "MLB199848107",
|
96
|
+
:title => "Relógio Nike",
|
97
|
+
:price => 199.99,
|
98
|
+
:thumbnail => "http://img1.mlstatic.com/s_MLB_v_I_f_156827423_9293.jpg"
|
99
|
+
}
|
100
|
+
]
|
101
|
+
}.to_json
|
102
|
+
}
|
103
|
+
|
104
|
+
response = Zunnit.api.get :recommendation_products_for_item,
|
105
|
+
:item_id => "2121"
|
106
|
+
|
107
|
+
validate_response(response, :products)
|
108
|
+
end
|
82
109
|
end
|
83
110
|
|
84
111
|
describe "post" do
|
@@ -127,9 +154,10 @@ describe Zunnit do
|
|
127
154
|
def intercept_request_to(method, options)
|
128
155
|
action = options.delete(:action)
|
129
156
|
params = options.delete(:params)
|
157
|
+
params = params.merge :api_key => Zunnit.key
|
130
158
|
response = options.delete(:response)
|
131
159
|
uri = URI.parse(Zunnit.url).merge(Zunnit.actions[action])
|
132
|
-
uri =
|
160
|
+
uri.query = params.map {|k,v| "#{k}=#{v}" }.join("&") unless method.to_s =~ /post|put/
|
133
161
|
FakeWeb.register_uri(method, uri, response)
|
134
162
|
end
|
135
163
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: zunnit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.9
|
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-09-
|
13
|
+
date: 2011-09-29 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|