kenshoo 0.1.0 → 0.1.1
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/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/kenshoo.gemspec +5 -5
- data/lib/kenshoo.rb +12 -12
- metadata +7 -7
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -5,9 +5,9 @@ Bundler.setup
|
|
5
5
|
require 'rake'
|
6
6
|
require 'echoe'
|
7
7
|
|
8
|
-
Echoe.new('kenshoo', '0.1.
|
9
|
-
p.description = "
|
10
|
-
p.url = "http://github.com/
|
8
|
+
Echoe.new('kenshoo', '0.1.1') do |p|
|
9
|
+
p.description = "Append Kenshoo tracking id after the given affiliate link"
|
10
|
+
p.url = "http://github.com/58Phases/kenshoo"
|
11
11
|
p.author = "David Hsu"
|
12
12
|
p.email = "david@yibs.com"
|
13
13
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
data/kenshoo.gemspec
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{kenshoo}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
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"]
|
9
|
-
s.date = %q{2010-12-
|
10
|
-
s.description = %q{
|
9
|
+
s.date = %q{2010-12-13}
|
10
|
+
s.description = %q{Append Kenshoo tracking id after the given affiliate link}
|
11
11
|
s.email = %q{david@yibs.com}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/kenshoo.rb"]
|
13
13
|
s.files = ["Gemfile", "Gemfile.lock", "Manifest", "README.rdoc", "Rakefile", "lib/kenshoo.rb", "test/kenshoo_test.rb", "kenshoo.gemspec"]
|
14
|
-
s.homepage = %q{http://github.com/
|
14
|
+
s.homepage = %q{http://github.com/58Phases/kenshoo}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Kenshoo", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{kenshoo}
|
18
18
|
s.rubygems_version = %q{1.3.7}
|
19
|
-
s.summary = %q{
|
19
|
+
s.summary = %q{Append Kenshoo tracking id after the given affiliate link}
|
20
20
|
s.test_files = ["test/kenshoo_test.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
data/lib/kenshoo.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'action_controller'
|
2
2
|
|
3
3
|
module Kenshoo
|
4
|
-
def self.included(base)
|
5
|
-
# Automatic before filter (optional)
|
4
|
+
def self.included(base)
|
6
5
|
base.before_filter :set_kenshoo_tracking_id
|
7
6
|
end
|
8
7
|
|
@@ -14,8 +13,12 @@ module Kenshoo
|
|
14
13
|
network_code = nil
|
15
14
|
begin
|
16
15
|
network_code = instance.store.affiliate_network.code
|
17
|
-
rescue
|
18
|
-
|
16
|
+
rescue => e
|
17
|
+
message = "[Kenshoo] Error when getting network code from coupon##{instance.try(:id)}"
|
18
|
+
if defined?(HoptoadNotifier) == "constant"
|
19
|
+
HoptoadNotifier.notify(:error_class => e.class.name, :error_message => "#{e.message} | #{message}")
|
20
|
+
end
|
21
|
+
puts message
|
19
22
|
end
|
20
23
|
return wrap_link_with_tracking_id(link, network_code, session)
|
21
24
|
else
|
@@ -30,25 +33,22 @@ module Kenshoo
|
|
30
33
|
if !session['sid'].blank? && !tracking_param.blank?
|
31
34
|
uri = URI(link)
|
32
35
|
if uri.query
|
33
|
-
uri.query << "&#{tracking_param
|
36
|
+
uri.query << "&#{tracking_param}=#{session['sid']}"
|
34
37
|
else
|
35
|
-
uri.query = "#{tracking_param
|
38
|
+
uri.query = "#{tracking_param}=#{session['sid']}"
|
36
39
|
end
|
37
40
|
outlink = uri.to_s
|
38
41
|
end
|
39
42
|
rescue => e
|
43
|
+
message = "[Kenshoo] Error when appending tracking id to link##{link} with network_code##{network_code}"
|
40
44
|
if defined?(HoptoadNotifier) == "constant"
|
41
|
-
HoptoadNotifier.notify(:error_class => e.class.name, :error_message => e.message)
|
45
|
+
HoptoadNotifier.notify(:error_class => e.class.name, :error_message => "#{e.message} | #{message}")
|
42
46
|
end
|
43
|
-
puts
|
47
|
+
puts message
|
44
48
|
end
|
45
49
|
return outlink
|
46
50
|
end
|
47
51
|
|
48
|
-
module ClassMethods
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
52
|
private
|
53
53
|
|
54
54
|
def set_kenshoo_tracking_id
|
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Hsu
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-13 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description:
|
22
|
+
description: Append Kenshoo tracking id after the given affiliate link
|
23
23
|
email: david@yibs.com
|
24
24
|
executables: []
|
25
25
|
|
@@ -38,7 +38,7 @@ files:
|
|
38
38
|
- test/kenshoo_test.rb
|
39
39
|
- kenshoo.gemspec
|
40
40
|
has_rdoc: true
|
41
|
-
homepage: http://github.com/
|
41
|
+
homepage: http://github.com/58Phases/kenshoo
|
42
42
|
licenses: []
|
43
43
|
|
44
44
|
post_install_message:
|
@@ -76,6 +76,6 @@ rubyforge_project: kenshoo
|
|
76
76
|
rubygems_version: 1.3.7
|
77
77
|
signing_key:
|
78
78
|
specification_version: 3
|
79
|
-
summary:
|
79
|
+
summary: Append Kenshoo tracking id after the given affiliate link
|
80
80
|
test_files:
|
81
81
|
- test/kenshoo_test.rb
|