diff --git a/examples/scopes/scopes.rb b/examples/scopes/scopes.rb index adec506b..f24c8b6f 100644 --- a/examples/scopes/scopes.rb +++ b/examples/scopes/scopes.rb @@ -1,4 +1,4 @@ -require_relative '../../lib/sendgrid-ruby.rb' +require_relative '../../lib/sendgrid-ruby' sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']) ################################################## diff --git a/lib/sendgrid/base_interface.rb b/lib/sendgrid/base_interface.rb index c288e632..01dadce1 100644 --- a/lib/sendgrid/base_interface.rb +++ b/lib/sendgrid/base_interface.rb @@ -5,6 +5,7 @@ class BaseInterface attr_accessor :client attr_reader :request_headers, :host, :version, :impersonate_subuser + # * *Args* : # - +auth+ -> authorization header value # - +host+ -> the base URL for the API diff --git a/lib/sendgrid/helpers/inbound/app.rb b/lib/sendgrid/helpers/inbound/app.rb index fa9f188d..9ccc6ccb 100644 --- a/lib/sendgrid/helpers/inbound/app.rb +++ b/lib/sendgrid/helpers/inbound/app.rb @@ -18,7 +18,7 @@ class Main < Sinatra::Base configure :production, :development do enable :logging - set :config, YAML.load_file(File.dirname(__FILE__) + '/config.yml') + set :config, YAML.load_file("#{File.dirname(__FILE__)}/config.yml") end get '/' do diff --git a/lib/sendgrid/helpers/inbound/send.rb b/lib/sendgrid/helpers/inbound/send.rb index 5085a0e3..e6818d77 100644 --- a/lib/sendgrid/helpers/inbound/send.rb +++ b/lib/sendgrid/helpers/inbound/send.rb @@ -8,7 +8,7 @@ opt = OptionParser.new opt.on('--host=HOST') { |v| OPTS[:host] = v } argv = opt.parse!(ARGV) -config = YAML.load_file(File.dirname(__FILE__) + '/config.yml') +config = YAML.load_file("#{File.dirname(__FILE__)}/config.yml") host = OPTS[:host] || config['host'] client = SendGrid::Client.new(host: host) File.open(argv[0]) do |file| diff --git a/lib/sendgrid/helpers/mail/tracking_settings.rb b/lib/sendgrid/helpers/mail/tracking_settings.rb index acc6fdce..9ea9a99a 100644 --- a/lib/sendgrid/helpers/mail/tracking_settings.rb +++ b/lib/sendgrid/helpers/mail/tracking_settings.rb @@ -3,6 +3,7 @@ module SendGrid class TrackingSettings attr_writer :click_tracking, :open_tracking, :subscription_tracking, :ganalytics + def initialize @click_tracking = nil @open_tracking = nil diff --git a/lib/sendgrid/helpers/permissions/scope.rb b/lib/sendgrid/helpers/permissions/scope.rb index c7bd3ba9..5edff04d 100644 --- a/lib/sendgrid/helpers/permissions/scope.rb +++ b/lib/sendgrid/helpers/permissions/scope.rb @@ -3,7 +3,7 @@ module SendGrid class Scope - SCOPES = YAML.load_file(File.dirname(__FILE__) + '/scopes.yml').freeze + SCOPES = YAML.load_file("#{File.dirname(__FILE__)}/scopes.yml").freeze class << self def admin_permissions diff --git a/spec/fixtures/event_webhook.rb b/spec/fixtures/event_webhook.rb index 9195129c..e0701c2c 100644 --- a/spec/fixtures/event_webhook.rb +++ b/spec/fixtures/event_webhook.rb @@ -7,7 +7,7 @@ module EventWebhook SIGNATURE = 'MEUCIGHQVtGj+Y3LkG9fLcxf3qfI10QysgDWmMOVmxG0u6ZUAiEAyBiXDWzM+uOe5W0JuG+luQAbPIqHh89M15TluLtEZtM='.freeze FAILING_SIGNATURE = 'MEUCIQCtIHJeH93Y+qpYeWrySphQgpNGNr/U+UyUlBkU6n7RAwIgJTz2C+8a8xonZGi6BpSzoQsbVRamr2nlxFDWYNH3j/0='.freeze TIMESTAMP = '1600112502'.freeze - PAYLOAD = [ + PAYLOAD = "#{[ { email: 'hello@world.com', event: 'dropped', @@ -17,6 +17,6 @@ module EventWebhook 'smtp-id': '', timestamp: 1_600_112_492 } - ].to_json + "\r\n" # Be sure to include the trailing carriage return and newline! + ].to_json}\r\n".freeze # Be sure to include the trailing carriage return and newline! end end diff --git a/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb b/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb index 1d928e82..ec0dd4b9 100644 --- a/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +++ b/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb @@ -78,7 +78,7 @@ Fixtures::EventWebhook::SIGNATURE, Fixtures::EventWebhook::TIMESTAMP ) - end .to raise_error(SendGrid::EventWebhook::NotSupportedError) + end.to raise_error(SendGrid::EventWebhook::NotSupportedError) end end end diff --git a/test/sendgrid/permissions/test_scopes.rb b/test/sendgrid/permissions/test_scopes.rb index a299ce25..37896fa2 100644 --- a/test/sendgrid/permissions/test_scopes.rb +++ b/test/sendgrid/permissions/test_scopes.rb @@ -11,7 +11,7 @@ class TestCategory < Minitest::Test # 4. test read only and full access scopes by loading scopes.yaml def setup - @scopes_from_yaml = YAML.load_file(File.dirname(__FILE__) + '/../../../lib/sendgrid/helpers/permissions/scopes.yml').freeze + @scopes_from_yaml = YAML.load_file("#{File.dirname(__FILE__)}/../../../lib/sendgrid/helpers/permissions/scopes.yml").freeze end def test_admin_scopes diff --git a/test/sendgrid/test_sendgrid-ruby.rb b/test/sendgrid/test_sendgrid-ruby.rb index 248beb07..814e1f86 100644 --- a/test/sendgrid/test_sendgrid-ruby.rb +++ b/test/sendgrid/test_sendgrid-ruby.rb @@ -1,6 +1,6 @@ require 'simplecov' SimpleCov.start -require_relative '../../lib/sendgrid-ruby.rb' +require_relative '../../lib/sendgrid-ruby' require 'ruby_http_client' require 'minitest/autorun' require 'minitest/unit'