Skip to content

Commit

Permalink
Technical/Refactor gem codebase (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
bestwebua authored Mar 23, 2020
1 parent aad2836 commit ce553ee
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 27 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.1] - 2020.03.23
### Changed
- `Truemail.configuration`
- `Truemail::ArgumentError`
- `Truemail::Audit::Ptr`
- `Truemail::VERSION`
- gem development dependencies
- gem documentation

### Removed
`Truemail::Configuration.retry_count` deprecated, and alias for this method has been removed. Please use `Truemail::Configuration.connection_attempts` instead.

## [1.6.0] - 2020-02-01
### Added
- Possibility to use `Truemail::Validator` instance represented as json directly
Expand Down
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
truemail (1.6.0)
truemail (1.6.1)
simpleidn (~> 0.1.1)

GEM
Expand All @@ -28,10 +28,10 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
equalizer (0.0.11)
fasterer (0.8.1)
fasterer (0.8.2)
colorize (~> 0.7)
ruby_parser (>= 3.14.1)
ffaker (2.13.0)
ffaker (2.14.0)
ice_nine (0.11.2)
iniparse (1.4.4)
jaro_winkler (1.5.4)
Expand All @@ -40,19 +40,19 @@ GEM
json_schema
json_schema (0.20.8)
kwalify (0.7.2)
method_source (0.9.2)
method_source (1.0.0)
overcommit (0.52.1)
childprocess (>= 0.6.3, < 4)
iniparse (~> 1.4)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.8.0)
pry (0.13.0)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.10)
pry (~> 0.13.0)
psych (3.1.0)
rainbow (3.0.0)
rake (13.0.1)
Expand Down Expand Up @@ -87,9 +87,9 @@ GEM
rubocop-rspec (1.37.1)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
ruby_parser (3.14.1)
ruby_parser (3.14.2)
sexp_processor (~> 4.9)
sexp_processor (4.13.0)
sexp_processor (4.14.1)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -118,11 +118,11 @@ PLATFORMS
DEPENDENCIES
bundler (~> 1.16)
bundler-audit (~> 0.6.1)
fasterer (~> 0.8.1)
ffaker (~> 2.13)
fasterer (~> 0.8.2)
ffaker (~> 2.14)
json_matchers (~> 0.11.1)
overcommit (~> 0.52.1)
pry-byebug (~> 3.8)
pry-byebug (~> 3.9)
rake (~> 13.0, >= 13.0.1)
reek (~> 5.6)
rspec (~> 3.9)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,14 @@ end

All Truemail extensions: https://github.com/truemail-rb

### truemail server

Lightweight rack based web API wrapper for Truemail, https://github.com/truemail-rb/truemail-rack

### truemail-rack-docker-image

Lightweight rack based web API dockerized image :whale: of [Truemail server](https://github.com/truemail-rb/truemail-rack) hosted on [dockerhub](https://hub.docker.com/r/truemail/truemail-rack), https://github.com/truemail-rb/truemail-rack-docker-image

### truemail-rspec

gem `truemail-rspec` - Truemail configuration and validator RSpec helpers, https://github.com/truemail-rb/truemail-rspec
Expand Down
5 changes: 2 additions & 3 deletions lib/truemail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ module Truemail
NOT_CONFIGURED = 'use Truemail.configure before or pass custom configuration'

class << self
def configuration
def configuration(&block)
@configuration ||= begin
return unless block_given?
configuration = Truemail::Configuration.new
yield(configuration)
configuration = Truemail::Configuration.new(&block)
raise_unless(configuration.complete?, Truemail::INCOMPLETE_CONFIG)
configuration
end
Expand Down
1 change: 1 addition & 0 deletions lib/truemail/audit/ptr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Truemail
module Audit
class Ptr < Truemail::Audit::Base
require 'net/http'
require 'ipaddr'
require 'resolv'

Expand Down
2 changes: 0 additions & 2 deletions lib/truemail/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class Configuration

attr_accessor :whitelist_validation, :smtp_safe_check

alias retry_count connection_attempts

def initialize(&block)
instance_initializer.each do |instace_variable, value|
instance_variable_set(:"@#{instace_variable}", value)
Expand Down
4 changes: 2 additions & 2 deletions lib/truemail/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module Truemail
ConfigurationError = Class.new(StandardError)

ArgumentError = Class.new(StandardError) do
def initialize(current_param, class_name)
super("#{current_param} is not a valid #{class_name}")
def initialize(arg_value, arg_name)
super("#{arg_value} is not a valid #{arg_name}")
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/truemail/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Truemail
VERSION = '1.6.0'
VERSION = '1.6.1'
end
4 changes: 2 additions & 2 deletions spec/truemail/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
end

RSpec.describe Truemail::ArgumentError do
subject(:argument_error_instance) { described_class.new('parameter', Array) }
subject(:argument_error_instance) { described_class.new('arg_value', 'arg_name') }

specify { expect(described_class).to be < StandardError }
specify { expect(argument_error_instance).to be_an_instance_of(described_class) }
specify { expect(argument_error_instance.to_s).to eq('parameter is not a valid Array') }
specify { expect(argument_error_instance.to_s).to eq('arg_value is not a valid arg_name') }
end

RSpec.describe Truemail::PunycodeRepresenter do
Expand Down
6 changes: 3 additions & 3 deletions truemail.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'bundler-audit', '~> 0.6.1'
spec.add_development_dependency 'fasterer', '~> 0.8.1'
spec.add_development_dependency 'ffaker', '~> 2.13'
spec.add_development_dependency 'fasterer', '~> 0.8.2'
spec.add_development_dependency 'ffaker', '~> 2.14'
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
spec.add_development_dependency 'overcommit', '~> 0.52.1'
spec.add_development_dependency 'pry-byebug', '~> 3.8'
spec.add_development_dependency 'pry-byebug', '~> 3.9'
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
spec.add_development_dependency 'reek', '~> 5.6'
spec.add_development_dependency 'rspec', '~> 3.9'
Expand Down

0 comments on commit ce553ee

Please sign in to comment.