affilimator 0.0.1.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/affilimator.gemspec +2 -2
  2. data/lib/affilimator.rb +18 -16
  3. 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.1.1'
4
- s.date = '2012-11-01'
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 cookies and cookies[:aflm_st] == "r"
57
- "" # user is registered, emit nothing
58
- else
59
- js = ""
57
+ if configured
58
+ if cookies and cookies[:aflm_st] == "r"
59
+ "" # user is registered, emit nothing
60
+ else
61
+ js = ""
60
62
 
61
- if include_lib then
62
- js += minified_js
63
- end
63
+ if include_lib then
64
+ js += minified_js
65
+ end
64
66
 
65
- "Affilimator.register({key: '#{aff_public_key}', email:'#{email}'})"
67
+ js += "Affilimator.register({key: '#{aff_public_key}', email:'#{email}'})"
66
68
 
67
- if in_script_tag then
68
- js = "<script >" + js + "</script>"
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 "AFFIMILATOR_PUBLIC_KEY environment variables."
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
- spec = Gem::Specification.find_by_name('affilimator')
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.1.1
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-01 00:00:00 Z
13
+ date: 2012-11-02 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_pure