From 35c92b4ff117e8a7e68d05fa28d42414a028a7d4 Mon Sep 17 00:00:00 2001 From: Matt Outten Date: Wed, 10 Oct 2018 19:18:36 -0400 Subject: [PATCH] Remove unnecessary require statements Because none of these files use the JSON library, it's not necessary to use `require 'json'` at the beginning of the files. This is only a minor cleanup but using more `require` statements does have the potential to slow down applications when more gems are installed and the include path grows within Ruby. --- lib/sendgrid/helpers/mail/asm.rb | 2 -- lib/sendgrid/helpers/mail/attachment.rb | 2 -- lib/sendgrid/helpers/mail/bcc_settings.rb | 2 -- lib/sendgrid/helpers/mail/bypass_list_management.rb | 2 -- lib/sendgrid/helpers/mail/category.rb | 2 -- lib/sendgrid/helpers/mail/click_tracking.rb | 2 -- lib/sendgrid/helpers/mail/content.rb | 2 -- lib/sendgrid/helpers/mail/custom_arg.rb | 2 -- lib/sendgrid/helpers/mail/email.rb | 2 -- lib/sendgrid/helpers/mail/footer.rb | 2 -- lib/sendgrid/helpers/mail/ganalytics.rb | 4 +--- lib/sendgrid/helpers/mail/header.rb | 2 -- lib/sendgrid/helpers/mail/mail.rb | 2 -- lib/sendgrid/helpers/mail/mail_settings.rb | 2 -- lib/sendgrid/helpers/mail/open_tracking.rb | 2 -- lib/sendgrid/helpers/mail/personalization.rb | 2 -- lib/sendgrid/helpers/mail/section.rb | 2 -- lib/sendgrid/helpers/mail/spam_check.rb | 2 -- lib/sendgrid/helpers/mail/subscription_tracking.rb | 2 -- lib/sendgrid/helpers/mail/substitution.rb | 2 -- lib/sendgrid/helpers/mail/tracking_settings.rb | 2 -- lib/sendgrid/helpers/stats/metrics.rb | 2 -- lib/sendgrid/helpers/stats/stats_response.rb | 2 -- 23 files changed, 1 insertion(+), 47 deletions(-) diff --git a/lib/sendgrid/helpers/mail/asm.rb b/lib/sendgrid/helpers/mail/asm.rb index 6992bcb7..f3727641 100644 --- a/lib/sendgrid/helpers/mail/asm.rb +++ b/lib/sendgrid/helpers/mail/asm.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class ASM def initialize(group_id: nil, groups_to_display: nil) diff --git a/lib/sendgrid/helpers/mail/attachment.rb b/lib/sendgrid/helpers/mail/attachment.rb index 5fa2fb79..5174ba34 100644 --- a/lib/sendgrid/helpers/mail/attachment.rb +++ b/lib/sendgrid/helpers/mail/attachment.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Attachment def initialize diff --git a/lib/sendgrid/helpers/mail/bcc_settings.rb b/lib/sendgrid/helpers/mail/bcc_settings.rb index 24a1bd00..6df9bc32 100644 --- a/lib/sendgrid/helpers/mail/bcc_settings.rb +++ b/lib/sendgrid/helpers/mail/bcc_settings.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class BccSettings def initialize(enable: nil, email: nil) diff --git a/lib/sendgrid/helpers/mail/bypass_list_management.rb b/lib/sendgrid/helpers/mail/bypass_list_management.rb index 27622552..fa19a5c9 100644 --- a/lib/sendgrid/helpers/mail/bypass_list_management.rb +++ b/lib/sendgrid/helpers/mail/bypass_list_management.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class BypassListManagement def initialize(enable: nil) diff --git a/lib/sendgrid/helpers/mail/category.rb b/lib/sendgrid/helpers/mail/category.rb index e3ad6661..175f81dd 100644 --- a/lib/sendgrid/helpers/mail/category.rb +++ b/lib/sendgrid/helpers/mail/category.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Category attr_accessor :name diff --git a/lib/sendgrid/helpers/mail/click_tracking.rb b/lib/sendgrid/helpers/mail/click_tracking.rb index 5af7ec1a..60f894de 100644 --- a/lib/sendgrid/helpers/mail/click_tracking.rb +++ b/lib/sendgrid/helpers/mail/click_tracking.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class ClickTracking def initialize(enable: nil, enable_text: nil) diff --git a/lib/sendgrid/helpers/mail/content.rb b/lib/sendgrid/helpers/mail/content.rb index c651d3ba..35a5b439 100644 --- a/lib/sendgrid/helpers/mail/content.rb +++ b/lib/sendgrid/helpers/mail/content.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Content def initialize(type: nil, value: nil) diff --git a/lib/sendgrid/helpers/mail/custom_arg.rb b/lib/sendgrid/helpers/mail/custom_arg.rb index 69b0558d..bfd20220 100644 --- a/lib/sendgrid/helpers/mail/custom_arg.rb +++ b/lib/sendgrid/helpers/mail/custom_arg.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class CustomArg def initialize(key: nil, value: nil) diff --git a/lib/sendgrid/helpers/mail/email.rb b/lib/sendgrid/helpers/mail/email.rb index 55e97b34..217a9995 100644 --- a/lib/sendgrid/helpers/mail/email.rb +++ b/lib/sendgrid/helpers/mail/email.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Email def initialize(email: nil, name: nil) diff --git a/lib/sendgrid/helpers/mail/footer.rb b/lib/sendgrid/helpers/mail/footer.rb index 42452e13..cc942e5c 100644 --- a/lib/sendgrid/helpers/mail/footer.rb +++ b/lib/sendgrid/helpers/mail/footer.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Footer def initialize(enable: nil, text: nil, html: nil) diff --git a/lib/sendgrid/helpers/mail/ganalytics.rb b/lib/sendgrid/helpers/mail/ganalytics.rb index 8dfb364b..c12d94e2 100644 --- a/lib/sendgrid/helpers/mail/ganalytics.rb +++ b/lib/sendgrid/helpers/mail/ganalytics.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Ganalytics def initialize(enable: nil, utm_source: nil, utm_medium: nil, utm_term: nil, utm_content: nil, utm_campaign: nil, utm_name: nil) @@ -71,4 +69,4 @@ def to_json(*) }.delete_if { |_, value| value.to_s.strip == '' } end end -end \ No newline at end of file +end diff --git a/lib/sendgrid/helpers/mail/header.rb b/lib/sendgrid/helpers/mail/header.rb index 475f6b92..ad9bfc7a 100644 --- a/lib/sendgrid/helpers/mail/header.rb +++ b/lib/sendgrid/helpers/mail/header.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Header def initialize(key: nil, value: nil) diff --git a/lib/sendgrid/helpers/mail/mail.rb b/lib/sendgrid/helpers/mail/mail.rb index 37db5629..1104f294 100644 --- a/lib/sendgrid/helpers/mail/mail.rb +++ b/lib/sendgrid/helpers/mail/mail.rb @@ -1,7 +1,5 @@ # Build the request body for the v3/mail/send endpoint # Please see the examples/helpers/mail/example.rb for a demonstration of usage -require 'json' - module SendGrid class Mail diff --git a/lib/sendgrid/helpers/mail/mail_settings.rb b/lib/sendgrid/helpers/mail/mail_settings.rb index 0b7f00d5..109bf4fe 100644 --- a/lib/sendgrid/helpers/mail/mail_settings.rb +++ b/lib/sendgrid/helpers/mail/mail_settings.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class MailSettings def initialize diff --git a/lib/sendgrid/helpers/mail/open_tracking.rb b/lib/sendgrid/helpers/mail/open_tracking.rb index 448f40c9..c468753a 100644 --- a/lib/sendgrid/helpers/mail/open_tracking.rb +++ b/lib/sendgrid/helpers/mail/open_tracking.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class OpenTracking def initialize(enable: nil, substitution_tag: nil) diff --git a/lib/sendgrid/helpers/mail/personalization.rb b/lib/sendgrid/helpers/mail/personalization.rb index ad6d5c18..ea427b2b 100644 --- a/lib/sendgrid/helpers/mail/personalization.rb +++ b/lib/sendgrid/helpers/mail/personalization.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Personalization diff --git a/lib/sendgrid/helpers/mail/section.rb b/lib/sendgrid/helpers/mail/section.rb index 57b45ad6..36890ea6 100644 --- a/lib/sendgrid/helpers/mail/section.rb +++ b/lib/sendgrid/helpers/mail/section.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Section def initialize(key: nil, value: nil) diff --git a/lib/sendgrid/helpers/mail/spam_check.rb b/lib/sendgrid/helpers/mail/spam_check.rb index e06875fe..c3b788d7 100644 --- a/lib/sendgrid/helpers/mail/spam_check.rb +++ b/lib/sendgrid/helpers/mail/spam_check.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class SpamCheck def initialize(enable: nil, threshold: nil, post_to_url: nil) diff --git a/lib/sendgrid/helpers/mail/subscription_tracking.rb b/lib/sendgrid/helpers/mail/subscription_tracking.rb index 7d956897..971f0586 100644 --- a/lib/sendgrid/helpers/mail/subscription_tracking.rb +++ b/lib/sendgrid/helpers/mail/subscription_tracking.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class SubscriptionTracking def initialize(enable: nil, text: nil, html: nil, substitution_tag: nil) diff --git a/lib/sendgrid/helpers/mail/substitution.rb b/lib/sendgrid/helpers/mail/substitution.rb index 3aafe62b..8b6bce2d 100644 --- a/lib/sendgrid/helpers/mail/substitution.rb +++ b/lib/sendgrid/helpers/mail/substitution.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Substitution def initialize(key: nil, value: nil) diff --git a/lib/sendgrid/helpers/mail/tracking_settings.rb b/lib/sendgrid/helpers/mail/tracking_settings.rb index c9856b19..50fcf410 100644 --- a/lib/sendgrid/helpers/mail/tracking_settings.rb +++ b/lib/sendgrid/helpers/mail/tracking_settings.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class TrackingSettings def initialize diff --git a/lib/sendgrid/helpers/stats/metrics.rb b/lib/sendgrid/helpers/stats/metrics.rb index 59eef7a1..4f77a397 100644 --- a/lib/sendgrid/helpers/stats/metrics.rb +++ b/lib/sendgrid/helpers/stats/metrics.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class Metrics attr_reader :blocks, :bounce_drops, diff --git a/lib/sendgrid/helpers/stats/stats_response.rb b/lib/sendgrid/helpers/stats/stats_response.rb index 477ecbe9..8e2a04b0 100644 --- a/lib/sendgrid/helpers/stats/stats_response.rb +++ b/lib/sendgrid/helpers/stats/stats_response.rb @@ -1,5 +1,3 @@ -require 'json' - module SendGrid class StatsResponse def initialize(args)