sendgrid-ruby 6.0.0 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +1 -1
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +8 -0
  5. data/.rubocop_todo.yml +111 -0
  6. data/.travis.yml +26 -25
  7. data/CHANGELOG.md +185 -10
  8. data/CODE_OF_CONDUCT.md +57 -25
  9. data/CONTRIBUTING.md +11 -23
  10. data/Dockerfile +14 -0
  11. data/FIRST_TIMERS.md +79 -0
  12. data/Gemfile +0 -1
  13. data/ISSUE_TEMPLATE.md +30 -0
  14. data/LICENSE +21 -0
  15. data/Makefile +15 -0
  16. data/PULL_REQUEST_TEMPLATE.md +31 -0
  17. data/README.md +28 -37
  18. data/Rakefile +2 -3
  19. data/TROUBLESHOOTING.md +9 -7
  20. data/USAGE.md +146 -39
  21. data/examples/accesssettings/accesssettings.rb +9 -12
  22. data/examples/alerts/alerts.rb +8 -11
  23. data/examples/apikeys/apikeys.rb +12 -15
  24. data/examples/asm/asm.rb +27 -30
  25. data/examples/browsers/browsers.rb +0 -3
  26. data/examples/campaigns/campaigns.rb +29 -32
  27. data/examples/categories/categories.rb +0 -3
  28. data/examples/clients/clients.rb +1 -4
  29. data/examples/contactdb/contactdb.rb +63 -66
  30. data/examples/devices/devices.rb +0 -3
  31. data/examples/emailactivity/emailactivity.rb +52 -0
  32. data/examples/geo/geo.rb +0 -3
  33. data/examples/helpers/eventwebhook/example.rb +16 -0
  34. data/examples/helpers/mail/example.rb +19 -13
  35. data/examples/helpers/settings/example.rb +1 -1
  36. data/examples/helpers/stats/example.rb +4 -4
  37. data/examples/ips/ips.rb +19 -22
  38. data/examples/mail/mail.rb +72 -75
  39. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  40. data/examples/mailsettings/mailsettings.rb +21 -24
  41. data/examples/partnersettings/partnersettings.rb +3 -6
  42. data/examples/scopes/scopes.rb +8 -10
  43. data/examples/senderauthentication/senderauthentication.rb +41 -44
  44. data/examples/senders/senders.rb +28 -31
  45. data/examples/stats/stats.rb +0 -3
  46. data/examples/subusers/subusers.rb +17 -20
  47. data/examples/suppression/suppression.rb +15 -18
  48. data/examples/templates/templates.rb +29 -31
  49. data/examples/trackingsettings/trackingsettings.rb +14 -17
  50. data/examples/user/user.rb +41 -44
  51. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  52. data/lib/sendgrid-ruby.rb +5 -1
  53. data/lib/sendgrid/base_interface.rb +40 -0
  54. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  55. data/lib/sendgrid/helpers/inbound/README.md +5 -5
  56. data/lib/sendgrid/helpers/inbound/app.rb +2 -2
  57. data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
  58. data/lib/sendgrid/helpers/inbound/send.rb +3 -3
  59. data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
  60. data/lib/sendgrid/helpers/mail/README.md +3 -3
  61. data/lib/sendgrid/helpers/mail/asm.rb +4 -18
  62. data/lib/sendgrid/helpers/mail/attachment.rb +12 -43
  63. data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
  64. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
  65. data/lib/sendgrid/helpers/mail/category.rb +2 -4
  66. data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
  67. data/lib/sendgrid/helpers/mail/content.rb +2 -3
  68. data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
  69. data/lib/sendgrid/helpers/mail/email.rb +8 -5
  70. data/lib/sendgrid/helpers/mail/footer.rb +5 -27
  71. data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
  72. data/lib/sendgrid/helpers/mail/header.rb +4 -10
  73. data/lib/sendgrid/helpers/mail/mail.rb +30 -48
  74. data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
  75. data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
  76. data/lib/sendgrid/helpers/mail/personalization.rb +32 -27
  77. data/lib/sendgrid/helpers/mail/section.rb +4 -10
  78. data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
  79. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
  80. data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
  81. data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
  82. data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
  83. data/lib/sendgrid/helpers/settings/README.md +2 -2
  84. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  85. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  86. data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
  87. data/lib/sendgrid/helpers/stats/stats_response.rb +0 -2
  88. data/lib/sendgrid/sendgrid.rb +21 -0
  89. data/lib/sendgrid/twilio_email.rb +21 -0
  90. data/lib/sendgrid/version.rb +1 -1
  91. data/mail_helper_v3.md +12 -12
  92. data/sendgrid-ruby.gemspec +11 -10
  93. data/spec/fixtures/event_webhook.rb +22 -0
  94. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  95. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  96. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
  97. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
  98. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  99. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
  100. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
  101. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  102. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  103. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  104. data/spec/sendgrid/sendgrid_spec.rb +11 -0
  105. data/spec/sendgrid/twilio_email_spec.rb +11 -0
  106. data/spec/spec_helper.rb +3 -1
  107. data/static/img/github-fork.png +0 -0
  108. data/static/img/github-sign-up.png +0 -0
  109. data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
  110. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  111. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  112. data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
  113. data/test/sendgrid/helpers/mail/test_personalizations.rb +133 -93
  114. data/test/sendgrid/permissions/test_scopes.rb +1 -3
  115. data/test/sendgrid/test_sendgrid-ruby.rb +1967 -1985
  116. data/twilio_sendgrid_logo.png +0 -0
  117. data/use-cases/README.md +16 -0
  118. data/use-cases/domain-authentication.md +5 -0
  119. data/use-cases/email-statistics.md +52 -0
  120. data/use-cases/legacy-templates.md +98 -0
  121. data/use-cases/sms.md +39 -0
  122. data/use-cases/transactional-templates.md +111 -0
  123. data/use-cases/twilio-email.md +13 -0
  124. data/use-cases/twilio-setup.md +54 -0
  125. metadata +88 -34
  126. data/.github/ISSUE_TEMPLATE +0 -17
  127. data/.github/PULL_REQUEST_TEMPLATE +0 -26
  128. data/LICENSE.txt +0 -22
  129. data/USE_CASES.md +0 -377
  130. data/docker/Dockerfile +0 -12
  131. data/docker/README.md +0 -30
  132. data/lib/sendgrid/client.rb +0 -38
  133. data/test/prism.sh +0 -42
@@ -2,41 +2,19 @@ require 'json'
2
2
 
3
3
  module SendGrid
4
4
  class SpamCheck
5
- def initialize(enable: nil, threshold: nil, post_to_url: nil)
6
- @enable = enable
7
- @threshold = threshold
8
- @post_to_url = post_to_url
9
- end
5
+ attr_accessor :enable, :threshold, :post_to_url
10
6
 
11
- def enable=(enable)
7
+ def initialize(enable: nil, threshold: nil, post_to_url: nil)
12
8
  @enable = enable
13
- end
14
-
15
- def enable
16
- @enable
17
- end
18
-
19
- def threshold=(threshold)
20
9
  @threshold = threshold
21
- end
22
-
23
- def threshold
24
- @threshold
25
- end
26
-
27
- def post_to_url=(post_to_url)
28
10
  @post_to_url = post_to_url
29
11
  end
30
12
 
31
- def post_to_url
32
- @post_to_url
33
- end
34
-
35
13
  def to_json(*)
36
14
  {
37
- 'enable' => self.enable,
38
- 'threshold' => self.threshold,
39
- 'post_to_url' => self.post_to_url
15
+ 'enable' => enable,
16
+ 'threshold' => threshold,
17
+ 'post_to_url' => post_to_url
40
18
  }.delete_if { |_, value| value.to_s.strip == '' }
41
19
  end
42
20
  end
@@ -2,6 +2,8 @@ require 'json'
2
2
 
3
3
  module SendGrid
4
4
  class SubscriptionTracking
5
+ attr_accessor :enable, :text, :html, :substitution_tag
6
+
5
7
  def initialize(enable: nil, text: nil, html: nil, substitution_tag: nil)
6
8
  @enable = enable
7
9
  @text = text
@@ -9,44 +11,12 @@ module SendGrid
9
11
  @substitution_tag = substitution_tag
10
12
  end
11
13
 
12
- def enable=(enable)
13
- @enable = enable
14
- end
15
-
16
- def enable
17
- @enable
18
- end
19
-
20
- def text=(text)
21
- @text = text
22
- end
23
-
24
- def text
25
- @text
26
- end
27
-
28
- def html=(html)
29
- @html = html
30
- end
31
-
32
- def html
33
- @html
34
- end
35
-
36
- def substitution_tag=(substitution_tag)
37
- @substitution_tag = substitution_tag
38
- end
39
-
40
- def substitution_tag
41
- @substitution_tag
42
- end
43
-
44
14
  def to_json(*)
45
15
  {
46
- 'enable' => self.enable,
47
- 'text' => self.text,
48
- 'html' => self.html,
49
- 'substitution_tag' => self.substitution_tag
16
+ 'enable' => enable,
17
+ 'text' => text,
18
+ 'html' => html,
19
+ 'substitution_tag' => substitution_tag
50
20
  }.delete_if { |_, value| value.to_s.strip == '' }
51
21
  end
52
22
  end
@@ -2,22 +2,16 @@ require 'json'
2
2
 
3
3
  module SendGrid
4
4
  class Substitution
5
+ attr_accessor :substitution
6
+
5
7
  def initialize(key: nil, value: nil)
6
8
  @substitution = {}
7
- (key.nil? || value.nil?) ? @substitution = nil : @substitution[key] = value
8
- end
9
-
10
- def substitution=(substitution)
11
- @substitution = substitution
12
- end
13
-
14
- def substitution
15
- @substitution
9
+ key.nil? || value.nil? ? @substitution = nil : @substitution[key] = value
16
10
  end
17
11
 
18
12
  def to_json(*)
19
13
  {
20
- 'substitution' => self.substitution
14
+ 'substitution' => substitution
21
15
  }.delete_if { |_, value| value.to_s.strip == '' }
22
16
  end
23
17
  end
@@ -2,6 +2,8 @@ require 'json'
2
2
 
3
3
  module SendGrid
4
4
  class TrackingSettings
5
+ attr_writer :click_tracking, :open_tracking, :subscription_tracking, :ganalytics
6
+
5
7
  def initialize
6
8
  @click_tracking = nil
7
9
  @open_tracking = nil
@@ -9,44 +11,28 @@ module SendGrid
9
11
  @ganalytics = nil
10
12
  end
11
13
 
12
- def click_tracking=(click_tracking)
13
- @click_tracking = click_tracking
14
- end
15
-
16
14
  def click_tracking
17
15
  @click_tracking.nil? ? nil : @click_tracking.to_json
18
16
  end
19
17
 
20
- def open_tracking=(open_tracking)
21
- @open_tracking = open_tracking
22
- end
23
-
24
18
  def open_tracking
25
19
  @open_tracking.nil? ? nil : @open_tracking.to_json
26
20
  end
27
21
 
28
- def subscription_tracking=(subscription_tracking)
29
- @subscription_tracking = subscription_tracking
30
- end
31
-
32
22
  def subscription_tracking
33
23
  @subscription_tracking.nil? ? nil : @subscription_tracking.to_json
34
24
  end
35
25
 
36
- def ganalytics=(ganalytics)
37
- @ganalytics = ganalytics
38
- end
39
-
40
26
  def ganalytics
41
27
  @ganalytics.nil? ? nil : @ganalytics.to_json
42
28
  end
43
29
 
44
30
  def to_json(*)
45
31
  {
46
- 'click_tracking' => self.click_tracking,
47
- 'open_tracking' => self.open_tracking,
48
- 'subscription_tracking' => self.subscription_tracking,
49
- 'ganalytics' => self.ganalytics
32
+ 'click_tracking' => click_tracking,
33
+ 'open_tracking' => open_tracking,
34
+ 'subscription_tracking' => subscription_tracking,
35
+ 'ganalytics' => ganalytics
50
36
  }.delete_if { |_, value| value.to_s.strip == '' }
51
37
  end
52
38
  end
@@ -3,8 +3,8 @@ require 'yaml'
3
3
 
4
4
  module SendGrid
5
5
  class Scope
6
- SCOPES = YAML.load_file(File.dirname(__FILE__) + '/scopes.yml').freeze
7
-
6
+ SCOPES = YAML.load_file("#{File.dirname(__FILE__)}/scopes.yml").freeze
7
+
8
8
  class << self
9
9
  def admin_permissions
10
10
  SCOPES.values.map(&:values).flatten
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Quick Start
4
4
 
5
- Run the [example](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples/helpers/settings) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
5
+ Run the [example](../../../../examples/helpers/settings) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
6
6
 
7
7
  ```bash
8
8
  ruby examples/helpers/settings/example.rb
@@ -10,5 +10,5 @@ ruby examples/helpers/settings/example.rb
10
10
 
11
11
  ## Usage
12
12
 
13
- - See the [example](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples/helpers/settings) for a complete working example.
13
+ - See the [example](../../../../examples/helpers/settings) for a complete working example.
14
14
  - [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Settings/index.html)
@@ -8,7 +8,7 @@ module SendGrid
8
8
  attr_accessor :sendgrid_client
9
9
 
10
10
  SETTING_TYPES = [SendGrid::MailSettingsDto, SendGrid::TrackingSettingsDto,
11
- SendGrid::PartnerSettingsDto, SendGrid::UserSettingsDto]
11
+ SendGrid::PartnerSettingsDto, SendGrid::UserSettingsDto].freeze
12
12
 
13
13
  def initialize(sendgrid_client:)
14
14
  @sendgrid_client = sendgrid_client
@@ -1,9 +1,9 @@
1
1
  module SendGrid
2
2
  class TrackingSettingsDto
3
3
  attr_reader :open, :click, :google_analytics, :subscription
4
- alias :click_tracking :click
5
- alias :open_tracking :open
6
- alias :subscription_tracking :subscription
4
+ alias click_tracking click
5
+ alias open_tracking open
6
+ alias subscription_tracking subscription
7
7
 
8
8
  def self.fetch(sendgrid_client:, name:, query_params:)
9
9
  name = scrub_alias_names(name.to_s)
@@ -15,8 +15,6 @@ module SendGrid
15
15
  sendgrid_client.tracking_settings.public_send(name).patch(request_body: request_body)
16
16
  end
17
17
 
18
- private
19
-
20
18
  def self.scrub_alias_names(name)
21
19
  name.gsub(/_tracking/, '')
22
20
  end
@@ -1,14 +1,12 @@
1
- require 'json'
2
-
3
1
  module SendGrid
4
2
  class Metrics
5
3
  attr_reader :blocks, :bounce_drops,
6
- :bounces, :clicks, :deferred, :delivered,
7
- :invalid_emails, :opens, :processed, :requests,
8
- :spam_report_drops, :spam_reports, :unique_clicks,
9
- :unique_opens, :unsubscribe_drops, :unsubscribes
4
+ :bounces, :clicks, :deferred, :delivered,
5
+ :invalid_emails, :opens, :processed, :requests,
6
+ :spam_report_drops, :spam_reports, :unique_clicks,
7
+ :unique_opens, :unsubscribe_drops, :unsubscribes
10
8
 
11
- def initialize(args={})
9
+ def initialize(args = {})
12
10
  @date = args['date']
13
11
  @blocks = args['blocks']
14
12
  @bounce_drops = args['bounce_drops']
@@ -1,5 +1,3 @@
1
- require 'json'
2
-
3
1
  module SendGrid
4
2
  class StatsResponse
5
3
  def initialize(args)
@@ -0,0 +1,21 @@
1
+ # Quickly and easily access the Twilio SendGrid API.
2
+ module SendGrid
3
+ class API < BaseInterface
4
+ # * *Args* :
5
+ # - +api_key+ -> your Twilio SendGrid API key
6
+ # - +host+ -> the base URL for the API
7
+ # - +request_headers+ -> any headers that you want to be globally applied
8
+ # - +version+ -> the version of the API you wish to access,
9
+ # currently only "v3" is supported
10
+ # - +impersonate_subuser+ -> the subuser to impersonate, will be passed
11
+ # in the "On-Behalf-Of" header
12
+ # - +http_options+ -> http options that you want to be globally applied to each request
13
+ #
14
+ def initialize(api_key:, host: nil, request_headers: nil, version: nil, impersonate_subuser: nil, http_options: {})
15
+ auth = "Bearer #{api_key}"
16
+ host ||= 'https://api.sendgrid.com'
17
+
18
+ super(auth: auth, host: host, request_headers: request_headers, version: version, impersonate_subuser: impersonate_subuser, http_options: http_options)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Quickly and easily access the Twilio Email API.
2
+ module TwilioEmail
3
+ class API < BaseInterface
4
+ # * *Args* :
5
+ # - +username+ -> your Twilio Email API key SID or Account SID
6
+ # - +password+ -> your Twilio Email API key secret or Account Auth Token
7
+ # - +host+ -> the base URL for the API
8
+ # - +request_headers+ -> any headers that you want to be globally applied
9
+ # - +version+ -> the version of the API you wish to access,
10
+ # currently only "v3" is supported
11
+ # - +impersonate_subuser+ -> the subuser to impersonate, will be passed
12
+ # in the "On-Behalf-Of" header
13
+ #
14
+ def initialize(username:, password:, host: nil, request_headers: nil, version: nil, impersonate_subuser: nil)
15
+ auth = "Basic #{Base64.strict_encode64("#{username}:#{password}")}"
16
+ host ||= 'https://email.twilio.com'
17
+
18
+ super(auth: auth, host: host, request_headers: request_headers, version: version, impersonate_subuser: impersonate_subuser)
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '6.0.0'
2
+ VERSION = '6.4.0'.freeze
3
3
  end
data/mail_helper_v3.md CHANGED
@@ -2,11 +2,11 @@ Hello!
2
2
 
3
3
  It is now time to implement the final piece of our v2 to v3 migration. Before we dig into writing the code, we would love to get feedback on the following proposed interfaces.
4
4
 
5
- We are starting with the use cases below for the first iteration. (we have completed this work on [our C# library](https://github.com/sendgrid/sendgrid-csharp/blob/master/USE_CASES.md), you can check that out for a sneak peek of where we are heading).
5
+ We are starting with the use cases below for the first iteration. (we have completed this work on [our C# library](https://github.com/sendgrid/sendgrid-csharp/blob/HEAD/USE_CASES.md), you can check that out for a sneak peek of where we are heading).
6
6
 
7
7
  # Send a Single Email to a Single Recipient
8
8
 
9
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
9
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
10
10
 
11
11
  ```ruby
12
12
  require 'sendgrid-ruby'
@@ -37,7 +37,7 @@ puts response.headers
37
37
 
38
38
  # Send a Single Email to Multiple Recipients
39
39
 
40
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
40
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
41
41
 
42
42
  ```ruby
43
43
  require 'sendgrid-ruby'
@@ -72,7 +72,7 @@ puts response.headers
72
72
 
73
73
  # Send Multiple Emails to Multiple Recipients
74
74
 
75
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
75
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
76
76
 
77
77
  ```ruby
78
78
  require 'sendgrid-ruby'
@@ -119,7 +119,7 @@ puts response.headers
119
119
 
120
120
  # Kitchen Sink - an example with all settings used
121
121
 
122
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
122
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
123
123
 
124
124
  ```ruby
125
125
  client = SendGrid::Client.new(api_key: ENV['SENDGRID_API_KEY'])
@@ -233,7 +233,7 @@ msg.set_send_at(1461775052, 1)
233
233
 
234
234
  msg.set_subject('this subject overrides the Global Subject on the second Personalization', 1)
235
235
 
236
- # The values below this comment are global to entire message
236
+ # The values below this comment are global to the entire message
237
237
 
238
238
  msg.set_from(SendGrid::Email.new('test0@example.com', 'Example User0'))
239
239
 
@@ -263,7 +263,7 @@ attachments = [
263
263
  'base64 encoded content',
264
264
  'image/png',
265
265
  'inline',
266
- 'Banner 2'),
266
+ 'Banner 2'),
267
267
  ]
268
268
  msg.add_attachments(attachments)
269
269
 
@@ -279,7 +279,7 @@ msg.set_global_headers(global_headers)
279
279
  msg.add_section('%section1%', 'Substitution for Section 1 Tag')
280
280
  sections = [
281
281
  '%section2%' => 'Substitution for Section 2 Tag',
282
- '%section3%' => 'Substitution for Section 3 Tag'
282
+ '%section3%' => 'Substitution for Section 3 Tag'
283
283
  ]
284
284
  msg.add_sections(sections)
285
285
 
@@ -295,7 +295,7 @@ puts response.headers
295
295
 
296
296
  # Attachments
297
297
 
298
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
298
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
299
299
 
300
300
  ```ruby
301
301
  client = SendGrid::Client.new(api_key: ENV['SENDGRID_API_KEY'])
@@ -326,9 +326,9 @@ puts response.headers
326
326
 
327
327
  # Transactional Templates
328
328
 
329
- The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
329
+ The following code assumes you are storing the API key in an [environment variable (recommended)](TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
330
330
 
331
- For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing.
331
+ For this example, we assume you have created a [legacy transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html) in the UI or via the API. Following is the template content we used for testing.
332
332
 
333
333
  Template ID (replace with your own):
334
334
 
@@ -347,7 +347,7 @@ Template Body:
347
347
  ```html
348
348
  <html>
349
349
  <head>
350
- <title></title>
350
+ <title></title>
351
351
  </head>
352
352
  <body>
353
353
  Hello -name-,
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'sendgrid/version'
5
4
 
@@ -7,24 +6,26 @@ Gem::Specification.new do |spec|
7
6
  spec.name = 'sendgrid-ruby'
8
7
  spec.version = SendGrid::VERSION
9
8
  spec.authors = ['Elmer Thomas', 'Robin Johnson', 'Eddie Zaneski']
10
- spec.email = 'dx@sendgrid.com'
9
+ spec.email = 'help@twilio.com'
11
10
  spec.summary = 'Official Twilio SendGrid Gem'
12
11
  spec.description = 'Official Twilio SendGrid Gem to Interact with Twilio SendGrids API in native Ruby'
13
12
  spec.homepage = 'http://github.com/sendgrid/sendgrid-ruby'
14
13
 
15
14
  spec.required_ruby_version = '>= 2.2'
16
15
 
17
- spec.license = 'MIT'
16
+ spec.license = 'MIT'
18
17
  spec.files = `git ls-files -z`.split("\x0")
19
18
  spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
20
19
  spec.test_files = spec.files.grep(/^(test|spec|features)/)
21
20
  spec.require_paths = ['lib']
22
- spec.add_dependency 'ruby_http_client', '~> 3.3.0'
23
- spec.add_development_dependency 'sinatra', '>= 1.4.7', '< 3'
24
- spec.add_development_dependency 'rake', '~> 0'
25
- spec.add_development_dependency 'rspec'
26
- spec.add_development_dependency 'pry'
21
+ spec.add_dependency 'ruby_http_client', '~> 3.4'
27
22
  spec.add_development_dependency 'faker'
28
- spec.add_development_dependency 'rubocop'
29
23
  spec.add_development_dependency 'minitest', '~> 5.9'
24
+ spec.add_development_dependency 'pry'
25
+ spec.add_development_dependency 'rack'
26
+ spec.add_development_dependency 'rake', '~> 13.0'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'rubocop'
29
+ spec.add_development_dependency 'simplecov', '~> 0.18.5'
30
+ spec.add_development_dependency 'sinatra', '>= 1.4.7', '< 3'
30
31
  end