affilimator 0.0.1.1 → 0.0.2
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/affilimator.gemspec +2 -2
- data/lib/affilimator.rb +18 -16
- metadata +2 -2
data/affilimator.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'affilimator'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2012-11-
|
3
|
+
s.version = '0.0.2'
|
4
|
+
s.date = '2012-11-02'
|
5
5
|
s.summary = "Affiliate Management Gem"
|
6
6
|
s.description = "A simple affilimator client gem"
|
7
7
|
s.authors = ["Carson Gross"]
|
data/lib/affilimator.rb
CHANGED
@@ -13,6 +13,7 @@ class Affilimator
|
|
13
13
|
@@public_key = nil
|
14
14
|
@@logging_proc = nil
|
15
15
|
@@minified_js = nil
|
16
|
+
@@warned_on_config = false
|
16
17
|
|
17
18
|
def self.convert(email, plan)
|
18
19
|
if configured
|
@@ -53,21 +54,23 @@ class Affilimator
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def self.register_js(email, cookies = nil, include_lib = true, in_script_tag = true)
|
56
|
-
if
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
if configured
|
58
|
+
if cookies and cookies[:aflm_st] == "r"
|
59
|
+
"" # user is registered, emit nothing
|
60
|
+
else
|
61
|
+
js = ""
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
if include_lib then
|
64
|
+
js += minified_js
|
65
|
+
end
|
64
66
|
|
65
|
-
|
67
|
+
js += "Affilimator.register({key: '#{aff_public_key}', email:'#{email}'})"
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
if in_script_tag then
|
70
|
+
js = "<script type=\"text/javascript\">" + js + "</script>"
|
71
|
+
end
|
72
|
+
js
|
69
73
|
end
|
70
|
-
js
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
@@ -82,9 +85,9 @@ class Affilimator
|
|
82
85
|
true
|
83
86
|
else
|
84
87
|
if not @@warned_on_config
|
85
|
-
puts "Affilimator is not configured for this environment. If that is not your intent, either "
|
86
|
-
puts "configure it via the Affilimator.config() call or using the AFFILIMATOR_PRIVATE_KEY and "
|
87
|
-
puts "
|
88
|
+
puts "WARN: Affilimator is not configured for this environment. If that is not your intent, either "
|
89
|
+
puts "WARN: configure it via the Affilimator.config() call or using the AFFILIMATOR_PRIVATE_KEY and "
|
90
|
+
puts "WARN: AFFILIMATOR_PUBLIC_KEY environment variables."
|
88
91
|
@@warned_on_config = true
|
89
92
|
end
|
90
93
|
end
|
@@ -124,8 +127,7 @@ class Affilimator
|
|
124
127
|
end
|
125
128
|
|
126
129
|
def self.locate_gem(name)
|
127
|
-
|
128
|
-
spec.gem_dir
|
130
|
+
Gem.loaded_specs['affilimator'].full_gem_path
|
129
131
|
end
|
130
132
|
|
131
133
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: affilimator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Carson Gross
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-02 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json_pure
|