kenshoo 0.1.6 → 0.1.7
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/Rakefile +1 -1
- data/kenshoo.gemspec +1 -1
- data/lib/kenshoo.rb +2 -2
- data/test/kenshoo_test.rb +3 -3
- metadata +3 -3
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ Bundler.setup
|
|
5
5
|
require 'rake'
|
6
6
|
require 'echoe'
|
7
7
|
|
8
|
-
Echoe.new('kenshoo', '0.1.
|
8
|
+
Echoe.new('kenshoo', '0.1.7') do |p|
|
9
9
|
p.description = "Append Kenshoo tracking id after the given affiliate link"
|
10
10
|
p.url = "http://github.com/58Phases/kenshoo"
|
11
11
|
p.author = "David Hsu"
|
data/kenshoo.gemspec
CHANGED
data/lib/kenshoo.rb
CHANGED
@@ -18,7 +18,7 @@ module Kenshoo
|
|
18
18
|
|
19
19
|
def self.link_with_tracking_id(instance, session)
|
20
20
|
link = instance.try(:link)
|
21
|
-
return nil unless [Coupon, Store].include?(instance.class) && link
|
21
|
+
return nil unless [Coupon, Store].include?(instance.class) && !link.blank?
|
22
22
|
|
23
23
|
network_code = nil
|
24
24
|
begin
|
@@ -36,7 +36,7 @@ module Kenshoo
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.wrap_link_with_tracking_id(link, network_code, session)
|
39
|
-
outlink = link.strip
|
39
|
+
outlink = link = link.strip
|
40
40
|
begin
|
41
41
|
tracking_param = KENSHOO_PARAMS[network_code]
|
42
42
|
if !session['sid'].blank? && !tracking_param.blank?
|
data/test/kenshoo_test.rb
CHANGED
@@ -3,14 +3,14 @@ require 'kenshoo'
|
|
3
3
|
|
4
4
|
class KenshooTest < Test::Unit::TestCase
|
5
5
|
def test_wrap_link_with_tracking_id
|
6
|
-
link = "http://www.tkqlhce.com/click-3986307-10731808"
|
6
|
+
link = " http://www.tkqlhce.com/click-3986307-10731808" # with extra space at the beginning
|
7
7
|
network_code = 'CJ'
|
8
8
|
session = {'sid' => '452b3346-37bb-0bc8-7290-000057cc146f'}
|
9
9
|
outlink = Kenshoo.wrap_link_with_tracking_id(link, network_code, session)
|
10
|
-
assert_equal outlink, "http://www.tkqlhce.com/click-3986307-10731808?
|
10
|
+
assert_equal outlink, "http://www.tkqlhce.com/click-3986307-10731808?sid=452b3346-37bb-0bc8-7290-000057cc146f"
|
11
11
|
|
12
12
|
network_code = 'LS'
|
13
13
|
outlink = Kenshoo.wrap_link_with_tracking_id(link, network_code, session)
|
14
|
-
assert_equal outlink, "http://www.tkqlhce.com/click-3986307-10731808?
|
14
|
+
assert_equal outlink, "http://www.tkqlhce.com/click-3986307-10731808?u1=452b3346-37bb-0bc8-7290-000057cc146f"
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kenshoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Hsu
|