talon_one 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/integration/client.rb +2 -1
- data/lib/integration/client_error.rb +9 -0
- data/talon_one.gemspec +2 -2
- data/test/test_integration_api_live.rb +13 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18f0015fc47df3940ed680ecea31d131be528b8
|
4
|
+
data.tar.gz: 40b19f136345f6b6b9e46ffe3935025c95312a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb9274252cd2350a2556835aea585903bf6fb90bca74bbdb11f3d69ecb084c22e3609238860c4bcf385c71cefe817d7cb1f5a718df3ad97c8f38dfa340a2196c
|
7
|
+
data.tar.gz: 545b4c5400fb59d2c112d8b4cf4633170dea301b15f0e47eb1c08089105d29a6d0f8a47d9fa1b3c4880516352bc3ffdca1652cdf2e714a37fba175ef42a7eba5
|
data/CHANGELOG.md
CHANGED
data/lib/integration/client.rb
CHANGED
@@ -4,6 +4,7 @@ require 'oj'
|
|
4
4
|
require_relative './search_profiles_result'
|
5
5
|
require_relative './rule_engine_result'
|
6
6
|
require_relative './referral_code'
|
7
|
+
require_relative './client_error'
|
7
8
|
|
8
9
|
module TalonOne
|
9
10
|
module Integration
|
@@ -34,7 +35,7 @@ module TalonOne
|
|
34
35
|
if res.code[0] == '2'
|
35
36
|
result.new(Oj.load(res.body, oj_options(:strict)))
|
36
37
|
else
|
37
|
-
raise "#{method.upcase} #{path} -> #{res.code} #{res.body}"
|
38
|
+
raise TalonOne::Integration::ClientError.new("#{method.upcase} #{path} -> #{res.code} #{res.body}")
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
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.0.
|
4
|
-
s.date = '2017-06-
|
3
|
+
s.version = '0.0.10'
|
4
|
+
s.date = '2017-06-13'
|
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']
|
@@ -17,7 +17,8 @@ class TestIntegrationApiLive < LiveApiTest
|
|
17
17
|
|
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
22
|
end
|
22
23
|
|
23
24
|
def teardown
|
@@ -30,7 +31,7 @@ class TestIntegrationApiLive < LiveApiTest
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def test_track_event
|
33
|
-
res = integration_client.track_event "a-session",
|
34
|
+
res = integration_client.track_event "a-session", @event_type, { URL: "http://example.com" }
|
34
35
|
assert res.profile
|
35
36
|
assert res.session
|
36
37
|
assert_instance_of TalonOne::Integration::Event, res.event
|
@@ -38,7 +39,7 @@ class TestIntegrationApiLive < LiveApiTest
|
|
38
39
|
assert !res.event.accepted_coupon?, "No coupon -> no acceptCoupon effect"
|
39
40
|
assert_equal 1, res.event.effects.length
|
40
41
|
assert_equal "setDiscount", res.event.effects[0].function
|
41
|
-
assert_equal
|
42
|
+
assert_equal @event_type, res.event.type
|
42
43
|
assert_equal "a-session", res.event.session_id, "a-session"
|
43
44
|
assert_equal({ "URL" => "http://example.com" }, res.event.attributes)
|
44
45
|
assert_instance_of BigDecimal, res.session["discounts"]["Free money"]
|
@@ -51,4 +52,13 @@ class TestIntegrationApiLive < LiveApiTest
|
|
51
52
|
}
|
52
53
|
assert res.event.rejected_coupon?, "invalid coupon code was rejected"
|
53
54
|
end
|
55
|
+
|
56
|
+
def test_raise_error
|
57
|
+
err = assert_raises TalonOne::Integration::ClientError do
|
58
|
+
integration_client.track_event "a-session", @event_type, { BADURL: "http://example.com" }
|
59
|
+
end
|
60
|
+
|
61
|
+
assert_includes err.message, '400'
|
62
|
+
end
|
63
|
+
|
54
64
|
end
|
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.0.
|
4
|
+
version: 0.0.10
|
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: 2017-06-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- lib/integration/client.rb
|
70
|
+
- lib/integration/client_error.rb
|
70
71
|
- lib/integration/customer_profile.rb
|
71
72
|
- lib/integration/effect.rb
|
72
73
|
- lib/integration/event.rb
|