kenshoo 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
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.6') do |p|
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{kenshoo}
5
- s.version = "0.1.6"
5
+ s.version = "0.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["David Hsu"]
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?SID=452b3346-37bb-0bc8-7290-000057cc146f"
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?U1=452b3346-37bb-0bc8-7290-000057cc146f"
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Hsu