sniper_links 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e1ee9e32fff28607ae53550191cd7ec5b75096da6f6d384113de1c07a97a0fe
4
+ data.tar.gz: 117295b332c0ae0a330d7cbb4c0a68117790ea66081431ad771b04c6a192bf3d
5
+ SHA512:
6
+ metadata.gz: 243adbe12828aca4bb640e2cbc8d6c383384095ad04d642eadb358425ebd7eea73b4b6c10a0ff0b1f0cbbfb780c7de672d96eab9b5dbc3ab513080a94f59b5e8
7
+ data.tar.gz: 0d275292b1aeee14aa00dd80b6242371395fd4d6892aa8937963a136bee4a527823ea92d2a669db5329d371c7166423c37db70ac799058d04f96e2e9770796b9
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## Unreleased
9
+
10
+ ## 0.1.0 - 2025-05-23
11
+
12
+ ### Added
13
+
14
+ * Support for GMail (browser link only)
15
+ * Support for Outlook (browser link only)
16
+ * Support for Yahoo (browser link only)
17
+ * Support for ProtonMail (browser link only)
18
+ * Support for iCloud (browser link only)
19
+
20
+ ### Fixed
21
+
22
+ * n/a
23
+
24
+ ### Changed
25
+
26
+ * n/a
27
+
28
+ ### Breaking Changes
29
+
30
+ * n/a
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gabriel@zero-one.io. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sniper_links.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+ gem "rspec-its"
9
+ gem "pry"
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sniper_links (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.3)
10
+ diff-lcs (1.6.2)
11
+ method_source (1.1.0)
12
+ pry (0.15.2)
13
+ coderay (~> 1.1)
14
+ method_source (~> 1.0)
15
+ rake (12.3.3)
16
+ rspec (3.13.0)
17
+ rspec-core (~> 3.13.0)
18
+ rspec-expectations (~> 3.13.0)
19
+ rspec-mocks (~> 3.13.0)
20
+ rspec-core (3.13.3)
21
+ rspec-support (~> 3.13.0)
22
+ rspec-expectations (3.13.4)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.13.0)
25
+ rspec-its (1.3.1)
26
+ rspec-core (>= 3.0.0)
27
+ rspec-expectations (>= 3.0.0)
28
+ rspec-mocks (3.13.4)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-support (3.13.3)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ pry
38
+ rake (~> 12.0)
39
+ rspec (~> 3.0)
40
+ rspec-its
41
+ sniper_links!
42
+
43
+ BUNDLED WITH
44
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Gabriel Fortuna
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.
data/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # SniperLinks
2
+
3
+ This gem helps with creating sniper links for various email platforms.
4
+
5
+ Sniper links are links that can be supplied to your users, to help them find emails from you more easily.
6
+
7
+ You can read more about [Sniper Links in this post](https://growth.design/sniper-link).
8
+
9
+ * [Installation](#installation)
10
+ * [Usage](#usage)
11
+ * [Using a strategy directly](#using-a-strategy-directly)
12
+ * [Supported Platforms](#supported-platforms)
13
+ * [Sniper link strategy functionality](#sniper-link-strategy-functionality)
14
+ * [Development](#development)
15
+ * [Contributing](#contributing)
16
+ * [Feature wishlist](#feature-wishlist)
17
+ * [License](#license)
18
+ * [Code of Conduct](#code-of-conduct)
19
+
20
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem 'sniper_links'
26
+ ```
27
+
28
+ And then execute:
29
+
30
+ $ bundle install
31
+
32
+ Or install it yourself as:
33
+
34
+ $ gem install sniper_links
35
+
36
+ ## Usage
37
+
38
+ ```ruby
39
+ email = "marlon.rando@gmail.com"
40
+ from = "us@our.domain"
41
+
42
+ snipe = SniperLinks.new(email) # => SniperLinks
43
+ snipe.sniper_link_strategy # => SniperLinks::Strategies::GMail
44
+ snipe.sniper_link(from) # => URI
45
+
46
+ puts snipe.sniper_link.to_s
47
+ # => https://mail.google.com/mail/u/0/#search/from%3A%28us%40our.domain%29%2Bin%3Aanywhere%2Bnewer_than%3A1h
48
+ ```
49
+
50
+ ### Using a strategy directly
51
+
52
+ If you want to use a strategy directly, you can do so like so:
53
+
54
+ ```ruby
55
+ email = "rando.calrissian@foo.com"
56
+ from = "us@our.domain"
57
+
58
+ snipe = SniperLinks.new(email) # This will raise an error
59
+ # Traceback (most recent call last):
60
+ # ....
61
+ # SniperLinks::Error (Unsupported email domain)
62
+
63
+ snipe = SniperLinks::Strategies::GMail.new(email) # => SniperLinks::Strategies::GMail
64
+ snipe.sniper_link(from) # => URI
65
+ ```
66
+
67
+ ## Supported Platforms
68
+
69
+ We support the following email service provider platforms:
70
+
71
+ * Gmail - `*@gmail.com`
72
+ * Outlook - `*@outlook.com`
73
+ * Yahoo - `*@yahoo.*` or `*@myyahoo.*`
74
+ * ProtonMail - `*@protonmail.com`, `*@proton.me`, `*@protonmail.ch`, or `*@pm.me`
75
+ * iCloud - `*@icloud.com`, `*@me.com`, or `*@mac.com`
76
+
77
+ ### Sniper link strategy functionality
78
+
79
+ Each email service provider has its own sniper link strategy. The following table shows how much functionality is supported by each provider.
80
+
81
+ | | Gmail | Outlook | Yahoo | Protonmail | iCloud |
82
+ |--------------|-------|---------|-------|------------|--------|
83
+ | Link | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
84
+ | Account | ✔️ | ✔️ | ✖️ | ✖️️ | ✖️ |
85
+ | From filter | ✔️ | ✖️️️️ | ✔️ | ✔️ | ✖️ |
86
+ | Spam piercer | ✔️ | ✖️️️️ | ✔️ | ✔️ | ✖️ |
87
+ | Time filter | ✔️ | ✖️️️️ | ✔️ | ✔️ | ✖️ |
88
+
89
+ ## Development
90
+
91
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
92
+
93
+ ## Contributing
94
+
95
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zero-one-software/sniper-links. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/zero-one-software/sniper-links/blob/master/CODE_OF_CONDUCT.md).
96
+
97
+ ### Feature wishlist
98
+
99
+ * Add support for more email service providers, like Hey.com, Fastmail, etc.
100
+ * Add support for selecting a strategy based on the email address domain's MX records.
101
+
102
+ ## License
103
+
104
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
105
+
106
+ ## Code of Conduct
107
+
108
+ Everyone interacting in the SniperLinks project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zero-one-software/sniper-links/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sniper_links"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,19 @@
1
+ class SniperLinks
2
+ module Strategies
3
+ class Apple
4
+ def initialize(email)
5
+ @email = email
6
+ end
7
+
8
+ def sniper_link(_from = nil)
9
+ URI("https://www.icloud.com/mail/")
10
+ end
11
+
12
+ attr_reader :email
13
+ end
14
+ end
15
+ end
16
+
17
+ __END__
18
+
19
+ https://www.icloud.com/mail/
@@ -0,0 +1,34 @@
1
+ class SniperLinks
2
+ module Strategies
3
+ class GMail
4
+ def initialize(email)
5
+ @email = email
6
+ end
7
+
8
+ def sniper_link(from)
9
+ @from = from
10
+
11
+ sniper_filter = encode(filter)
12
+
13
+ URI("https://mail.google.com/mail/u/0/#search/#{sniper_filter}")
14
+ end
15
+
16
+ private
17
+
18
+ def filter
19
+ "from:(#{from}) in:anywhere newer_than:1h"
20
+ end
21
+
22
+ def encode(str)
23
+ URI.encode_www_form_component(str)
24
+ end
25
+
26
+
27
+ attr_reader :email, :from
28
+ end
29
+ end
30
+ end
31
+
32
+ __END__
33
+
34
+ https://mail.google.com/mail/u/0/#search/from%3A(user%40some.domain)+in%3Aanywhere+newer_than%3A1h
@@ -0,0 +1,27 @@
1
+ class SniperLinks
2
+ module Strategies
3
+ class Outlook
4
+ def initialize(email)
5
+ @email = email
6
+ end
7
+
8
+ def sniper_link(from)
9
+ @from = from
10
+
11
+ URI("https://outlook.live.com/mail/?login_hint=#{encode(from)}")
12
+ end
13
+
14
+ private
15
+
16
+ def encode(str)
17
+ URI.encode_www_form_component(str)
18
+ end
19
+
20
+ attr_reader :email, :from
21
+ end
22
+ end
23
+ end
24
+
25
+ __END__
26
+
27
+ https://outlook.live.com/mail/?login_hint=encoded_email}
@@ -0,0 +1,28 @@
1
+ class SniperLinks
2
+ module Strategies
3
+ class Proton
4
+ def initialize(email)
5
+ @email = email
6
+ end
7
+
8
+ def sniper_link(from)
9
+ @from = from
10
+ filter = encode(from)
11
+
12
+ URI("https://mail.proton.me/u/0/all-mail#from=#{filter}")
13
+ end
14
+
15
+ private
16
+
17
+ def encode(str)
18
+ URI.encode_www_form_component(str)
19
+ end
20
+
21
+ attr_reader :email, :from
22
+ end
23
+ end
24
+ end
25
+
26
+ __END__
27
+
28
+ https://mail.proton.me/u/0/all-mail#from=user%40some.domain
@@ -0,0 +1,28 @@
1
+ class SniperLinks
2
+ module Strategies
3
+ class Yahoo
4
+ def initialize(email)
5
+ @email = email
6
+ end
7
+
8
+ def sniper_link(from)
9
+ @from = from
10
+ filter = encode(from)
11
+
12
+ URI("https://mail.yahoo.com/d/search/keyword=from%253A#{filter}")
13
+ end
14
+
15
+ private
16
+
17
+ def encode(str)
18
+ URI.encode_www_form_component(str)
19
+ end
20
+
21
+ attr_reader :email, :from
22
+ end
23
+ end
24
+ end
25
+
26
+ __END__
27
+
28
+ https://mail.yahoo.com/d/search/keyword=from%253Auser%40some.domain
@@ -0,0 +1,3 @@
1
+ class SniperLinks
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,54 @@
1
+ require "sniper_links/version"
2
+
3
+ require "uri"
4
+
5
+ require "sniper_links/strategies/apple"
6
+ require "sniper_links/strategies/gmail"
7
+ require "sniper_links/strategies/outlook"
8
+ require "sniper_links/strategies/proton"
9
+ require "sniper_links/strategies/yahoo"
10
+
11
+ class SniperLinks
12
+ class Error < StandardError; end
13
+
14
+ def initialize(email)
15
+ @email = email
16
+
17
+ extract_domain
18
+ sniper_link_strategy
19
+
20
+ self
21
+ end
22
+
23
+ def sniper_link(from)
24
+ sniper_link_strategy.sniper_link(from)
25
+ end
26
+
27
+ def extract_domain
28
+ @domain = email.split("@").last
29
+ end
30
+
31
+ def sniper_link_strategy
32
+
33
+ @_sniper_link_strategy ||= case domain
34
+ when /gmail\.com\z/
35
+ SniperLinks::Strategies::GMail.new(email)
36
+ when /outlook\.com\z/
37
+ SniperLinks::Strategies::Outlook.new(email)
38
+ when /(my)?yahoo\./
39
+ SniperLinks::Strategies::Yahoo.new(email)
40
+ when /protonmail\.(com|ch)\z/
41
+ SniperLinks::Strategies::Proton.new(email)
42
+ when /(proton|pm).me\z/
43
+ SniperLinks::Strategies::Proton.new(email)
44
+ when /(me|mac|icloud)\.com\z/
45
+ SniperLinks::Strategies::Apple.new(email)
46
+ else
47
+ raise Error, "Unsupported email domain"
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ attr_reader :email, :domain
54
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'lib/sniper_links/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "sniper_links"
5
+ spec.version = SniperLinks::VERSION
6
+ spec.authors = ["Gabriel Fortuna"]
7
+ spec.email = ["gabriel@zero-one.io"]
8
+
9
+ spec.summary = "Generate sniper links for various email platforms"
10
+ spec.description = "Increase your email open rates with sniper links. This gem generates sniper links for various email platforms, increasing the chance that an email will be acted on."
11
+ spec.homepage = "https://www.zero-one.io"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
18
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sniper_links
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Fortuna
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-05-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Increase your email open rates with sniper links. This gem generates
14
+ sniper links for various email platforms, increasing the chance that an email will
15
+ be acted on.
16
+ email:
17
+ - gabriel@zero-one.io
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - ".rspec"
24
+ - CHANGELOG.md
25
+ - CODE_OF_CONDUCT.md
26
+ - Gemfile
27
+ - Gemfile.lock
28
+ - LICENSE.txt
29
+ - README.md
30
+ - Rakefile
31
+ - bin/console
32
+ - bin/setup
33
+ - lib/sniper_links.rb
34
+ - lib/sniper_links/strategies/apple.rb
35
+ - lib/sniper_links/strategies/gmail.rb
36
+ - lib/sniper_links/strategies/outlook.rb
37
+ - lib/sniper_links/strategies/proton.rb
38
+ - lib/sniper_links/strategies/yahoo.rb
39
+ - lib/sniper_links/version.rb
40
+ - sniper_links.gemspec
41
+ homepage: https://www.zero-one.io
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://www.zero-one.io
46
+ allowed_push_host: https://rubygems.org
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.7.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.1.6
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Generate sniper links for various email platforms
66
+ test_files: []