truemail-client 0.1.0 → 0.3.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.
data/CONTRIBUTING.md CHANGED
@@ -6,28 +6,28 @@ Following these guidelines helps to communicate that you respect the time of the
6
6
 
7
7
  ## Using the issue tracker
8
8
 
9
- The issue tracker is the preferred channel for [bug reports](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests).
9
+ The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests).
10
10
 
11
- <a name="bugs"></a>
12
- ## Bug/issue reports
11
+ ## Issue/bug reports
13
12
 
14
- A bug is a _demonstrable problem_ that is caused by the code in the repository.
15
- Good bug reports are extremely helpful - thank you!
13
+ A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
16
14
 
17
- Guidelines for bug reports:
15
+ Guidelines for issue/bug reports:
18
16
 
19
17
  1. **Use the GitHub issue search** &mdash; check if the issue has already been reported
20
- 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository
21
- 3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
18
+ 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or `develop` branch in the repository
19
+ 3. Truemail [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
22
20
 
23
21
  A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
24
22
 
25
- <a name="features"></a>
26
23
  ## Feature requests
27
24
 
28
25
  Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
29
26
 
30
- <a name="pull-requests"></a>
27
+ ## Questions
28
+
29
+ We're always open to a new conversations. So if you have any questions just ask us.
30
+
31
31
  ## Pull requests
32
32
 
33
33
  Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
@@ -39,7 +39,8 @@ Please adhere to the coding conventions used throughout a project (indentation,
39
39
  Guidelines for pull requests:
40
40
 
41
41
  1. Truemail [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
42
- 2. Fork the repo
43
- 3. Run the tests. This is to make sure your starting point works. Tests can be run via ```rspec```
44
- 4. Create a new branch and make your changes. This includes tests for features!
45
- 5. Push to your fork and submit a pull request
42
+ 2. Fork the repo, checkout to `develop` branch
43
+ 3. Run the tests. This is to make sure your starting point works
44
+ 4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md)
45
+ 5. Create a new branch and make your changes. This includes tests for features!
46
+ 6. Push to your fork and submit a pull request to `develop` branch
data/Gemfile.lock CHANGED
@@ -1,117 +1,106 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail-client (0.1.0)
4
+ truemail-client (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  addressable (2.7.0)
10
10
  public_suffix (>= 2.0.2, < 5.0)
11
- ast (2.4.0)
12
- axiom-types (0.1.1)
13
- descendants_tracker (~> 0.0.4)
14
- ice_nine (~> 0.11.0)
15
- thread_safe (~> 0.3, >= 0.3.1)
16
- bundler-audit (0.6.1)
11
+ ast (2.4.2)
12
+ bundler-audit (0.8.0)
17
13
  bundler (>= 1.2.0, < 3)
18
- thor (~> 0.18)
19
- byebug (11.1.1)
20
- childprocess (3.0.0)
21
- codeclimate-engine-rb (0.4.1)
22
- virtus (~> 1.0)
23
- coderay (1.1.2)
24
- coercible (1.0.0)
25
- descendants_tracker (~> 0.0.1)
14
+ thor (~> 1.0)
15
+ byebug (11.1.3)
16
+ childprocess (4.0.0)
17
+ coderay (1.1.3)
26
18
  colorize (0.8.1)
27
- crack (0.4.3)
28
- safe_yaml (~> 1.0.0)
29
- descendants_tracker (0.0.4)
30
- thread_safe (~> 0.3, >= 0.3.1)
31
- diff-lcs (1.3)
32
- docile (1.3.2)
33
- equalizer (0.0.11)
34
- fasterer (0.8.2)
19
+ concurrent-ruby (1.1.8)
20
+ crack (0.4.5)
21
+ rexml
22
+ diff-lcs (1.4.4)
23
+ docile (1.3.5)
24
+ faker (2.17.0)
25
+ i18n (>= 1.6, < 2)
26
+ fasterer (0.9.0)
35
27
  colorize (~> 0.7)
36
28
  ruby_parser (>= 3.14.1)
37
- ffaker (2.14.0)
38
29
  hashdiff (1.0.1)
39
- ice_nine (0.11.2)
30
+ i18n (1.8.10)
31
+ concurrent-ruby (~> 1.0)
40
32
  iniparse (1.5.0)
41
- jaro_winkler (1.5.4)
42
- json (2.3.0)
33
+ json (2.5.1)
43
34
  json_matchers (0.11.1)
44
35
  json_schema
45
- json_schema (0.20.8)
36
+ json_schema (0.21.0)
46
37
  kwalify (0.7.2)
47
- method_source (0.9.2)
48
- overcommit (0.52.1)
49
- childprocess (>= 0.6.3, < 4)
38
+ method_source (1.0.0)
39
+ overcommit (0.57.0)
40
+ childprocess (>= 0.6.3, < 5)
50
41
  iniparse (~> 1.4)
51
- parallel (1.19.1)
52
- parser (2.7.0.4)
53
- ast (~> 2.4.0)
54
- pry (0.12.2)
55
- coderay (~> 1.1.0)
56
- method_source (~> 0.9.0)
57
- pry-byebug (3.8.0)
42
+ parallel (1.20.1)
43
+ parser (3.0.1.1)
44
+ ast (~> 2.4.1)
45
+ pry (0.13.1)
46
+ coderay (~> 1.1)
47
+ method_source (~> 1.0)
48
+ pry-byebug (3.9.0)
58
49
  byebug (~> 11.0)
59
- pry (~> 0.10)
60
- psych (3.1.0)
61
- public_suffix (4.0.3)
50
+ pry (~> 0.13.0)
51
+ psych (3.3.1)
52
+ public_suffix (4.0.6)
62
53
  rainbow (3.0.0)
63
- rake (13.0.1)
64
- reek (5.6.0)
65
- codeclimate-engine-rb (~> 0.4.0)
54
+ rake (13.0.3)
55
+ reek (6.0.4)
66
56
  kwalify (~> 0.7.0)
67
- parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
68
- psych (~> 3.1.0)
57
+ parser (~> 3.0.0)
58
+ psych (~> 3.1)
69
59
  rainbow (>= 2.0, < 4.0)
70
- rexml (3.2.4)
71
- rspec (3.9.0)
72
- rspec-core (~> 3.9.0)
73
- rspec-expectations (~> 3.9.0)
74
- rspec-mocks (~> 3.9.0)
75
- rspec-core (3.9.1)
76
- rspec-support (~> 3.9.1)
77
- rspec-expectations (3.9.0)
60
+ regexp_parser (2.1.1)
61
+ rexml (3.2.5)
62
+ rspec (3.10.0)
63
+ rspec-core (~> 3.10.0)
64
+ rspec-expectations (~> 3.10.0)
65
+ rspec-mocks (~> 3.10.0)
66
+ rspec-core (3.10.1)
67
+ rspec-support (~> 3.10.0)
68
+ rspec-expectations (3.10.1)
78
69
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.9.0)
80
- rspec-mocks (3.9.1)
70
+ rspec-support (~> 3.10.0)
71
+ rspec-mocks (3.10.2)
81
72
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.9.0)
83
- rspec-support (3.9.2)
84
- rubocop (0.80.1)
85
- jaro_winkler (~> 1.5.1)
73
+ rspec-support (~> 3.10.0)
74
+ rspec-support (3.10.2)
75
+ rubocop (1.14.0)
86
76
  parallel (~> 1.10)
87
- parser (>= 2.7.0.1)
77
+ parser (>= 3.0.0.0)
88
78
  rainbow (>= 2.2.2, < 4.0)
79
+ regexp_parser (>= 1.8, < 3.0)
89
80
  rexml
81
+ rubocop-ast (>= 1.5.0, < 2.0)
90
82
  ruby-progressbar (~> 1.7)
91
- unicode-display_width (>= 1.4.0, < 1.7)
92
- rubocop-performance (1.5.2)
93
- rubocop (>= 0.71.0)
94
- rubocop-rspec (1.38.1)
95
- rubocop (>= 0.68.1)
96
- ruby-progressbar (1.10.1)
97
- ruby_parser (3.14.2)
83
+ unicode-display_width (>= 1.4.0, < 3.0)
84
+ rubocop-ast (1.5.0)
85
+ parser (>= 3.0.1.1)
86
+ rubocop-performance (1.11.3)
87
+ rubocop (>= 1.7.0, < 2.0)
88
+ rubocop-ast (>= 0.4.0)
89
+ rubocop-rspec (2.3.0)
90
+ rubocop (~> 1.0)
91
+ rubocop-ast (>= 1.1.0)
92
+ ruby-progressbar (1.11.0)
93
+ ruby_parser (3.15.1)
98
94
  sexp_processor (~> 4.9)
99
- safe_yaml (1.0.5)
100
- sexp_processor (4.14.1)
95
+ sexp_processor (4.15.2)
101
96
  simplecov (0.17.1)
102
97
  docile (~> 1.1)
103
98
  json (>= 1.8, < 3)
104
99
  simplecov-html (~> 0.10.0)
105
100
  simplecov-html (0.10.2)
106
- thor (0.20.3)
107
- thread_safe (0.3.6)
108
- unicode-display_width (1.6.1)
109
- virtus (1.0.5)
110
- axiom-types (~> 0.1)
111
- coercible (~> 1.0)
112
- descendants_tracker (~> 0.0, >= 0.0.3)
113
- equalizer (~> 0.0, >= 0.0.9)
114
- webmock (3.8.3)
101
+ thor (1.1.0)
102
+ unicode-display_width (2.0.0)
103
+ webmock (3.12.2)
115
104
  addressable (>= 2.3.6)
116
105
  crack (>= 0.3.2)
117
106
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -121,21 +110,21 @@ PLATFORMS
121
110
 
122
111
  DEPENDENCIES
123
112
  bundler (~> 1.16)
124
- bundler-audit (~> 0.6.1)
125
- fasterer (~> 0.8.2)
126
- ffaker (~> 2.14)
113
+ bundler-audit (~> 0.8.0)
114
+ faker (~> 2.17)
115
+ fasterer (~> 0.9.0)
127
116
  json_matchers (~> 0.11.1)
128
- overcommit (~> 0.52.1)
129
- pry-byebug (~> 3.8)
130
- rake (~> 13.0, >= 13.0.1)
131
- reek (~> 5.6)
132
- rspec (~> 3.9)
133
- rubocop (~> 0.80.1)
134
- rubocop-performance (~> 1.5, >= 1.5.2)
135
- rubocop-rspec (~> 1.38, >= 1.38.1)
117
+ overcommit (~> 0.57.0)
118
+ pry-byebug (~> 3.9)
119
+ rake (~> 13.0, >= 13.0.3)
120
+ reek (~> 6.0, >= 6.0.4)
121
+ rspec (~> 3.10)
122
+ rubocop (~> 1.14)
123
+ rubocop-performance (~> 1.11, >= 1.11.3)
124
+ rubocop-rspec (~> 2.3)
136
125
  simplecov (~> 0.17.1)
137
126
  truemail-client!
138
- webmock (~> 3.8, >= 3.8.3)
127
+ webmock (~> 3.12, >= 3.12.2)
139
128
 
140
129
  BUNDLED WITH
141
130
  1.16.6
data/README.md CHANGED
@@ -1,16 +1,26 @@
1
- # <img src='https://repository-images.githubusercontent.com/246571655/128eda80-63af-11ea-8a0e-d1a7b9043c29' height='250' alt='Truemail web API client library for Ruby' />
1
+ # ![Truemail web API client library for Ruby](https://truemail-rb.org/assets/images/truemail_logo.png)
2
2
 
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/ccc7167f4f49d4a10146/maintainability)](https://codeclimate.com/github/truemail-rb/truemail-ruby-client/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/ccc7167f4f49d4a10146/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail-ruby-client/test_coverage)
5
+ [![CircleCI](https://circleci.com/gh/truemail-rb/truemail-ruby-client/tree/develop.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail-ruby-client/tree/develop)
6
+ [![Gem Version](https://badge.fury.io/rb/truemail-client.svg)](https://badge.fury.io/rb/truemail-client)
7
+ [![Downloads](https://img.shields.io/gem/dt/truemail-client.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail-client)
8
+ [![Gitter](https://badges.gitter.im/truemail-rb/community.svg)](https://gitter.im/truemail-rb/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
9
+ [![GitHub](https://img.shields.io/github/license/truemail-rb/truemail-ruby-client)](LICENSE.txt)
10
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
3
11
 
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/ccc7167f4f49d4a10146/maintainability)](https://codeclimate.com/github/truemail-rb/truemail-ruby-client/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/ccc7167f4f49d4a10146/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail-ruby-client/test_coverage) [![CircleCI](https://circleci.com/gh/truemail-rb/truemail-ruby-client/tree/develop.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail-ruby-client/tree/develop) [![Gem Version](https://badge.fury.io/rb/truemail-client.svg)](https://badge.fury.io/rb/truemail-client) [![Downloads](https://img.shields.io/gem/dt/truemail-client.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail-client) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
12
+ `truemail-client` gem - [Truemail web API](https://github.com/truemail-rb/truemail-rack) client library for Ruby.
5
13
 
6
- `truemail-client` gem - Truemail web API client library for Ruby.
14
+ > Actual and maintainable documentation :books: for developers is living [here](https://truemail-rb.org/truemail-ruby-client).
7
15
 
8
16
  ## Table of Contents
9
17
 
18
+ - [Requirements](#requirements)
10
19
  - [Installation](#installation)
11
20
  - [Usage](#usage)
12
21
  - [Setting global configuration](#setting-global-configuration)
13
22
  - [Establishing connection with Truemail API](#establishing-connection-with-truemail-api)
23
+ - [Checking server health status](#checking-server-health-status)
14
24
  - [Additional features](#additional-features)
15
25
  - [Truemail family](#truemail-family)
16
26
  - [Contributing](#contributing)
@@ -19,6 +29,10 @@
19
29
  - [Versioning](#versioning)
20
30
  - [Changelog](CHANGELOG.md)
21
31
 
32
+ ## Requirements
33
+
34
+ Ruby MRI 2.5.0+
35
+
22
36
  ## Installation
23
37
 
24
38
  Add this line to your application's Gemfile:
@@ -39,7 +53,6 @@ Or install it yourself as:
39
53
 
40
54
  To have an access for `Truemail::Client` you must configure it first as in the example below:
41
55
 
42
-
43
56
  ### Setting global configuration
44
57
 
45
58
  ```ruby
@@ -66,9 +79,9 @@ After successful configuration, you can establish connection with Truemail serve
66
79
 
67
80
  ```ruby
68
81
  Truemail::Client.validate('admin@bestweb.com.ua')
82
+ ```
69
83
 
70
- =>
71
-
84
+ ```json
72
85
  {
73
86
  "date": "2020-02-26 17:00:56 +0200",
74
87
  "email": "admin@bestweb.com.ua",
@@ -83,7 +96,8 @@ Truemail::Client.validate('admin@bestweb.com.ua')
83
96
  "blacklisted_domains": null,
84
97
  "smtp_safe_check": false,
85
98
  "email_pattern": "default gem value",
86
- "smtp_error_body_pattern": "default gem value"
99
+ "smtp_error_body_pattern": "default gem value",
100
+ "not_rfc_mx_lookup_flow": false
87
101
  }
88
102
  }
89
103
  ```
@@ -96,6 +110,16 @@ Truemail::Client.validate('admin@bestweb.com.ua')
96
110
  }
97
111
  ```
98
112
 
113
+ ### Checking server health status
114
+
115
+ After successful configuration, you can check health-status of Truemail server.
116
+
117
+ ```ruby
118
+ Truemail::Client.server_healthy?
119
+
120
+ => true
121
+ ```
122
+
99
123
  ### Additional features
100
124
 
101
125
  #### Read global configuration
@@ -104,7 +128,6 @@ After successful configuration, you can read current `Truemail::Client` configur
104
128
 
105
129
  ```ruby
106
130
  Truemail::Client.configuration
107
-
108
131
  => #<Truemail::Client::Configuration:0x000055eafc588878
109
132
  @host="example.com",
110
133
  @port=80,
@@ -119,7 +142,6 @@ Truemail::Client.configuration.port = 8080
119
142
  => 8080
120
143
 
121
144
  Truemail::Client.configuration
122
-
123
145
  => #<Truemail::Client::Configuration:0x000055eafc588878
124
146
  @host="example.com",
125
147
  @port=8080,
@@ -142,23 +164,16 @@ Truemail::Client.configuration
142
164
 
143
165
  ## Truemail family
144
166
 
145
- All Truemail extensions: https://github.com/truemail-rb
146
-
147
- ### truemail
148
-
149
- gem `truemail` - Configurable plain Ruby email validator, https://github.com/rubygarage/truemail
150
-
151
- ### truemail server
152
-
153
- Lightweight rack based web API wrapper for Truemail, https://github.com/truemail-rb/truemail-rack
154
-
155
- ### truemail-rack-docker-image
156
-
157
- Lightweight rack based web API [dockerized image](https://hub.docker.com/r/truemail/truemail-rack) :whale: of Truemail server, https://github.com/truemail-rb/truemail-rack-docker-image
158
-
159
- ### truemail-rspec
167
+ All Truemail solutions: https://truemail-rb.org
160
168
 
161
- gem `truemail-rspec` - Truemail configuration and validator RSpec helpers, https://github.com/truemail-rb/truemail-rspec
169
+ | Name | Type | Description |
170
+ | --- | --- | --- |
171
+ | [truemail](https://github.com/truemail-rb/truemail) | ruby gem | Configurable framework agnostic plain Ruby email validator, main core |
172
+ | [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail |
173
+ | [truemail-rack-docker](https://github.com/truemail-rb/truemail-rack-docker-image) | docker image | Lightweight rack based web API [dockerized image](https://hub.docker.com/r/truemail/truemail-rack) :whale: of Truemail server |
174
+ | [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Truemail web API client library for Crystal |
175
+ | [truemail-java-client](https://github.com/truemail-rb/truemail-java-client) | java lib | Truemail web API client library for Java |
176
+ | [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration and validator RSpec helpers |
162
177
 
163
178
  ## Contributing
164
179
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'truemail/client/version'
4
- require 'truemail/client/configuration'
5
- require 'truemail/client/http'
3
+ require_relative '../truemail/client/version'
4
+ require_relative '../truemail/client/configuration'
5
+ require_relative '../truemail/client/http'
6
6
 
7
7
  module Truemail
8
8
  module Client
@@ -12,7 +12,7 @@ module Truemail
12
12
  class << self
13
13
  def configuration(&block)
14
14
  @configuration ||= begin
15
- return unless block_given?
15
+ return unless block
16
16
  configuration = Truemail::Client::Configuration.new(&block)
17
17
  raise_unless(configuration.complete?, Truemail::Client::INCOMPLETE_CONFIG)
18
18
  configuration
@@ -29,7 +29,12 @@ module Truemail
29
29
 
30
30
  def validate(email)
31
31
  raise_unless(Truemail::Client.configuration, Truemail::Client::NOT_CONFIGURED)
32
- Truemail::Client::Http.new(email).run
32
+ Truemail::Client::Http.new(email: email).run
33
+ end
34
+
35
+ def server_healthy?
36
+ raise_unless(Truemail::Client.configuration, Truemail::Client::NOT_CONFIGURED)
37
+ Truemail::Client::Http.new(Truemail::Client::Http::HEALTHCHECK_ENDPOINT).run.empty?
33
38
  end
34
39
 
35
40
  private
@@ -18,7 +18,7 @@ module Truemail
18
18
  def initialize(&block)
19
19
  @secure_connection = false
20
20
  @port = Truemail::Client::Configuration::DEFAULT_PORT
21
- tap(&block) if block_given?
21
+ tap(&block) if block
22
22
  end
23
23
 
24
24
  %i[host port token].each do |method|