attune 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/attune/api/anonymous.rb +10 -2
- data/lib/attune/api/entities.rb +7 -0
- data/lib/attune/client.rb +1 -0
- data/lib/attune/version.rb +1 -1
- data/spec/remote_spec.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0159ef82e975c3c83da37fbcacff8a4522f3d8e1
|
4
|
+
data.tar.gz: 3cca0e62024f0c69f1124e8c59e2c477318ab34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1e4d7fc039158b5c34a82de11399ac264f7f120a06bea229fb03e9d531a1ff070b1b4cb1be9532b6023b17e92ed10fdcb1c971bcf5148b0d9336138df71885
|
7
|
+
data.tar.gz: e7d9cb35dbcc8e14f5fbc8b5f0d381e1d4626d366c6db594890528781c76a66aa7033ae0f5616963227494c3afab0a869bfb0ab74ab230a79b0d869372120368
|
data/lib/attune/api/anonymous.rb
CHANGED
@@ -59,7 +59,11 @@ module Attune
|
|
59
59
|
query_param_keys = []
|
60
60
|
|
61
61
|
# verify existence of params
|
62
|
-
raise ArgumentError, "anonymous is required" if anonymous.nil?
|
62
|
+
#raise ArgumentError, "anonymous is required" if anonymous.nil?
|
63
|
+
if anonymous == nil
|
64
|
+
anonymous = SecureRandom.uuid
|
65
|
+
end
|
66
|
+
|
63
67
|
raise ArgumentError, "body is required" if body.nil?
|
64
68
|
# set default values and merge with input
|
65
69
|
options = {
|
@@ -112,7 +116,11 @@ module Attune
|
|
112
116
|
query_param_keys = []
|
113
117
|
|
114
118
|
# verify existence of params
|
115
|
-
raise ArgumentError, "anonymous is required" if anonymous.nil?
|
119
|
+
# raise ArgumentError, "anonymous is required" if anonymous.nil?
|
120
|
+
if anonymous == nil
|
121
|
+
anonymous = SecureRandom.uuid
|
122
|
+
end
|
123
|
+
|
116
124
|
# set default values and merge with input
|
117
125
|
options = {
|
118
126
|
:anonymous => anonymous}
|
data/lib/attune/api/entities.rb
CHANGED
@@ -274,6 +274,8 @@ module Attune
|
|
274
274
|
#resource path
|
275
275
|
path = "/entities/ranking".sub('{format}','json')
|
276
276
|
|
277
|
+
|
278
|
+
|
277
279
|
# pull querystring keys from options
|
278
280
|
queryopts = options.select do |key,value|
|
279
281
|
query_param_keys.include? key
|
@@ -301,6 +303,11 @@ module Attune
|
|
301
303
|
end
|
302
304
|
end
|
303
305
|
end
|
306
|
+
|
307
|
+
if !post_body.has_key?("anonymous".to_sym)
|
308
|
+
post_body['anonymous'] = SecureRandom.uuid
|
309
|
+
end
|
310
|
+
|
304
311
|
response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
305
312
|
if response
|
306
313
|
Attune::Model::RankedEntities.new(JSON.parse(response.body))
|
data/lib/attune/client.rb
CHANGED
@@ -70,6 +70,7 @@ module Attune
|
|
70
70
|
adapter_method.call do |req|
|
71
71
|
req.url path
|
72
72
|
req.headers['Content-Type'] = 'application/json'
|
73
|
+
req.headers['User-Agent'] = 'Attune RClient ' + Attune::VERSION
|
73
74
|
req.headers.merge! opts[:headers] if opts[:headers]
|
74
75
|
req.params = opts[:params] if opts[:params]
|
75
76
|
req.body = ::JSON.dump(opts[:body]) if opts[:body]
|
data/lib/attune/version.rb
CHANGED
data/spec/remote_spec.rb
CHANGED
@@ -26,17 +26,19 @@ describe "remote requests" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "can bind and get an anonymous user" do
|
29
|
-
|
30
|
-
|
29
|
+
uuid = SecureRandom.uuid
|
30
|
+
client.anonymous.update(uuid, Attune::Model::Customer.new(customer:'foobar'))
|
31
|
+
customer = client.anonymous.get(uuid)
|
31
32
|
customer.customer.should == 'foobar'
|
32
33
|
end
|
33
34
|
|
34
35
|
let(:entities){ [202875,202876,202874,202900,202902,202898,202905,200182,200181,185940,188447,185932,190589,1238689589] }
|
35
36
|
describe "get_rankings" do
|
36
37
|
before(:each) do
|
37
|
-
anonymous_result = client.anonymous.create
|
38
|
+
# anonymous_result = client.anonymous.create
|
38
39
|
params = Attune::Model::RankingParams.new
|
39
|
-
params.anonymous = anonymous_result.id
|
40
|
+
# params.anonymous = anonymous_result.id
|
41
|
+
# params.anonymous = SecureRandom.uuid
|
40
42
|
params.view = 'b/mens-pants'
|
41
43
|
params.entity_type = 'products'
|
42
44
|
params.ids = entities
|
@@ -50,9 +52,10 @@ describe "remote requests" do
|
|
50
52
|
|
51
53
|
describe "multi_get_rankings" do
|
52
54
|
before(:each) do
|
53
|
-
anonymous_result = client.anonymous.create
|
55
|
+
# anonymous_result = client.anonymous.create
|
54
56
|
params = Attune::Model::RankingParams.new
|
55
|
-
params.anonymous = anonymous_result.id
|
57
|
+
# params.anonymous = anonymous_result.id
|
58
|
+
params.anonymous = SecureRandom.uuid
|
56
59
|
params.view = 'b/mens-pants'
|
57
60
|
params.entity_type = 'products'
|
58
61
|
params.ids = entities
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|