partner_friendly 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afba1f950014ce8ebfdd465be9c9ace06c86d9b4
4
+ data.tar.gz: 24315e95c2d43d01367c1357981fa40974119f61
5
+ SHA512:
6
+ metadata.gz: bc00473b8bec1e41dc6d07815dd0166d2e05af7a35f745fe94a23e25b55e95753fa343811e5342780654c927436bcc07de7b5fe6f41feb0f58b15d38b82499b0
7
+ data.tar.gz: 969b1fb23bbea4a3f0fdd5963145a1170d9c67636471fb799db1098c06ab47eb8fe008f9d7c6c7e420c80ad2a1bceefd8480076b60444cde2f3c35e9ffa0dab3
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in partner_friendly.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ryan Kulp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ # PartnerFriendly
2
+
3
+ Are you a marketer? PartnerFriendly is for you.
4
+
5
+ When savvy users register for applications, they append their email with strings like "*+yourapp*" preceding their domain.
6
+
7
+ Users do this to identify your organization if they receive unsolicited email from one of your marketing partners, such as a co-branded newsletter.
8
+
9
+ PartnerFriendly neutralizes this issue by removing such identifiers, transforming
10
+
11
+ ![Before Validation](https://github.com/ryanckulp/PartnerFriendly/blob/screenshots/screenshots/before-validation.png?raw=true)
12
+ --->
13
+ ![After Validation](https://github.com/ryanckulp/PartnerFriendly/blob/screenshots/screenshots/after-database-entry.png?raw=true)
14
+
15
+ upon entry to your database.
16
+
17
+ ## Installation
18
+
19
+ Add to your application's Gemfile:
20
+
21
+ ```ruby
22
+ gem 'partner_friendly'
23
+ ```
24
+
25
+ Then execute:
26
+
27
+ $ bundle
28
+
29
+ Or install it yourself as:
30
+
31
+ $ gem install partner_friendly
32
+
33
+ ## Usage
34
+
35
+ In your User model, add:
36
+ ```
37
+ ...
38
+ before_validation :clean
39
+ ...
40
+ def clean
41
+ PartnerFriendly::Process.clean(self)
42
+ end
43
+ ```
44
+
45
+ ## FAQ
46
+
47
+ The user may try to trick the system with multiple identifiers,
48
+
49
+ ![Multiple Identifier Example](https://github.com/ryanckulp/PartnerFriendly/blob/screenshots/screenshots/multiple-identifier-example.png?raw=true)
50
+
51
+ however this just yields:
52
+
53
+ ![After Validation](https://github.com/ryanckulp/PartnerFriendly/blob/screenshots/screenshots/multiple-identifier-error.png?raw=true)
54
+
55
+ ProTip: opting for before_save or before_create instead of before_validation may throw a nasty database error:
56
+
57
+ ![PG Unique Violation](https://github.com/ryanckulp/PartnerFriendly/blob/screenshots/screenshots/pg-unique-violation.png?raw=true)
58
+
59
+ In this case, simply rescue from the error with a redirect or existing authentication flash for "user already exists."
60
+
61
+ ## Contributing
62
+
63
+ Bug reports and pull requests are welcome.
64
+
65
+ 1. Fork it ( http://github.com/ryanckulp/partnerfriendly/fork )
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create new Pull Request
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
74
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "partner_friendly"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ require "partner_friendly/version"
2
+
3
+ module PartnerFriendly
4
+ class Process
5
+
6
+ def self.clean(user)
7
+ if user.email.include?('+')
8
+ e = []
9
+ e = user.email.split(/[+@]/)
10
+ user.email = e[0] + '@' + e[2]
11
+ else
12
+ user.email
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module PartnerFriendly
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'partner_friendly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "partner_friendly"
8
+ spec.version = PartnerFriendly::VERSION
9
+ spec.authors = ["Ryan Kulp"]
10
+ spec.email = ["ryanckulp@gmail.com"]
11
+
12
+ spec.summary = %q{Remove trailing email identifiers from new user registrations.}
13
+ spec.description = %q{Effortlessly share your userbase email addresses without fear of being traced.}
14
+ spec.homepage = "https://github.com/ryanckulp/PartnerFriendly"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: partner_friendly
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Kulp
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Effortlessly share your userbase email addresses without fear of being
42
+ traced.
43
+ email:
44
+ - ryanckulp@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - lib/partner_friendly.rb
58
+ - lib/partner_friendly/version.rb
59
+ - partner_friendly.gemspec
60
+ homepage: https://github.com/ryanckulp/PartnerFriendly
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ allowed_push_host: https://rubygems.org
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.2.2
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Remove trailing email identifiers from new user registrations.
85
+ test_files: []