From c6829a83bc52f2fbcdad8929624d0440b6c343e3 Mon Sep 17 00:00:00 2001 From: Jarrett Lusso Date: Sat, 22 Nov 2025 12:12:14 -0500 Subject: [PATCH] RuboCop fixes --- .rubocop | 1 + emailable.gemspec | 2 +- lib/emailable.rb | 3 +-- lib/emailable/batch.rb | 1 - lib/emailable/client.rb | 1 - lib/emailable/email_validator.rb | 6 ++---- lib/emailable/resources/api_resource.rb | 2 -- lib/emailable/resources/batch_status.rb | 2 +- lib/emailable/resources/verification.rb | 1 - lib/emailable/response.rb | 2 -- test/authentication_test.rb | 2 -- test/email_validator_test.rb | 3 +-- test/emailable/batch_test.rb | 2 -- test/emailable/resources/api_resource_test.rb | 1 - test/emailable_test.rb | 2 -- 15 files changed, 7 insertions(+), 24 deletions(-) create mode 100644 .rubocop diff --git a/.rubocop b/.rubocop new file mode 100644 index 0000000..f5d4c03 --- /dev/null +++ b/.rubocop @@ -0,0 +1 @@ +--display-only-fail-level-offenses diff --git a/emailable.gemspec b/emailable.gemspec index d9bd82e..415a7a4 100644 --- a/emailable.gemspec +++ b/emailable.gemspec @@ -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' diff --git a/lib/emailable.rb b/lib/emailable.rb index 5d2cbb4..6ba1efb 100644 --- a/lib/emailable.rb +++ b/lib/emailable.rb @@ -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 @@ -46,5 +46,4 @@ def account(parameters = {}) response = client.request(:get, 'account', parameters) Account.new(response.body) end - end diff --git a/lib/emailable/batch.rb b/lib/emailable/batch.rb index 518c55c..69536a3 100644 --- a/lib/emailable/batch.rb +++ b/lib/emailable/batch.rb @@ -49,6 +49,5 @@ def inspect "#<#{self.class}:0x#{(object_id << 1).to_s(16)}> JSON: " + JSON.pretty_generate(ivars) end - end end diff --git a/lib/emailable/client.rb b/lib/emailable/client.rb index 29b87d9..ec2d579 100644 --- a/lib/emailable/client.rb +++ b/lib/emailable/client.rb @@ -106,6 +106,5 @@ def should_retry?(error, num_retries) false end end - end end diff --git a/lib/emailable/email_validator.rb b/lib/emailable/email_validator.rb index 18a1d0e..9d6c4c6 100644 --- a/lib/emailable/email_validator.rb +++ b/lib/emailable/email_validator.rb @@ -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) @@ -71,5 +70,4 @@ def boolean_option_or_raise_error(name, default) option end - end diff --git a/lib/emailable/resources/api_resource.rb b/lib/emailable/resources/api_resource.rb index f1ff5ed..73d6c88 100644 --- a/lib/emailable/resources/api_resource.rb +++ b/lib/emailable/resources/api_resource.rb @@ -1,6 +1,5 @@ module Emailable class APIResource - def initialize(attributes = {}) attributes.each do |attr, value| instance_variable_set("@#{attr}", value) @@ -23,6 +22,5 @@ def inspect "#<#{self.class}:0x#{(object_id << 1).to_s(16)}> JSON: " + JSON.pretty_generate(to_h) end - end end diff --git a/lib/emailable/resources/batch_status.rb b/lib/emailable/resources/batch_status.rb index b63dc4c..0199a1c 100644 --- a/lib/emailable/resources/batch_status.rb +++ b/lib/emailable/resources/batch_status.rb @@ -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') diff --git a/lib/emailable/resources/verification.rb b/lib/emailable/resources/verification.rb index 6a15c86..14eb991 100644 --- a/lib/emailable/resources/verification.rb +++ b/lib/emailable/resources/verification.rb @@ -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 diff --git a/lib/emailable/response.rb b/lib/emailable/response.rb index 064e5c0..444be78 100644 --- a/lib/emailable/response.rb +++ b/lib/emailable/response.rb @@ -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 diff --git a/test/authentication_test.rb b/test/authentication_test.rb index eaa5ef5..4e0d859 100644 --- a/test/authentication_test.rb +++ b/test/authentication_test.rb @@ -1,7 +1,6 @@ require 'test_helper' class AuthenticationTest < Minitest::Test - def setup @api_key = 'test_7aff7fc0142c65f86a00' @email = 'jarrett@emailable.com' @@ -37,5 +36,4 @@ def test_does_not_modify_params assert_equal @api_key, params[:api_key] assert_equal @email, params[:email] end - end diff --git a/test/email_validator_test.rb b/test/email_validator_test.rb index f0b6541..29245cb 100644 --- a/test/email_validator_test.rb +++ b/test/email_validator_test.rb @@ -1,7 +1,6 @@ require 'test_helper' class EmailValidatorTest < Minitest::Test - def setup Emailable.api_key = 'test_7aff7fc0142c65f86a00' end @@ -70,6 +69,7 @@ def user_class( ) Class.new do include ActiveModel::Model + attr_accessor :email, :email_verification_result validates :email, presence: true, email: { @@ -88,5 +88,4 @@ def changes end end end - end diff --git a/test/emailable/batch_test.rb b/test/emailable/batch_test.rb index b80f75e..58decef 100644 --- a/test/emailable/batch_test.rb +++ b/test/emailable/batch_test.rb @@ -2,7 +2,6 @@ module Emailable class BatchTest < Minitest::Test - def setup Emailable.api_key = 'test_7aff7fc0142c65f86a00' @emails = ['jarrett@emailable.com', 'support@emailable.com'] @@ -22,6 +21,5 @@ def test_batch_status def test_batch_complete assert @batch.complete? end - end end diff --git a/test/emailable/resources/api_resource_test.rb b/test/emailable/resources/api_resource_test.rb index b2b7c7f..2991147 100644 --- a/test/emailable/resources/api_resource_test.rb +++ b/test/emailable/resources/api_resource_test.rb @@ -44,6 +44,5 @@ def test_inspect assert_equal correct, output end end - end end diff --git a/test/emailable_test.rb b/test/emailable_test.rb index 7057a2f..fbf15b0 100644 --- a/test/emailable_test.rb +++ b/test/emailable_test.rb @@ -1,7 +1,6 @@ require 'test_helper' class EmailableTest < Minitest::Test - def setup Emailable.api_key = 'test_7aff7fc0142c65f86a00' end @@ -77,5 +76,4 @@ def test_slow_verification Emailable.verify('slow@example.com') end end - end