SingleEmailVerification 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19fa35eb35db463f12f5e9cc7643c2b6826d48b79ad2bb534a8b0f8497962789
4
- data.tar.gz: 74a41e70c950497e98c3ea4828c3ba073c54a3825d4b6766ff5d1b042c0f24c1
3
+ metadata.gz: 385271c44c88aa965fe314b7736b875e1f073739205db1b5127e04a303bfe6f0
4
+ data.tar.gz: 580e9a690d812921b2c885cca533338fc3050007962532d6619ee715c301ae70
5
5
  SHA512:
6
- metadata.gz: 3e8742cdfb034c82ef8ac75edd69d695f52d5491d457d68a1b1d59d3766e5eeb2969b29851e0e7ce9cf5c3ea7e4ec2d4d86ac460581e85aa1f95111fefa771b2
7
- data.tar.gz: 20a7d8b2553de7c4bd7389aae9084d7327f125072f35b75b1d3104c0d8ace645a8de517be575533e402d040a3d81c12fb0253efd8a87bdccc5138ef9149c8feb
6
+ metadata.gz: e2e6d32a36755fdcabdc890a456b7ce0225deac29dcb5b87ac2d5c77add50082f0010f9090417c516d6771f37df12452cd857bf5031a4fd7647a73d6a5943434
7
+ data.tar.gz: 9bb0d0aa18ede2927fa4800e272e7d8edb958792cccc341757c07a9e6e9aecf054166422bb2047b8c8e20b51ddfa52e370250490e4255e269b5a3c72fa8e3866
data/README.md CHANGED
@@ -1,39 +1,55 @@
1
1
  # EmailVerification
2
2
 
3
- Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/emailVerification`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ The Single Email Verification Gem is a Ruby library that provides functionality to verify single email addresses. It allows you to easily integrate email verification into your Ruby applications.
6
4
 
7
5
  ## Installation
8
6
 
9
- Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
7
+ To install the gem, add the following line to your application's Gemfile:
8
+
9
+ $ gem install 'SingleEmailVerification'
10
10
 
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ $ bundle nstall
14
14
 
15
15
  If bundler is not being used to manage dependencies, install the gem by executing:
16
16
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
17
+ $ gem install SingleEmailVerification
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ To use the Single Email Verification gem, require it in your Ruby code:
22
+
23
+ require 'emailVerification'
22
24
 
23
25
  ## Development
24
26
 
25
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
27
+ Then, create an instance of the EmailVerification::Client class and use its single_verify method to verify a single email address:
28
+
29
+ class ClientTest
30
+
31
+ def initialize
32
+ @client = EmailVerification::Client.new
33
+ end
34
+
35
+ def test_single_verify
36
+ email = 'sahal.abdullah@mslm.io'
37
+ resp = @client.single_verify(email)
38
+ puts resp
39
+ end
40
+
41
+ end
26
42
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
+ ClientTest.new.test_single_verify
28
44
 
29
45
  ## Contributing
30
46
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/emailVerification. 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/[USERNAME]/emailVerification/blob/master/CODE_OF_CONDUCT.md).
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sahalAbdullah/emailVerification. Please provide detailed descriptions and steps to reproduce any bugs you encounter.
32
48
 
33
49
  ## License
34
50
 
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
51
+ The Single Email Verification gem is available as open source under the terms of the MIT License. You are free to use and modify it as per your requirements.
36
52
 
37
53
  ## Code of Conduct
38
54
 
39
- Everyone interacting in the EmailVerification project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/emailVerification/blob/master/CODE_OF_CONDUCT.md).
55
+ Everyone interacting in the EmailVerification project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sahalAbdullah/emailVerification/blob/master/CODE_OF_CONDUCT.md).
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailVerification
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -4,11 +4,16 @@ require 'json'
4
4
 
5
5
  module EmailVerification
6
6
 
7
- class SingleVerifyReqOpts
7
+ class SingleVerifyReqOpts
8
8
  attr_accessor :disable_url_encode
9
+ attr_accessor :api_key
9
10
  end
10
11
 
11
12
  class Client
13
+
14
+ def initialize(api_key = nil)
15
+ @api_key = api_key
16
+ end
12
17
  def single_verify(email_addr, opts = nil)
13
18
  opt = SingleVerifyReqOpts.new
14
19
  opt = opts.last unless opts.nil? || opts.empty?
@@ -17,7 +22,14 @@ module EmailVerification
17
22
  email_addr = URI.encode_www_form_component(email_addr) unless opt.disable_url_encode
18
23
 
19
24
  qp = { 'email' => email_addr }
25
+ if @api_key || opt.api_key
26
+ api_key = opt.api_key || @api_key
27
+ qp['apikey'] = api_key
28
+ end
29
+
30
+
20
31
  t_url = prepare_url('https://mslm.io/api/sv/v1', qp, opt)
32
+ puts "Url #{t_url}"
21
33
 
22
34
  sv_resp = req_and_resp('GET', t_url, nil, opt)
23
35
  return sv_resp
@@ -44,7 +56,7 @@ module EmailVerification
44
56
  response = [json_response["email"],json_response["username"],json_response["domain"],json_response["malformed"],json_response["suggestion"],json_response["status"],json_response["has_mailbox"],json_response["accept_all"],json_response["disposable"],json_response["free"],json_response["role"],json_response['mx']]
45
57
  return response
46
58
  else
47
- raise EmailVerification::Error, "HTTP #{response_data.code}: #{response_data.message}"
59
+ return "HTTP #{response_data.code}: #{response_data.message}"
48
60
  end
49
61
  end
50
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SingleEmailVerification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahal Abdullah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-07 00:00:00.000000000 Z
11
+ date: 2024-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Write a longer description or delete this line.
14
14
  email:
@@ -22,6 +22,7 @@ files:
22
22
  - LICENSE.txt
23
23
  - README.md
24
24
  - Rakefile
25
+ - SingleEmailVerification-0.1.0.gem
25
26
  - emailVerification.gemspec
26
27
  - lib/emailVerification.rb
27
28
  - lib/emailVerification/version.rb