Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--display-only-fail-level-offenses
2 changes: 1 addition & 1 deletion emailable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Gem::Specification.new do |s|
s.name = 'emailable'
s.version = Emailable::VERSION
s.summary = 'Ruby bindings for the Emailable API'
s.description = 'Email Verification that’s astonishingly easy and low-cost. '\
s.description = 'Email Verification that’s astonishingly easy and low-cost. ' \
'See https://emailable.com for details.'
s.homepage = 'https://emailable.com'
s.author = 'Emailable'
Expand Down
3 changes: 1 addition & 2 deletions lib/emailable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Emailable

class << self
attr_accessor :api_key, :max_network_retries, :open_timeout, :read_timeout,
:write_timeout
:write_timeout
end

module_function
Expand All @@ -46,5 +46,4 @@ def account(parameters = {})
response = client.request(:get, 'account', parameters)
Account.new(response.body)
end

end
1 change: 0 additions & 1 deletion lib/emailable/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ def inspect
"#<#{self.class}:0x#{(object_id << 1).to_s(16)}> JSON: " +
JSON.pretty_generate(ivars)
end

end
end
1 change: 0 additions & 1 deletion lib/emailable/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,5 @@ def should_retry?(error, num_retries)
false
end
end

end
end
6 changes: 2 additions & 4 deletions lib/emailable/email_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
# attr_accessor :email_verification_result
#
class EmailValidator < ActiveModel::EachValidator

def validate_each(record, attribute, value)
smtp = boolean_option_or_raise_error(:smtp, true)

states = options.fetch(:states, %i(deliverable risky unknown))
allowed_states = %i[deliverable undeliverable risky unknown]
unless (states - allowed_states).empty?
raise ArgumentError, ':states must be an array of symbols containing '\
"any or all of :#{allowed_states.join(', :')}"
raise ArgumentError, ':states must be an array of symbols containing ' \
"any or all of :#{allowed_states.join(', :')}"
end

free = boolean_option_or_raise_error(:free, true)
Expand Down Expand Up @@ -71,5 +70,4 @@ def boolean_option_or_raise_error(name, default)

option
end

end
2 changes: 0 additions & 2 deletions lib/emailable/resources/api_resource.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Emailable
class APIResource

def initialize(attributes = {})
attributes.each do |attr, value|
instance_variable_set("@#{attr}", value)
Expand All @@ -23,6 +22,5 @@ def inspect
"#<#{self.class}:0x#{(object_id << 1).to_s(16)}> JSON: " +
JSON.pretty_generate(to_h)
end

end
end
2 changes: 1 addition & 1 deletion lib/emailable/resources/batch_status.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Emailable
class BatchStatus < APIResource
attr_accessor :emails, :id, :message, :reason_counts, :total_counts,
:processed, :total, :download_file
:processed, :total, :download_file

def complete?
message.include?('completed')
Expand Down
1 change: 0 additions & 1 deletion lib/emailable/resources/verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ def inspect
"#<#{self.class}:0x#{(object_id << 1).to_s(16)}#{@email}> JSON: " +
JSON.pretty_generate(to_h)
end

end
end
2 changes: 0 additions & 2 deletions lib/emailable/response.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
module Emailable
class Response

attr_accessor :status, :body

def initialize(response)
@status = response.code.to_i
@body = JSON.parse(response.body)
end

end
end
2 changes: 0 additions & 2 deletions test/authentication_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'test_helper'

class AuthenticationTest < Minitest::Test

def setup
@api_key = 'test_7aff7fc0142c65f86a00'
@email = 'jarrett@emailable.com'
Expand Down Expand Up @@ -37,5 +36,4 @@ def test_does_not_modify_params
assert_equal @api_key, params[:api_key]
assert_equal @email, params[:email]
end

end
3 changes: 1 addition & 2 deletions test/email_validator_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'test_helper'

class EmailValidatorTest < Minitest::Test

def setup
Emailable.api_key = 'test_7aff7fc0142c65f86a00'
end
Expand Down Expand Up @@ -70,6 +69,7 @@ def user_class(
)
Class.new do
include ActiveModel::Model

attr_accessor :email, :email_verification_result

validates :email, presence: true, email: {
Expand All @@ -88,5 +88,4 @@ def changes
end
end
end

end
2 changes: 0 additions & 2 deletions test/emailable/batch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

module Emailable
class BatchTest < Minitest::Test

def setup
Emailable.api_key = 'test_7aff7fc0142c65f86a00'
@emails = ['jarrett@emailable.com', 'support@emailable.com']
Expand All @@ -22,6 +21,5 @@ def test_batch_status
def test_batch_complete
assert @batch.complete?
end

end
end
1 change: 0 additions & 1 deletion test/emailable/resources/api_resource_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ def test_inspect
assert_equal correct, output
end
end

end
end
2 changes: 0 additions & 2 deletions test/emailable_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'test_helper'

class EmailableTest < Minitest::Test

def setup
Emailable.api_key = 'test_7aff7fc0142c65f86a00'
end
Expand Down Expand Up @@ -77,5 +76,4 @@ def test_slow_verification
Emailable.verify('slow@example.com')
end
end

end