mailboxlayer 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c6b0d758b4c2457dfcdf6de3499c167b45470e11
4
+ data.tar.gz: 0ab60b3d43373287ea7da40e1deecf41ba01cfe7
5
+ SHA512:
6
+ metadata.gz: 1adbcb31b89752f050476d8dd33e2ec447a3894d5e85b944cb1fa1a28e82f67ba1b1327f1ebed1353d7f390df76f177819946aeb5fd0b8aecde739b1a98616b6
7
+ data.tar.gz: ce15fd8c66c8dac7d4098b5a9a95394d4aa98ac9d918b6e31ef4df96638db37d92942830ece0cdad64e0d8bbc64883e3a213c4c645bb8a65f65ee02ecbad7bb4
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2016 Alex Fong http://www.github.com/actfong
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,58 @@
1
+ == mailboxlayer
2
+
3
+ Ruby wrapper for mailboxlayer of apilayer.
4
+ See https://mailboxlayer.com/ and http://apilayer.com for more details.
5
+
6
+ === Introduction
7
+ Connect to mailboxlayer.com to verify email addresses.
8
+ Mailboxlayer verifies the existence of email-addresses by first checking MX-records (to see whether the specified domain is configured to receive emails), then by contacting the corresponding email server through SMTP, to see whether the provided email exists.
9
+
10
+ While the *mailboxlayer* gem focuses on the functionalities offered by mailboxlayer, it depends on the *apilayer* gem to configure and create connections to apilayer.net
11
+
12
+ === Installation
13
+
14
+ ==== Using Bundler
15
+
16
+ Add apilayer in your <tt>Gemfile</tt>:
17
+
18
+ gem "mailboxlayer"
19
+
20
+ Run the following in your console:
21
+
22
+ $ bundle install
23
+
24
+ === Usage
25
+
26
+ ==== Add to your application
27
+ require "mailboxlayer"
28
+
29
+ ==== Set up mailboxlayer
30
+ Once you have signed up for *mailboxlayer.com*, you will receive an access_key.
31
+ Then configure your Apilayer::Mailbox module like this:
32
+
33
+ Apilayer::Mailbox.configure do |configs|
34
+ configs.access_key = "my_access_key_123"
35
+ configs.https = true
36
+ end
37
+
38
+ Please note that the https configuration is optional and only available to paid-accounts.
39
+ If unset, these configuration-values are just nil.
40
+
41
+ You can always review you configurations with:
42
+
43
+ Apilayer::Mailbox.configs
44
+
45
+ Once your configurations are set, you are ready to go
46
+
47
+ ==== mailboxlayer
48
+ After setting the access_key for *mailboxlayer*, you can use Apilayer::Mailbox to call *mailboxlayer*'s API
49
+
50
+ Apilayer::Mailbox.check("support@apilayer.com")
51
+
52
+ ==== Re-Configure access_key and https
53
+ If you happened to have forgotten to set or entered an incorrect value, you can re-configure your Apilayer module by:
54
+
55
+ # Example: reconfigure https
56
+ Apilayer::Mailbox.configure do |configs|
57
+ configs.https = true
58
+ end
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'rspec/core/rake_task'
2
+ task :default => :spec
3
+ desc 'Run test suite'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,41 @@
1
+ ##
2
+ # Ruby wrapper for mailboxlayer. See https://mailboxlayer.com/documentation for more info
3
+ module Apilayer
4
+ module Mailbox
5
+ extend ConnectionHelper
6
+
7
+ INVALID_OPTIONS_MSG = 'You have provided an invalid option. Only :smtp is allowed'
8
+
9
+ ## Validations
10
+ #
11
+ def self.validate_options(options)
12
+ options.keys.each do |key|
13
+ unless [:smtp].include? key
14
+ raise Apilayer::Error.new(INVALID_OPTIONS_MSG)
15
+ end
16
+ end
17
+ end
18
+
19
+ ##
20
+ # Api-Method: Calls the /check endpoint to verify the existence of an email address
21
+ #
22
+ # Examples:
23
+ # Apilayer::Mailbox.check('support@apilayer.com')
24
+ # Apilayer::Mailbox.check('support@apilayer.com', {smtp: false}) # If you don't want to perform smtp checks
25
+ def self.check(email, opts={})
26
+ validate_options(opts)
27
+ opts = assign_smtp_value(opts)
28
+ params = { email: email }.merge(opts)
29
+ get_and_parse("check", params)
30
+ end
31
+
32
+ private
33
+ def self.assign_smtp_value(opts)
34
+ if opts[:smtp] == false
35
+ { smtp: 0 }
36
+ else
37
+ { smtp: 1 }
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'apilayer'
3
+
4
+ require "apilayer/mailbox"
metadata ADDED
@@ -0,0 +1,214 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailboxlayer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Fong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: apilayer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '10.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.10.1
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '10.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.10.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: pry
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.10'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.10.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.10'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.10.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: bundler
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '1.7'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.7.9
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 1.7.9
93
+ - !ruby/object:Gem::Dependency
94
+ name: rspec
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '3.0'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.0.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.0'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.0.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: simplecov
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.11'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.11.0
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.11'
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 0.11.0
133
+ - !ruby/object:Gem::Dependency
134
+ name: vcr
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '3.0'
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 3.0.1
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '3.0'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.1
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2.0'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.0.1
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: '2.0'
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: 2.0.1
173
+ description: Ruby wrapper for mailboxlayer by apilayer. This gem depends on the apilayer
174
+ gem, which provides a common connection-interface to various services of apilayer.net
175
+ (such as currencylayer and mailboxlayer). See https://mailboxlayer.com/ and https://apilayer.com/
176
+ for more details.
177
+ email:
178
+ - actfong@gmail.com
179
+ executables: []
180
+ extensions: []
181
+ extra_rdoc_files: []
182
+ files:
183
+ - Gemfile
184
+ - LICENSE
185
+ - README.rdoc
186
+ - Rakefile
187
+ - lib/apilayer/mailbox.rb
188
+ - lib/mailboxlayer.rb
189
+ homepage: https://github.com/actfong/mailboxlayer
190
+ licenses:
191
+ - MIT
192
+ metadata: {}
193
+ post_install_message:
194
+ rdoc_options: []
195
+ require_paths:
196
+ - lib
197
+ required_ruby_version: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ required_rubygems_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ requirements: []
208
+ rubyforge_project:
209
+ rubygems_version: 2.4.5
210
+ signing_key:
211
+ specification_version: 4
212
+ summary: Ruby wrapper for mailboxlayer by apilayer. See https://mailboxlayer.com/
213
+ and https://apilayer.com/ for more details.
214
+ test_files: []