zunnit 0.3.8 → 0.3.9

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/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",
@@ -1,4 +1,4 @@
1
1
  module Zunnit
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
4
4
 
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 = uri + params.map {|k,v| "#{k}=#{v}" }.join("&") unless method.to_s =~ /post|put/
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.8
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-27 00:00:00 -03:00
13
+ date: 2011-09-29 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency