mslm 2.2.4 → 2.2.5
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 +4 -4
- data/lib/mslm/response.rb +14 -0
- data/lib/mslm/version.rb +1 -1
- metadata +9 -21
- data/.gitignore +0 -0
- data/CHANGELOG.md +0 -0
- data/CONTRIBUTING.md +0 -154
- data/Gemfile +0 -8
- data/LICENSE +0 -21
- data/README.md +0 -133
- data/Rakefile +0 -4
- data/bin/console +0 -11
- data/bin/setup +0 -8
- data/mslm.gemspec +0 -43
- data/test/email_verify_test.rb +0 -82
- data/test/otp_send_test.rb +0 -25
- data/test/otp_verify_test.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4cbaebc5d95ab0d0bc3735105da04d7d0e087d3777b6fbe6e3f28de363decf66
|
|
4
|
+
data.tar.gz: 53ac68812e798111f9d9ef2cb1de184c99a696758be8652f99d7555b55e3d36e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd75ecb51e47cde473bc40e7346b58a7c689f25c254c283f7a585ee2d028e302b44c9f2d830cc660cbbed5081cdf6beb6e38bb77f51f1ae68ada06b54eb48626
|
|
7
|
+
data.tar.gz: 909f92dafd63f0409711dfc5267a4fcd315d509e98f4faa3741a2ea1048d3a96939e78c68e142b81aa2e3c4acdc96b0d8152fd00ce334e2d6e50cc26cbf6d60a
|
data/lib/mslm/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mslm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sahal Abdullah
|
|
@@ -19,26 +19,14 @@ executables: []
|
|
|
19
19
|
extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
|
21
21
|
files:
|
|
22
|
-
- ".
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- bin/setup
|
|
31
|
-
- lib/mslm.rb
|
|
32
|
-
- lib/mslm/email_verify.rb
|
|
33
|
-
- lib/mslm/lib.rb
|
|
34
|
-
- lib/mslm/mslm_errors.rb
|
|
35
|
-
- lib/mslm/otp.rb
|
|
36
|
-
- lib/mslm/req_opts.rb
|
|
37
|
-
- lib/mslm/version.rb
|
|
38
|
-
- mslm.gemspec
|
|
39
|
-
- test/email_verify_test.rb
|
|
40
|
-
- test/otp_send_test.rb
|
|
41
|
-
- test/otp_verify_test.rb
|
|
22
|
+
- "./lib/mslm.rb"
|
|
23
|
+
- "./lib/mslm/email_verify.rb"
|
|
24
|
+
- "./lib/mslm/lib.rb"
|
|
25
|
+
- "./lib/mslm/mslm_errors.rb"
|
|
26
|
+
- "./lib/mslm/otp.rb"
|
|
27
|
+
- "./lib/mslm/req_opts.rb"
|
|
28
|
+
- "./lib/mslm/response.rb"
|
|
29
|
+
- "./lib/mslm/version.rb"
|
|
42
30
|
homepage: https://github.com/mslmio/sdk-ruby
|
|
43
31
|
licenses:
|
|
44
32
|
- MIT
|
data/.gitignore
DELETED
|
File without changes
|
data/CHANGELOG.md
DELETED
|
File without changes
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
Thanks for taking the time to contribute!
|
|
4
|
-
|
|
5
|
-
All types of contributions are encouraged and valued. Please try to read the
|
|
6
|
-
relevant sections in this document before making your contribution. It will
|
|
7
|
-
make it a lot easier for us maintainers and smooth out the experience for all
|
|
8
|
-
involved. The community looks forward to your contributions.
|
|
9
|
-
|
|
10
|
-
> And if you like the project, but just don't have time to contribute, that's
|
|
11
|
-
> fine. There are other easy ways to support the project and show your
|
|
12
|
-
> appreciation, which we would also be very happy about:
|
|
13
|
-
> - Star the project
|
|
14
|
-
> - Post about it on social media
|
|
15
|
-
> - Refer this project in your own project's README
|
|
16
|
-
> - Mention the project at local meetups and tell your friends/colleagues
|
|
17
|
-
|
|
18
|
-
## I Have a Question
|
|
19
|
-
|
|
20
|
-
> Please ensure you've already read the available
|
|
21
|
-
> [Documentation](https://mslm.io/docs/api/libraries/ruby), which may have
|
|
22
|
-
> answered your question.
|
|
23
|
-
|
|
24
|
-
Before you ask a question, it is best to search for existing
|
|
25
|
-
[Issues](https://github.com/mslmio/sdk-ruby/issues) that might help you. In
|
|
26
|
-
case you have found a suitable issue and still need clarification, you can
|
|
27
|
-
write your question in this issue. It is also advisable to search the internet
|
|
28
|
-
for answers first.
|
|
29
|
-
|
|
30
|
-
If you then still feel the need to ask a question and need clarification, we
|
|
31
|
-
recommend the following:
|
|
32
|
-
|
|
33
|
-
- Open an [Issue](https://github.com/mslmio/sdk-ruby/issues/new).
|
|
34
|
-
- Provide as much context as you can about what you're running into.
|
|
35
|
-
- Provide project and platform versions (nodejs, npm, etc), depending on what
|
|
36
|
-
seems relevant.
|
|
37
|
-
|
|
38
|
-
We will then take care of the issue as soon as possible.
|
|
39
|
-
|
|
40
|
-
## I Want To Contribute
|
|
41
|
-
|
|
42
|
-
> ### Legal Notice
|
|
43
|
-
>
|
|
44
|
-
> When contributing to this project, you must agree that you have authored 100%
|
|
45
|
-
> of the content, that you have the necessary rights to the content and that
|
|
46
|
-
> the content you contribute may be provided under the project licence.
|
|
47
|
-
|
|
48
|
-
### Reporting Bugs
|
|
49
|
-
|
|
50
|
-
#### Before Submitting a Bug Report
|
|
51
|
-
|
|
52
|
-
A good bug report shouldn't leave others needing to chase you up for more
|
|
53
|
-
information. Therefore, we ask you to investigate carefully, collect
|
|
54
|
-
information and describe the issue in detail in your report. Please complete
|
|
55
|
-
the following steps in advance to help us fix any potential bug as fast as
|
|
56
|
-
possible.
|
|
57
|
-
|
|
58
|
-
- Make sure that you are using the latest version.
|
|
59
|
-
- Determine if your bug is really a bug and not an error on your side e.g.
|
|
60
|
-
using incompatible environment components/versions (Make sure that you have
|
|
61
|
-
read the
|
|
62
|
-
[documentation](https://mslm.io/docs/api/libraries/ruby). If you
|
|
63
|
-
are looking for support, you might want to check [this
|
|
64
|
-
section](#i-have-a-question)).
|
|
65
|
-
- To see if other users have experienced (and potentially already solved) the
|
|
66
|
-
same issue you are having, check if there is not already a bug report
|
|
67
|
-
existing for your bug or error in the [bug
|
|
68
|
-
tracker](https://github.com/mslmio/sdk-ruby/issues?q=label%3Abug).
|
|
69
|
-
- Also make sure to search the internet (including Stack Overflow) to see if
|
|
70
|
-
users outside of the GitHub community have discussed the issue.
|
|
71
|
-
- Collect information about the bug:
|
|
72
|
-
- Stack trace (Traceback)
|
|
73
|
-
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
|
|
74
|
-
- Version of the interpreter, compiler, SDK, runtime environment, package
|
|
75
|
-
manager, depending on what seems relevant.
|
|
76
|
-
- Possibly your input and the output
|
|
77
|
-
- Can you reliably reproduce the issue? And can you also reproduce it with
|
|
78
|
-
older versions?
|
|
79
|
-
|
|
80
|
-
#### How Do I Submit a Good Bug Report?
|
|
81
|
-
|
|
82
|
-
> You must never report security related issues, vulnerabilities or bugs
|
|
83
|
-
> including sensitive information to the issue tracker, or elsewhere in public.
|
|
84
|
-
> Instead sensitive bugs must be sent by email to .
|
|
85
|
-
|
|
86
|
-
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
|
|
87
|
-
|
|
88
|
-
- Open an [Issue](https://github.com/mslmio/sdk-ruby/issues/new). (Since we
|
|
89
|
-
can't be sure at this point whether it is a bug or not, we ask you not to
|
|
90
|
-
talk about a bug yet and not to label the issue.)
|
|
91
|
-
- Explain the behavior you would expect and the actual behavior.
|
|
92
|
-
- Please provide as much context as possible and describe the *reproduction
|
|
93
|
-
steps* that someone else can follow to recreate the issue on their own. This
|
|
94
|
-
usually includes your code. For good bug reports you should isolate the
|
|
95
|
-
problem and create a reduced test case.
|
|
96
|
-
- Provide the information you collected in the previous section.
|
|
97
|
-
|
|
98
|
-
Once it's filed:
|
|
99
|
-
|
|
100
|
-
- The project team will label the issue accordingly.
|
|
101
|
-
- A team member will try to reproduce the issue with your provided steps. If
|
|
102
|
-
there are no reproduction steps or no obvious way to reproduce the issue, the
|
|
103
|
-
team will ask you for those steps and mark the issue as `needs-repro`. Bugs
|
|
104
|
-
with the `needs-repro` tag will not be addressed until they are reproduced.
|
|
105
|
-
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as
|
|
106
|
-
well as possibly other tags (such as `critical`), and the issue will be left
|
|
107
|
-
to be [implemented by someone](#your-first-code-contribution).
|
|
108
|
-
|
|
109
|
-
### Suggesting Enhancements
|
|
110
|
-
|
|
111
|
-
This section guides you through submitting an enhancement suggestion,
|
|
112
|
-
**including completely new features and minor improvements to existing
|
|
113
|
-
functionality**. Following these guidelines will help maintainers and the
|
|
114
|
-
community to understand your suggestion and find related suggestions.
|
|
115
|
-
|
|
116
|
-
#### Before Submitting an Enhancement
|
|
117
|
-
|
|
118
|
-
- Make sure that you are using the latest version.
|
|
119
|
-
- Read the [documentation](https://mslm.io/docs/api/libraries/ruby) carefully and
|
|
120
|
-
find out if the functionality is already covered, maybe by an individual
|
|
121
|
-
configuration.
|
|
122
|
-
- Perform a [search](https://github.com/mslmio/sdk-ruby/issues) to see if
|
|
123
|
-
the enhancement has already been suggested. If it has, add a comment to the
|
|
124
|
-
existing issue instead of opening a new one.
|
|
125
|
-
- Find out whether your idea fits with the scope and aims of the project. It's
|
|
126
|
-
up to you to make a strong case to convince the project's developers of the
|
|
127
|
-
merits of this feature. Keep in mind that we want features that will be
|
|
128
|
-
useful to the majority of our users and not just a small subset. If you're
|
|
129
|
-
just targeting a minority of users, consider writing an add-on/plugin
|
|
130
|
-
library.
|
|
131
|
-
|
|
132
|
-
#### How Do I Submit a Good Enhancement Suggestion?
|
|
133
|
-
|
|
134
|
-
Enhancement suggestions are tracked as [GitHub issues](https://github.com/mslmio/sdk-ruby/issues).
|
|
135
|
-
|
|
136
|
-
- Use a **clear and descriptive title** for the issue to identify the
|
|
137
|
-
suggestion.
|
|
138
|
-
- Provide a **step-by-step description of the suggested enhancement** in as
|
|
139
|
-
many details as possible.
|
|
140
|
-
- **Describe the current behavior** and **explain which behavior you expected
|
|
141
|
-
to see instead** and why. At this point you can also tell which alternatives
|
|
142
|
-
do not work for you.
|
|
143
|
-
- You may want to **include screenshots or screen recordings** which help you
|
|
144
|
-
demonstrate the steps or point out the part which the suggestion is related
|
|
145
|
-
to.
|
|
146
|
-
- **Explain why this enhancement would be useful** to most users. You may also
|
|
147
|
-
want to point out the other projects that solved it better and which could
|
|
148
|
-
serve as inspiration.
|
|
149
|
-
|
|
150
|
-
## Security Issue Notifications
|
|
151
|
-
|
|
152
|
-
If you discover a potential security issue in this project we ask that you
|
|
153
|
-
notify Mslm Security via [security@mslm.io](mailto:security@mslm.io). Please do
|
|
154
|
-
not create a public github issue.
|
data/Gemfile
DELETED
data/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022-now Mslm
|
|
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 all
|
|
13
|
-
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 THE
|
|
21
|
-
SOFTWARE.
|
data/README.md
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# Mslm Ruby SDK
|
|
2
|
-
|
|
3
|
-
# [<img src="https://avatars.githubusercontent.com/u/50307970?s=200&v=4" alt="Mslm" width="24"/>](https://mslm.io/) IPinfo Ruby Client Library
|
|
4
|
-
|
|
5
|
-
The official Ruby SDK for Mslm APIs [Mslm.io](https://mslm.io) that enables you to verify email addresses and perform other actions related to email verification, sending and verifying otp.
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
Before you start using the Mslm Ruby SDK, ensure that you have the following:
|
|
10
|
-
|
|
11
|
-
- **Ruby:** The SDK is compatible with Ruby version >= 3.0.0.
|
|
12
|
-
|
|
13
|
-
## Authentication
|
|
14
|
-
|
|
15
|
-
Mslm's APIs require an API key. If you don't have one, please read
|
|
16
|
-
[Authentication](https://mslm.io/docs/api/authentication) to understand how to
|
|
17
|
-
get an API key before continuing.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
To install the main library, use the following command:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
gem install mslm
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```ruby
|
|
30
|
-
require 'mslm'
|
|
31
|
-
|
|
32
|
-
# Initialize the Mslm object with your API key.
|
|
33
|
-
client = Mslm::Mslm.new('api_key')
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
#### Email Verify
|
|
37
|
-
|
|
38
|
-
- Single Verify
|
|
39
|
-
|
|
40
|
-
```ruby
|
|
41
|
-
response = client.verify_email("fakefake@mslm.io")
|
|
42
|
-
|
|
43
|
-
response.status //fake
|
|
44
|
-
response.domain //mslm.io
|
|
45
|
-
response.malformed //false
|
|
46
|
-
response.has_mailbox //false
|
|
47
|
-
response.disposable //false
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
#### OTP
|
|
52
|
-
|
|
53
|
-
- Sending an OTP.
|
|
54
|
-
|
|
55
|
-
```ruby
|
|
56
|
-
otp_send_req = {
|
|
57
|
-
"phone" => "+923214444444",
|
|
58
|
-
"tmpl_sms" => "Your verification code is {token}",
|
|
59
|
-
"token_len" => 4,
|
|
60
|
-
"expire_seconds" => 300,
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
response = client.send_otp(otp_send_req)
|
|
64
|
-
|
|
65
|
-
response.code //1000
|
|
66
|
-
respnse.msg //Successfully sent SMS.
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
- Verifying a token.
|
|
71
|
-
|
|
72
|
-
```ruby
|
|
73
|
-
otp_token_verify_request = {
|
|
74
|
-
"phone" => "+923214444444",
|
|
75
|
-
"token" => "123456",
|
|
76
|
-
"consume" => True,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
otp_verify_resp = client.verify_otp(otp_verify_req)
|
|
80
|
-
|
|
81
|
-
response.code //1000
|
|
82
|
-
response.msg //Successfully verified.
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Error Handling
|
|
86
|
-
|
|
87
|
-
We expose the following error types in the SDK:
|
|
88
|
-
|
|
89
|
-
#### Common Errors
|
|
90
|
-
|
|
91
|
-
- `MslmError`: The base error type.
|
|
92
|
-
|
|
93
|
-
#### Quota-Related Errors
|
|
94
|
-
|
|
95
|
-
- `RequestQuotaExceededError`: The request quota has been exceeded.
|
|
96
|
-
|
|
97
|
-
## Additional Resources
|
|
98
|
-
|
|
99
|
-
See the official [API Reference Documentation](https://mslm.io/docs/api) for
|
|
100
|
-
details on each API's actual interface, which is implemented by this SDK.
|
|
101
|
-
|
|
102
|
-
## Contributing
|
|
103
|
-
|
|
104
|
-
See [CONTRIBUTING](CONTRIBUTING.md) for more information.
|
|
105
|
-
|
|
106
|
-
## Security
|
|
107
|
-
|
|
108
|
-
See [Security Issue
|
|
109
|
-
Notifications](CONTRIBUTING.md#security-issue-notifications) for more
|
|
110
|
-
information.
|
|
111
|
-
|
|
112
|
-
## License
|
|
113
|
-
|
|
114
|
-
This project is licensed under the [MIT License](LICENSE).
|
|
115
|
-
|
|
116
|
-
## About Mslm
|
|
117
|
-
|
|
118
|
-
At Mslm, we're all about making things better. Where others see norm, we see
|
|
119
|
-
opportunity.
|
|
120
|
-
|
|
121
|
-
We build world-class solutions to the toughest problems. Excellence is a core
|
|
122
|
-
value that defines our approach from top to bottom.
|
|
123
|
-
|
|
124
|
-
We're all about creating positive value for ourselves, our partners and our
|
|
125
|
-
societies.
|
|
126
|
-
|
|
127
|
-
We do it by focusing on quality and the long-term, while intelligently
|
|
128
|
-
maneuvering the complex realities of day-to-day business.
|
|
129
|
-
|
|
130
|
-
Our partners share our perspective, and we jointly produce truly world-class
|
|
131
|
-
solutions to the toughest problems.
|
|
132
|
-
|
|
133
|
-
[](https://mslm.io/)
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "bundler/setup"
|
|
5
|
-
require "mslm"
|
|
6
|
-
|
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
-
|
|
10
|
-
require "irb"
|
|
11
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/mslm.gemspec
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require_relative "lib/mslm/version"
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name = "mslm"
|
|
5
|
-
spec.version = Mslm::VERSION
|
|
6
|
-
spec.authors = ["Sahal Abdullah"]
|
|
7
|
-
spec.email = ["sahal.abdullah@mslm.io"]
|
|
8
|
-
|
|
9
|
-
spec.summary = "Provides functionalities for email verification and OTP (One-Time Password) generation and verification."
|
|
10
|
-
spec.description = "RubyGem offering email verification and OTP (One-Time Password) generation and verification capabilities. Seamlessly integrate email verification and OTP functionality into Ruby applications with ease."
|
|
11
|
-
spec.homepage = "https://github.com/mslmio/sdk-ruby"
|
|
12
|
-
spec.license = "MIT"
|
|
13
|
-
spec.required_ruby_version = ">= 3.0.0"
|
|
14
|
-
|
|
15
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
16
|
-
spec.metadata["source_code_uri"] = "https://github.com/mslmio/sdk-ruby"
|
|
17
|
-
spec.metadata["changelog_uri"] = "https://github.com/mslmio/sdk-ruby/blob/main/CHANGELOG.md"
|
|
18
|
-
|
|
19
|
-
EXCLUDED_FILES = [
|
|
20
|
-
"lib/mslm/otp_resp.rb",
|
|
21
|
-
"lib/mslm/otp_send_req.rb",
|
|
22
|
-
"lib/mslm/otp_token_verify_req.rb",
|
|
23
|
-
"lib/mslm/single_verify_resp.rb",
|
|
24
|
-
"lib/mslm/single_verify_resp_mx.rb"
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
spec.files = Dir.chdir(__dir__) do
|
|
29
|
-
all_files = `git ls-files -z`.split("\x0")
|
|
30
|
-
all_files.reject { |file| EXCLUDED_FILES.include?(file) }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
spec.bindir = "exe"
|
|
34
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
35
|
-
spec.require_paths = ["lib"]
|
|
36
|
-
|
|
37
|
-
# Uncomment to register a new dependency of your gem
|
|
38
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
|
39
|
-
|
|
40
|
-
# For more information and examples about making a new gem, check out our
|
|
41
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
|
42
|
-
end
|
|
43
|
-
|
data/test/email_verify_test.rb
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require 'minitest/autorun'
|
|
2
|
-
require_relative '../lib/mslm'
|
|
3
|
-
|
|
4
|
-
class TestEmailVerification < Minitest::Test
|
|
5
|
-
TEST_EMAIL_REAL = 'support@mslm.io'
|
|
6
|
-
TEST_EMAIL_FAKE = 'fakefakefake@mslm.io'
|
|
7
|
-
TEST_EMAIL_DISPOSABLE = 'asdfasdf@temp-mail.org'
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@api_key = 'api_key'
|
|
11
|
-
@email_verify = Mslm::Mslm.new(@api_key)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_email_verify_sv_fake
|
|
15
|
-
resp, _ = @email_verify.verify_email(TEST_EMAIL_REAL)
|
|
16
|
-
assert_email_verify_sv_REAL(resp)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def assert_email_verify_sv_REAL(resp)
|
|
20
|
-
assert_equal(resp.email, TEST_EMAIL_REAL)
|
|
21
|
-
assert_equal(resp.username, 'support')
|
|
22
|
-
assert_equal(resp.domain, 'mslm.io')
|
|
23
|
-
assert_equal(resp.malformed, false)
|
|
24
|
-
assert_equal(resp.suggestion, '')
|
|
25
|
-
assert_equal(resp.status, 'real')
|
|
26
|
-
assert_equal(resp.has_mailbox, true)
|
|
27
|
-
assert_equal(resp.accept_all, false)
|
|
28
|
-
assert_equal(resp.disposable, false)
|
|
29
|
-
assert_equal(resp.free, false)
|
|
30
|
-
assert_equal(resp.role, true)
|
|
31
|
-
assert_equal(resp.mx, [[{"host"=>"mx.yandex.net.", "pref"=>10}]])
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_email_verify_sv_fake
|
|
35
|
-
resp, _ = @email_verify.verify_email(TEST_EMAIL_FAKE)
|
|
36
|
-
assert_email_verify_sv_fake(resp)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def assert_email_verify_sv_fake(resp)
|
|
40
|
-
assert_equal(resp.email, TEST_EMAIL_FAKE)
|
|
41
|
-
assert_equal(resp.username, 'fakefakefake')
|
|
42
|
-
assert_equal(resp.domain, 'mslm.io')
|
|
43
|
-
assert_equal(resp.malformed, false)
|
|
44
|
-
assert_equal(resp.suggestion, '')
|
|
45
|
-
assert_equal(resp.status, 'fake')
|
|
46
|
-
assert_equal(resp.has_mailbox, false)
|
|
47
|
-
assert_equal(resp.accept_all, false)
|
|
48
|
-
assert_equal(resp.disposable, false)
|
|
49
|
-
assert_equal(resp.free, false)
|
|
50
|
-
assert_equal(resp.role, false)
|
|
51
|
-
assert_equal(resp.mx, [
|
|
52
|
-
{"host"=>"ASPMX.L.GOOGLE.COM.", "pref"=>1},
|
|
53
|
-
{"host"=>"ALT2.ASPMX.L.GOOGLE.COM.", "pref"=>5},
|
|
54
|
-
{"host"=>"ALT1.ASPMX.L.GOOGLE.COM.", "pref"=>5},
|
|
55
|
-
{"host"=>"ALT4.ASPMX.L.GOOGLE.COM.", "pref"=>10},
|
|
56
|
-
{"host"=>"ALT3.ASPMX.L.GOOGLE.COM.", "pref"=>10}
|
|
57
|
-
])
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def test_email_verify_sv_disposable
|
|
61
|
-
resp, _ = @email_verify.verify_email(TEST_EMAIL_DISPOSABLE)
|
|
62
|
-
assert_email_verify_sv_disposable(resp)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def assert_email_verify_sv_disposable(resp)
|
|
66
|
-
assert_equal(resp.email, TEST_EMAIL_DISPOSABLE)
|
|
67
|
-
assert_equal(resp.username, 'asdfasdf')
|
|
68
|
-
assert_equal(resp.domain, 'temp-mail.org')
|
|
69
|
-
assert_equal(resp.malformed, false)
|
|
70
|
-
assert_equal(resp.suggestion, '')
|
|
71
|
-
assert_equal(resp.status, 'disposable')
|
|
72
|
-
assert_equal(resp.has_mailbox, true)
|
|
73
|
-
assert_equal(resp.accept_all, true)
|
|
74
|
-
assert_equal(resp.disposable, true)
|
|
75
|
-
assert_equal(resp.free, true)
|
|
76
|
-
assert_equal(resp.role, false)
|
|
77
|
-
assert_equal(resp.mx, [{"host"=>"mx.yandex.net.", "pref"=>10}])
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
data/test/otp_send_test.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'minitest/autorun'
|
|
2
|
-
require_relative '../lib/mslm'
|
|
3
|
-
|
|
4
|
-
class TestOtp < Minitest::Test
|
|
5
|
-
|
|
6
|
-
def setup
|
|
7
|
-
@api_key = 'api_key'
|
|
8
|
-
@otp = Mslm::Mslm.new(@api_key)
|
|
9
|
-
@phone_number = '+923214444444'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def test_otp_send_success
|
|
13
|
-
otp_send_req = {
|
|
14
|
-
"phone" => @phone_number,
|
|
15
|
-
"tmpl_sms" => "Your verification code is {token}",
|
|
16
|
-
"token_len" => 4,
|
|
17
|
-
"expire_seconds" => 300,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
otp_send_resp = @otp.send_otp(otp_send_req)
|
|
21
|
-
|
|
22
|
-
assert_equal(1000, otp_send_resp.code)
|
|
23
|
-
assert_equal("Successfully sent SMS.", otp_send_resp.msg)
|
|
24
|
-
end
|
|
25
|
-
end
|
data/test/otp_verify_test.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require 'minitest/autorun'
|
|
2
|
-
require_relative '../lib/mslm'
|
|
3
|
-
|
|
4
|
-
class TestOtp < Minitest::Test
|
|
5
|
-
|
|
6
|
-
def setup
|
|
7
|
-
@api_key = 'api_key'
|
|
8
|
-
@otp = Mslm::Mslm.new(@api_key)
|
|
9
|
-
@phone_number = '+923214444444'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def test_otp_verify_success
|
|
13
|
-
otp_code = '9842'
|
|
14
|
-
|
|
15
|
-
otp_verify_req = {
|
|
16
|
-
"phone" => @phone_number,
|
|
17
|
-
"token" => otp_code,
|
|
18
|
-
"consume" => true,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
otp_verify_resp = @otp.verify_otp(otp_verify_req)
|
|
22
|
-
|
|
23
|
-
assert_equal(1000, otp_verify_resp.code)
|
|
24
|
-
assert_equal("Successfully verified.", otp_verify_resp.msg)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|