talon_one 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +4 -0
- data/lib/integration/client.rb +12 -6
- data/talon_one.gemspec +2 -2
- data/test/test_integration_api_live.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68514d0a0f532ebe77dafebc779165ea4e5e54f9
|
4
|
+
data.tar.gz: f4feeae056e5f9dd35e317d221e064ddf5ecd512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94bf2fc2b3ef0a0fafe5f34326faa65b7a5ae93c08a8c4eb45fd25494c39d61d1891e9e8c62b73768cfdf3765f3a328b85f5e119ac99ddaf0e72ad3bb435de5
|
7
|
+
data.tar.gz: f9ad0943f28592fc0f3dd5915476a0aa90395a15c36953437b31fa62f52a004c3937014371aa30150e5a9434fbaddd7a834939f17dc72796b252e97d04b7359d
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/integration/client.rb
CHANGED
@@ -32,23 +32,25 @@ module TalonOne
|
|
32
32
|
|
33
33
|
res = @http.request(req)
|
34
34
|
|
35
|
-
if res.code[0] == '2'
|
35
|
+
if res.code[0] == '2' && res.code != '204'
|
36
36
|
result.new(Oj.load(res.body, oj_options(:strict)))
|
37
|
+
elsif res.code == '204'
|
38
|
+
true
|
37
39
|
else
|
38
40
|
raise TalonOne::Integration::ClientError.new("#{method.upcase} #{path} -> #{res.code} #{res.body}")
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
def track_event(session_id, event_type, value)
|
43
|
-
request
|
45
|
+
request("Post", "/v1/events", { sessionId: session_id, type: event_type, attributes: value })
|
44
46
|
end
|
45
47
|
|
46
48
|
def update_customer_session(session_id, data)
|
47
|
-
request
|
49
|
+
request("Put", "/v1/customer_sessions/#{session_id}", data)
|
48
50
|
end
|
49
51
|
|
50
52
|
def update_customer_profile(profile_id, data)
|
51
|
-
request
|
53
|
+
request("Put", "/v1/customer_profiles/#{profile_id}", data)
|
52
54
|
end
|
53
55
|
|
54
56
|
def close_customer_session(session_id)
|
@@ -67,11 +69,15 @@ module TalonOne
|
|
67
69
|
if expire
|
68
70
|
newReferral[:expiryDate] = expire
|
69
71
|
end
|
70
|
-
request
|
72
|
+
request("Post", "/v1/referrals", newReferral, TalonOne::Integration::ReferralCode)
|
71
73
|
end
|
72
74
|
|
73
75
|
def search_profiles_by_attributes(profileAttr)
|
74
|
-
request
|
76
|
+
request("Post", "/v1/customer_profiles_search", { attributes: profileAttr }, TalonOne::Integration::SearchProfilesResult)
|
77
|
+
end
|
78
|
+
|
79
|
+
def delete_customer_data(customerId)
|
80
|
+
request("Delete", "/v1/customer_data/#{customerId}", nil, nil)
|
75
81
|
end
|
76
82
|
|
77
83
|
private
|
data/talon_one.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'talon_one'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2018-
|
3
|
+
s.version = '0.1.3'
|
4
|
+
s.date = '2018-11-05'
|
5
5
|
s.summary = 'Client for the Talon.One API'
|
6
6
|
s.description = 'A simple client for using the Talon.One API'
|
7
7
|
s.authors = ['Talon.One GmbH']
|
@@ -18,11 +18,11 @@ class TestIntegrationApiLive < LiveApiTest
|
|
18
18
|
management_client.update_campaign_status @app["id"], @campaign["id"], "enabled"
|
19
19
|
|
20
20
|
@event_type ||= "Viewed Page#{rand(36**3).to_s(36)}"
|
21
|
-
@attribute ||= management_client.create_attribute({ entity: "Event", eventType: @event_type, name: "URL", title: "Page URL", type: "string", description: "The URL of the page that the user has viewed", tags: [], editable: true })
|
21
|
+
@attribute ||= management_client.create_attribute({ entity: "Event", eventType: @event_type, name: "URL", title: "Page URL", type: "string", description: "The URL of the page that the user has viewed", tags: [], suggestions: [], editable: true })
|
22
22
|
|
23
23
|
@coupon_code = "mycode"
|
24
24
|
@attribute_name = "Description#{rand(36**3).to_s(36)}"
|
25
|
-
@coupon_attribute ||= management_client.create_attribute({ entity: "Coupon", name: @attribute_name, title: "#{rand(36**3).to_s(36)}", type: "string", description: "Description for this coupon", tags: [], editable: true })
|
25
|
+
@coupon_attribute ||= management_client.create_attribute({ entity: "Coupon", name: @attribute_name, title: "#{rand(36**3).to_s(36)}", type: "string", description: "Description for this coupon", tags: [], suggestions: [], editable: true })
|
26
26
|
@coupon ||= management_client.create_coupon(@app["id"], @campaign["id"], { validCharacters: [], couponPattern: @coupon_code, usageLimit: 0, numberOfCoupons: 1, attributes: { @attribute_name.to_sym => "some text" } })
|
27
27
|
end
|
28
28
|
|
@@ -50,7 +50,7 @@ class TestIntegrationApiLive < LiveApiTest
|
|
50
50
|
def test_update_customer_session
|
51
51
|
res = integration_client.update_customer_session "new-session#{rand(36**3).to_s(36)}", {
|
52
52
|
coupon: @coupon_code,
|
53
|
-
total:
|
53
|
+
total: 45.55,
|
54
54
|
}
|
55
55
|
assert res.event.accepted_coupon?, "coupon code was accepted"
|
56
56
|
assert_equal 2, res.event.effects.length
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: talon_one
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Talon.One GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.6.
|
103
|
+
rubygems_version: 2.6.13
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Client for the Talon.One API
|