From ed2c47011d9743dd09d89d04f5c612fefd304673 Mon Sep 17 00:00:00 2001 From: Dipil Singh Saud Date: Fri, 5 Oct 2018 14:45:52 +0545 Subject: [PATCH] Adds rubocop check to CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes changes by rubocop —-auto-correct and —-auto-gen-config. --- Makefile | 1 + Rakefile | 2 +- examples/accesssettings/accesssettings.rb | 4 +- examples/alerts/alerts.rb | 6 +- examples/apikeys/apikeys.rb | 8 +- examples/asm/asm.rb | 22 +- examples/campaigns/campaigns.rb | 18 +- examples/clients/clients.rb | 2 +- examples/contactdb/contactdb.rb | 36 +-- examples/helpers/mail/example.rb | 10 +- examples/helpers/settings/example.rb | 2 +- examples/helpers/stats/example.rb | 4 +- examples/ips/ips.rb | 18 +- examples/mail/mail.rb | 7 +- examples/scopes/scopes.rb | 2 - .../senderauthentication.rb | 32 +-- examples/senders/senders.rb | 8 +- examples/subusers/subusers.rb | 16 +- examples/suppression/suppression.rb | 23 +- examples/templates/templates.rb | 24 +- examples/user/user.rb | 12 +- lib/sendgrid/base_interface.rb | 2 +- lib/sendgrid/helpers/mail/header.rb | 2 +- lib/sendgrid/helpers/mail/mail.rb | 1 - lib/sendgrid/helpers/mail/personalization.rb | 1 - lib/sendgrid/helpers/mail/substitution.rb | 2 +- sendgrid-ruby.gemspec | 13 +- .../helpers/settings/settings_spec.rb | 2 +- .../helpers/stats/email_stats_spec.rb | 42 +-- spec/sendgrid/helpers/stats/metrics_spec.rb | 34 +-- .../helpers/stats/stats_response_spec.rb | 42 +-- test/sendgrid/helpers/mail/test_email.rb | 16 +- test/sendgrid/helpers/mail/test_mail.rb | 174 ++++++------ .../helpers/mail/test_personalizations.rb | 70 ++--- test/sendgrid/test_sendgrid-ruby.rb | 264 +++++++++--------- 35 files changed, 455 insertions(+), 467 deletions(-) diff --git a/Makefile b/Makefile index c35f356a..faee8997 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ install: test: bundle exec rake + rubocop test-integ: test diff --git a/Rakefile b/Rakefile index ad77bbfa..f94bea21 100644 --- a/Rakefile +++ b/Rakefile @@ -10,5 +10,5 @@ end RSpec::Core::RakeTask.new(:spec) -desc "Run tests" +desc 'Run tests' task default: %i[spec test] diff --git a/examples/accesssettings/accesssettings.rb b/examples/accesssettings/accesssettings.rb index caab8a17..90796bd6 100644 --- a/examples/accesssettings/accesssettings.rb +++ b/examples/accesssettings/accesssettings.rb @@ -63,7 +63,7 @@ # Retrieve a specific whitelisted IP # # GET /access_settings/whitelist/{rule_id} # -rule_id = "test_url_param" +rule_id = 'test_url_param' response = sg.client.access_settings.whitelist._(rule_id).get puts response.status_code puts response.body @@ -73,7 +73,7 @@ # Remove a specific IP from the whitelist # # DELETE /access_settings/whitelist/{rule_id} # -rule_id = "test_url_param" +rule_id = 'test_url_param' response = sg.client.access_settings.whitelist._(rule_id).delete puts response.status_code puts response.body diff --git a/examples/alerts/alerts.rb b/examples/alerts/alerts.rb index 81128508..365b4873 100644 --- a/examples/alerts/alerts.rb +++ b/examples/alerts/alerts.rb @@ -32,7 +32,7 @@ data = JSON.parse('{ "email_to": "example@example.com" }') -alert_id = "test_url_param" +alert_id = 'test_url_param' response = sg.client.alerts._(alert_id).patch(request_body: data) puts response.status_code puts response.body @@ -42,7 +42,7 @@ # Retrieve a specific alert # # GET /alerts/{alert_id} # -alert_id = "test_url_param" +alert_id = 'test_url_param' response = sg.client.alerts._(alert_id).get puts response.status_code puts response.body @@ -52,7 +52,7 @@ # Delete an alert # # DELETE /alerts/{alert_id} # -alert_id = "test_url_param" +alert_id = 'test_url_param' response = sg.client.alerts._(alert_id).delete puts response.status_code puts response.body diff --git a/examples/apikeys/apikeys.rb b/examples/apikeys/apikeys.rb index 575207c5..a709ec97 100644 --- a/examples/apikeys/apikeys.rb +++ b/examples/apikeys/apikeys.rb @@ -41,7 +41,7 @@ "user.profile.update" ] }') -api_key_id = "test_url_param" +api_key_id = 'test_url_param' response = sg.client.api_keys._(api_key_id).put(request_body: data) puts response.status_code puts response.body @@ -54,7 +54,7 @@ data = JSON.parse('{ "name": "A New Hope" }') -api_key_id = "test_url_param" +api_key_id = 'test_url_param' response = sg.client.api_keys._(api_key_id).patch(request_body: data) puts response.status_code puts response.body @@ -64,7 +64,7 @@ # Retrieve an existing API Key # # GET /api_keys/{api_key_id} # -api_key_id = "test_url_param" +api_key_id = 'test_url_param' response = sg.client.api_keys._(api_key_id).get puts response.status_code puts response.body @@ -74,7 +74,7 @@ # Delete API keys # # DELETE /api_keys/{api_key_id} # -api_key_id = "test_url_param" +api_key_id = 'test_url_param' response = sg.client.api_keys._(api_key_id).delete puts response.status_code puts response.body diff --git a/examples/asm/asm.rb b/examples/asm/asm.rb index 42023f99..dc4a5be1 100644 --- a/examples/asm/asm.rb +++ b/examples/asm/asm.rb @@ -35,7 +35,7 @@ "id": 103, "name": "Item Suggestions" }') -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).patch(request_body: data) puts response.status_code puts response.body @@ -45,7 +45,7 @@ # Get information on a single suppression group. # # GET /asm/groups/{group_id} # -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).get puts response.status_code puts response.body @@ -55,7 +55,7 @@ # Delete a suppression group. # # DELETE /asm/groups/{group_id} # -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).delete puts response.status_code puts response.body @@ -71,7 +71,7 @@ "test2@example.com" ] }') -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).suppressions.post(request_body: data) puts response.status_code puts response.body @@ -81,7 +81,7 @@ # Retrieve all suppressions for a suppression group # # GET /asm/groups/{group_id}/suppressions # -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).suppressions.get puts response.status_code puts response.body @@ -98,7 +98,7 @@ "doesnotexists@example.com" ] }') -group_id = "test_url_param" +group_id = 'test_url_param' response = sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data) puts response.status_code puts response.body @@ -108,8 +108,8 @@ # Delete a suppression from a suppression group # # DELETE /asm/groups/{group_id}/suppressions/{email} # -group_id = "test_url_param" -email = "test_url_param" +group_id = 'test_url_param' +email = 'test_url_param' response = sg.client.asm.groups._(group_id).suppressions._(email).delete puts response.status_code puts response.body @@ -143,7 +143,7 @@ # Retrieve a Global Suppression # # GET /asm/suppressions/global/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.asm.suppressions.global._(email).get puts response.status_code puts response.body @@ -153,7 +153,7 @@ # Delete a Global Suppression # # DELETE /asm/suppressions/global/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.asm.suppressions.global._(email).delete puts response.status_code puts response.body @@ -163,7 +163,7 @@ # Retrieve all suppression groups for an email address # # GET /asm/suppressions/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.asm.suppressions._(email).get puts response.status_code puts response.body diff --git a/examples/campaigns/campaigns.rb b/examples/campaigns/campaigns.rb index a4c532fd..c0cba430 100644 --- a/examples/campaigns/campaigns.rb +++ b/examples/campaigns/campaigns.rb @@ -54,7 +54,7 @@ "subject": "New Products for Summer!", "title": "May Newsletter" }') -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).patch(request_body: data) puts response.status_code puts response.body @@ -64,7 +64,7 @@ # Retrieve a single campaign # # GET /campaigns/{campaign_id} # -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).get puts response.status_code puts response.body @@ -74,7 +74,7 @@ # Delete a Campaign # # DELETE /campaigns/{campaign_id} # -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).delete puts response.status_code puts response.body @@ -87,7 +87,7 @@ data = JSON.parse('{ "send_at": 1489451436 }') -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.patch(request_body: data) puts response.status_code puts response.body @@ -100,7 +100,7 @@ data = JSON.parse('{ "send_at": 1489771528 }') -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.post(request_body: data) puts response.status_code puts response.body @@ -110,7 +110,7 @@ # View Scheduled Time of a Campaign # # GET /campaigns/{campaign_id}/schedules # -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.get puts response.status_code puts response.body @@ -120,7 +120,7 @@ # Unschedule a Scheduled Campaign # # DELETE /campaigns/{campaign_id}/schedules # -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.delete puts response.status_code puts response.body @@ -130,7 +130,7 @@ # Send a Campaign # # POST /campaigns/{campaign_id}/schedules/now # -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.now.post puts response.status_code puts response.body @@ -143,7 +143,7 @@ data = JSON.parse('{ "to": "your.email@example.com" }') -campaign_id = "test_url_param" +campaign_id = 'test_url_param' response = sg.client.campaigns._(campaign_id).schedules.test.post(request_body: data) puts response.status_code puts response.body diff --git a/examples/clients/clients.rb b/examples/clients/clients.rb index 62990f20..23f261a1 100644 --- a/examples/clients/clients.rb +++ b/examples/clients/clients.rb @@ -17,7 +17,7 @@ # GET /clients/{client_type}/stats # params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}') -client_type = "test_url_param" +client_type = 'test_url_param' response = sg.client.clients._(client_type).stats.get(query_params: params) puts response.status_code puts response.body diff --git a/examples/contactdb/contactdb.rb b/examples/contactdb/contactdb.rb index 0fdc69a2..04ce3e53 100644 --- a/examples/contactdb/contactdb.rb +++ b/examples/contactdb/contactdb.rb @@ -28,7 +28,7 @@ # Retrieve a Custom Field # # GET /contactdb/custom_fields/{custom_field_id} # -custom_field_id = "test_url_param" +custom_field_id = 'test_url_param' response = sg.client.contactdb.custom_fields._(custom_field_id).get puts response.status_code puts response.body @@ -38,7 +38,7 @@ # Delete a Custom Field # # DELETE /contactdb/custom_fields/{custom_field_id} # -custom_field_id = "test_url_param" +custom_field_id = 'test_url_param' response = sg.client.contactdb.custom_fields._(custom_field_id).delete puts response.status_code puts response.body @@ -88,7 +88,7 @@ "name": "newlistname" }') params = JSON.parse('{"list_id": 1}') -list_id = "test_url_param" +list_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params) puts response.status_code puts response.body @@ -99,7 +99,7 @@ # GET /contactdb/lists/{list_id} # params = JSON.parse('{"list_id": 1}') -list_id = "test_url_param" +list_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).get(query_params: params) puts response.status_code puts response.body @@ -110,7 +110,7 @@ # DELETE /contactdb/lists/{list_id} # params = JSON.parse('{"delete_contacts": "true"}') -list_id = "test_url_param" +list_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).delete(query_params: params) puts response.status_code puts response.body @@ -124,7 +124,7 @@ "recipient_id1", "recipient_id2" ]') -list_id = "test_url_param" +list_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).recipients.post(request_body: data) puts response.status_code puts response.body @@ -135,7 +135,7 @@ # GET /contactdb/lists/{list_id}/recipients # params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}') -list_id = "test_url_param" +list_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).recipients.get(query_params: params) puts response.status_code puts response.body @@ -145,8 +145,8 @@ # Add a Single Recipient to a List # # POST /contactdb/lists/{list_id}/recipients/{recipient_id} # -list_id = "test_url_param" -recipient_id = "test_url_param" +list_id = 'test_url_param' +recipient_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post puts response.status_code puts response.body @@ -157,8 +157,8 @@ # DELETE /contactdb/lists/{list_id}/recipients/{recipient_id} # params = JSON.parse('{"recipient_id": 1, "list_id": 1}') -list_id = "test_url_param" -recipient_id = "test_url_param" +list_id = 'test_url_param' +recipient_id = 'test_url_param' response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params) puts response.status_code puts response.body @@ -258,7 +258,7 @@ # Retrieve a single recipient # # GET /contactdb/recipients/{recipient_id} # -recipient_id = "test_url_param" +recipient_id = 'test_url_param' response = sg.client.contactdb.recipients._(recipient_id).get puts response.status_code puts response.body @@ -268,7 +268,7 @@ # Delete a Recipient # # DELETE /contactdb/recipients/{recipient_id} # -recipient_id = "test_url_param" +recipient_id = 'test_url_param' response = sg.client.contactdb.recipients._(recipient_id).delete puts response.status_code puts response.body @@ -278,7 +278,7 @@ # Retrieve the lists that a recipient is on # # GET /contactdb/recipients/{recipient_id}/lists # -recipient_id = "test_url_param" +recipient_id = 'test_url_param' response = sg.client.contactdb.recipients._(recipient_id).lists.get puts response.status_code puts response.body @@ -352,7 +352,7 @@ "name": "The Millers" }') params = JSON.parse('{"segment_id": "test_string"}') -segment_id = "test_url_param" +segment_id = 'test_url_param' response = sg.client.contactdb.segments._(segment_id).patch(request_body: data, query_params: params) puts response.status_code puts response.body @@ -363,7 +363,7 @@ # GET /contactdb/segments/{segment_id} # params = JSON.parse('{"segment_id": 1}') -segment_id = "test_url_param" +segment_id = 'test_url_param' response = sg.client.contactdb.segments._(segment_id).get(query_params: params) puts response.status_code puts response.body @@ -374,7 +374,7 @@ # DELETE /contactdb/segments/{segment_id} # params = JSON.parse('{"delete_contacts": "true"}') -segment_id = "test_url_param" +segment_id = 'test_url_param' response = sg.client.contactdb.segments._(segment_id).delete(query_params: params) puts response.status_code puts response.body @@ -385,7 +385,7 @@ # GET /contactdb/segments/{segment_id}/recipients # params = JSON.parse('{"page": 1, "page_size": 1}') -segment_id = "test_url_param" +segment_id = 'test_url_param' response = sg.client.contactdb.segments._(segment_id).recipients.get(query_params: params) puts response.status_code puts response.body diff --git a/examples/helpers/mail/example.rb b/examples/helpers/mail/example.rb index 41cf546e..b248a588 100644 --- a/examples/helpers/mail/example.rb +++ b/examples/helpers/mail/example.rb @@ -36,7 +36,7 @@ def kitchen_sink personalization.add_substitution(Substitution.new(key: '%city%', value: 'Denver')) personalization.add_custom_arg(CustomArg.new(key: 'user_id', value: '343')) personalization.add_custom_arg(CustomArg.new(key: 'type', value: 'marketing')) - personalization.send_at = 1443636843 + personalization.send_at = 1_443_636_843 mail.add_personalization(personalization) personalization2 = Personalization.new @@ -53,7 +53,7 @@ def kitchen_sink personalization2.add_substitution(Substitution.new(key: '%city%', value: 'Denver')) personalization2.add_custom_arg(CustomArg.new(key: 'user_id', value: '343')) personalization2.add_custom_arg(CustomArg.new(key: 'type', value: 'marketing')) - personalization2.send_at = 1443636843 + personalization2.send_at = 1_443_636_843 mail.add_personalization(personalization2) mail.add_content(Content.new(type: 'text/plain', value: 'some text here')) @@ -89,7 +89,7 @@ def kitchen_sink mail.add_custom_arg(CustomArg.new(key: 'campaign', value: 'welcome')) mail.add_custom_arg(CustomArg.new(key: 'weekday', value: 'morning')) - mail.send_at = 1443636842 + mail.send_at = 1_443_636_842 # This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) to work # mail.batch_id = 'sendgrid_batch_id' @@ -132,8 +132,8 @@ def dynamic_template_data_hello_world personalization = Personalization.new personalization.add_to(Email.new(email: 'test1@example.com', name: 'Example User')) personalization.add_dynamic_template_data( - "variable" => [ - { "foo" => "bar" }, { "foo" => "baz" } + 'variable' => [ + { 'foo' => 'bar' }, { 'foo' => 'baz' } ] ) mail.add_personalization(personalization) diff --git a/examples/helpers/settings/example.rb b/examples/helpers/settings/example.rb index 3cdb8494..0c2455e0 100644 --- a/examples/helpers/settings/example.rb +++ b/examples/helpers/settings/example.rb @@ -11,7 +11,7 @@ puts response.headers # Turn on bcc settings -response = settings.update_bcc(enabled: true, email: "email@example.com") +response = settings.update_bcc(enabled: true, email: 'email@example.com') puts response.status_code puts response.body puts response.headers diff --git a/examples/helpers/stats/example.rb b/examples/helpers/stats/example.rb index d50acdbf..ae454185 100644 --- a/examples/helpers/stats/example.rb +++ b/examples/helpers/stats/example.rb @@ -7,7 +7,7 @@ stats = SendGrid::EmailStats.new(sendgrid_client: sg_client) # Fetch stats by day, between 2 dates -from = Date.new(2017, 10, 01) +from = Date.new(2017, 10, 0o1) to = Date.new(2017, 10, 12) email_stats = stats.by_day(from, to) @@ -25,7 +25,7 @@ end # Fetch stats by week, between 2 dates for a category -from = Date.new(2017, 10, 01) +from = Date.new(2017, 10, 0o1) to = Date.new(2017, 10, 12) category = 'abcd' diff --git a/examples/ips/ips.rb b/examples/ips/ips.rb index eb341877..f329b3e6 100644 --- a/examples/ips/ips.rb +++ b/examples/ips/ips.rb @@ -62,7 +62,7 @@ data = JSON.parse('{ "name": "new_pool_name" }') -pool_name = "test_url_param" +pool_name = 'test_url_param' response = sg.client.ips.pools._(pool_name).put(request_body: data) puts response.status_code puts response.body @@ -72,7 +72,7 @@ # Retrieve all IPs in a specified pool. # # GET /ips/pools/{pool_name} # -pool_name = "test_url_param" +pool_name = 'test_url_param' response = sg.client.ips.pools._(pool_name).get puts response.status_code puts response.body @@ -82,7 +82,7 @@ # Delete an IP pool. # # DELETE /ips/pools/{pool_name} # -pool_name = "test_url_param" +pool_name = 'test_url_param' response = sg.client.ips.pools._(pool_name).delete puts response.status_code puts response.body @@ -95,7 +95,7 @@ data = JSON.parse('{ "ip": "0.0.0.0" }') -pool_name = "test_url_param" +pool_name = 'test_url_param' response = sg.client.ips.pools._(pool_name).ips.post(request_body: data) puts response.status_code puts response.body @@ -105,8 +105,8 @@ # Remove an IP address from a pool. # # DELETE /ips/pools/{pool_name}/ips/{ip} # -pool_name = "test_url_param" -ip = "test_url_param" +pool_name = 'test_url_param' +ip = 'test_url_param' response = sg.client.ips.pools._(pool_name).ips._(ip).delete puts response.status_code puts response.body @@ -137,7 +137,7 @@ # Retrieve warmup status for a specific IP address # # GET /ips/warmup/{ip_address} # -ip_address = "test_url_param" +ip_address = 'test_url_param' response = sg.client.ips.warmup._(ip_address).get puts response.status_code puts response.body @@ -147,7 +147,7 @@ # Remove an IP from warmup # # DELETE /ips/warmup/{ip_address} # -ip_address = "test_url_param" +ip_address = 'test_url_param' response = sg.client.ips.warmup._(ip_address).delete puts response.status_code puts response.body @@ -157,7 +157,7 @@ # Retrieve all IP pools an IP address belongs to # # GET /ips/{ip_address} # -ip_address = "test_url_param" +ip_address = 'test_url_param' response = sg.client.ips._(ip_address).get puts response.status_code puts response.body diff --git a/examples/mail/mail.rb b/examples/mail/mail.rb index fe8b8767..ad419c22 100644 --- a/examples/mail/mail.rb +++ b/examples/mail/mail.rb @@ -1,9 +1,7 @@ require 'sendgrid-ruby' - sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']) - ################################################## # Create a batch ID # # POST /mail/batch # @@ -17,7 +15,7 @@ # Validate batch ID # # GET /mail/batch/{batch_id} # -batch_id = "test_url_param" +batch_id = 'test_url_param' response = sg.client.mail.batch._(batch_id).get puts response.status_code puts response.body @@ -166,8 +164,7 @@ } } }') -response = sg.client.mail._("send").post(request_body: data) +response = sg.client.mail._('send').post(request_body: data) puts response.status_code puts response.body puts response.headers - diff --git a/examples/scopes/scopes.rb b/examples/scopes/scopes.rb index 75447698..caddb224 100644 --- a/examples/scopes/scopes.rb +++ b/examples/scopes/scopes.rb @@ -1,8 +1,6 @@ require_relative '../../lib/sendgrid-ruby.rb' - sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']) - ################################################## # Retrieve a list of scopes for which this user has access. # # GET /scopes # diff --git a/examples/senderauthentication/senderauthentication.rb b/examples/senderauthentication/senderauthentication.rb index 17d72431..5a9b2ab6 100644 --- a/examples/senderauthentication/senderauthentication.rb +++ b/examples/senderauthentication/senderauthentication.rb @@ -68,7 +68,7 @@ "custom_spf": true, "default": false }') -domain_id = "test_url_param" +domain_id = 'test_url_param' response = sg.client.whitelabel.domains._(domain_id).patch(request_body: data) puts response.status_code puts response.body @@ -78,7 +78,7 @@ # Retrieve a domain authentication. # # GET /whitelabel/domains/{domain_id} # -domain_id = "test_url_param" +domain_id = 'test_url_param' response = sg.client.whitelabel.domains._(domain_id).get puts response.status_code puts response.body @@ -88,7 +88,7 @@ # Delete a domain authentication. # # DELETE /whitelabel/domains/{domain_id} # -domain_id = "test_url_param" +domain_id = 'test_url_param' response = sg.client.whitelabel.domains._(domain_id).delete puts response.status_code puts response.body @@ -101,7 +101,7 @@ data = JSON.parse('{ "username": "jane@example.com" }') -domain_id = "test_url_param" +domain_id = 'test_url_param' response = sg.client.whitelabel.domains._(domain_id).subuser.post(request_body: data) puts response.status_code puts response.body @@ -114,7 +114,7 @@ data = JSON.parse('{ "ip": "192.168.0.1" }') -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.domains._(id).ips.post(request_body: data) puts response.status_code puts response.body @@ -124,8 +124,8 @@ # Remove an IP from a domain authentication. # # DELETE /whitelabel/domains/{id}/ips/{ip} # -id = "test_url_param" -ip = "test_url_param" +id = 'test_url_param' +ip = 'test_url_param' response = sg.client.whitelabel.domains._(id).ips._(ip).delete puts response.status_code puts response.body @@ -135,7 +135,7 @@ # Validate a domain authentication. # # POST /whitelabel/domains/{id}/validate # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.domains._(id).validate.post puts response.status_code puts response.body @@ -169,7 +169,7 @@ # Retrieve a reverse DNS record # # GET /whitelabel/ips/{id} # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.ips._(id).get puts response.status_code puts response.body @@ -179,7 +179,7 @@ # Delete a reverse DNS record # # DELETE /whitelabel/ips/{id} # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.ips._(id).delete puts response.status_code puts response.body @@ -189,7 +189,7 @@ # Validate a reverse DNS record # # POST /whitelabel/ips/{id}/validate # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.ips._(id).validate.post puts response.status_code puts response.body @@ -257,7 +257,7 @@ data = JSON.parse('{ "default": true }') -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.links._(id).patch(request_body: data) puts response.status_code puts response.body @@ -267,7 +267,7 @@ # Retrieve a Link Branding # # GET /whitelabel/links/{id} # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.links._(id).get puts response.status_code puts response.body @@ -277,7 +277,7 @@ # Delete a Link Branding # # DELETE /whitelabel/links/{id} # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.links._(id).delete puts response.status_code puts response.body @@ -287,7 +287,7 @@ # Validate a Link Branding # # POST /whitelabel/links/{id}/validate # -id = "test_url_param" +id = 'test_url_param' response = sg.client.whitelabel.links._(id).validate.post puts response.status_code puts response.body @@ -300,7 +300,7 @@ data = JSON.parse('{ "username": "jane@example.com" }') -link_id = "test_url_param" +link_id = 'test_url_param' response = sg.client.whitelabel.links._(link_id).subuser.post(request_body: data) puts response.status_code puts response.body diff --git a/examples/senders/senders.rb b/examples/senders/senders.rb index 8928243b..e9b2239f 100644 --- a/examples/senders/senders.rb +++ b/examples/senders/senders.rb @@ -58,7 +58,7 @@ "state": "Colorado", "zip": "80202" }') -sender_id = "test_url_param" +sender_id = 'test_url_param' response = sg.client.senders._(sender_id).patch(request_body: data) puts response.status_code puts response.body @@ -68,7 +68,7 @@ # View a Sender Identity # # GET /senders/{sender_id} # -sender_id = "test_url_param" +sender_id = 'test_url_param' response = sg.client.senders._(sender_id).get puts response.status_code puts response.body @@ -78,7 +78,7 @@ # Delete a Sender Identity # # DELETE /senders/{sender_id} # -sender_id = "test_url_param" +sender_id = 'test_url_param' response = sg.client.senders._(sender_id).delete puts response.status_code puts response.body @@ -88,7 +88,7 @@ # Resend Sender Identity Verification # # POST /senders/{sender_id}/resend_verification # -sender_id = "test_url_param" +sender_id = 'test_url_param' response = sg.client.senders._(sender_id).resend_verification.post puts response.status_code puts response.body diff --git a/examples/subusers/subusers.rb b/examples/subusers/subusers.rb index e56c2abe..0df9d31f 100644 --- a/examples/subusers/subusers.rb +++ b/examples/subusers/subusers.rb @@ -77,7 +77,7 @@ data = JSON.parse('{ "disabled": false }') -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).patch(request_body: data) puts response.status_code puts response.body @@ -87,7 +87,7 @@ # Delete a subuser # # DELETE /subusers/{subuser_name} # -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).delete puts response.status_code puts response.body @@ -100,7 +100,7 @@ data = JSON.parse('[ "127.0.0.1" ]') -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).ips.put(request_body: data) puts response.status_code puts response.body @@ -114,7 +114,7 @@ "email": "example@example.com", "frequency": 500 }') -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).monitor.put(request_body: data) puts response.status_code puts response.body @@ -128,7 +128,7 @@ "email": "example@example.com", "frequency": 50000 }') -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).monitor.post(request_body: data) puts response.status_code puts response.body @@ -138,7 +138,7 @@ # Retrieve monitor settings for a subuser # # GET /subusers/{subuser_name}/monitor # -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).monitor.get puts response.status_code puts response.body @@ -148,7 +148,7 @@ # Delete monitor settings # # DELETE /subusers/{subuser_name}/monitor # -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).monitor.delete puts response.status_code puts response.body @@ -159,7 +159,7 @@ # GET /subusers/{subuser_name}/stats/monthly # params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}') -subuser_name = "test_url_param" +subuser_name = 'test_url_param' response = sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params) puts response.status_code puts response.body diff --git a/examples/suppression/suppression.rb b/examples/suppression/suppression.rb index 27b04ff6..4bb07591 100644 --- a/examples/suppression/suppression.rb +++ b/examples/suppression/suppression.rb @@ -1,9 +1,7 @@ require 'sendgrid-ruby' - sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']) - ################################################## # Retrieve all blocks # # GET /suppression/blocks # @@ -34,7 +32,7 @@ # Retrieve a specific block # # GET /suppression/blocks/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.blocks._(email).get puts response.status_code puts response.body @@ -44,7 +42,7 @@ # Delete a specific block # # DELETE /suppression/blocks/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.blocks._(email).delete puts response.status_code puts response.body @@ -80,7 +78,7 @@ # Retrieve a Bounce # # GET /suppression/bounces/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.bounces._(email).get puts response.status_code puts response.body @@ -91,7 +89,7 @@ # DELETE /suppression/bounces/{email} # params = JSON.parse('{"email_address": "example@example.com"}') -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.bounces._(email).delete(query_params: params) puts response.status_code puts response.body @@ -127,7 +125,7 @@ # Retrieve a specific invalid email # # GET /suppression/invalid_emails/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.invalid_emails._(email).get puts response.status_code puts response.body @@ -137,7 +135,7 @@ # Delete a specific invalid email # # DELETE /suppression/invalid_emails/{email} # -email = "test_url_param" +email = 'test_url_param' response = sg.client.suppression.invalid_emails._(email).delete puts response.status_code puts response.body @@ -147,8 +145,8 @@ # Retrieve a specific spam report # # GET /suppression/spam_report/{email} # -email = "test_url_param" -response = sg.client.suppression.spam_report._(email).get() +email = 'test_url_param' +response = sg.client.suppression.spam_report._(email).get puts response.status_code puts response.body puts response.headers @@ -157,8 +155,8 @@ # Delete a specific spam report # # DELETE /suppression/spam_report/{email} # -email = "test_url_param" -response = sg.client.suppression.spam_reports._(email).delete() +email = 'test_url_param' +response = sg.client.suppression.spam_reports._(email).delete puts response.status_code puts response.body puts response.headers @@ -198,4 +196,3 @@ puts response.status_code puts response.body puts response.headers - diff --git a/examples/templates/templates.rb b/examples/templates/templates.rb index 3c4338a3..49c16ffc 100644 --- a/examples/templates/templates.rb +++ b/examples/templates/templates.rb @@ -30,7 +30,7 @@ data = JSON.parse('{ "name": "new_example_name" }') -template_id = "test_url_param" +template_id = 'test_url_param' response = sg.client.templates._(template_id).patch(request_body: data) puts response.status_code puts response.body @@ -40,7 +40,7 @@ # Retrieve a single transactional template. # # GET /templates/{template_id} # -template_id = "test_url_param" +template_id = 'test_url_param' response = sg.client.templates._(template_id).get puts response.status_code puts response.body @@ -50,7 +50,7 @@ # Delete a template. # # DELETE /templates/{template_id} # -template_id = "test_url_param" +template_id = 'test_url_param' response = sg.client.templates._(template_id).delete puts response.status_code puts response.body @@ -68,7 +68,7 @@ "subject": "<%subject%>", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" }') -template_id = "test_url_param" +template_id = 'test_url_param' response = sg.client.templates._(template_id).versions.post(request_body: data) puts response.status_code puts response.body @@ -85,8 +85,8 @@ "plain_content": "<%body%>", "subject": "<%subject%>" }') -template_id = "test_url_param" -version_id = "test_url_param" +template_id = 'test_url_param' +version_id = 'test_url_param' response = sg.client.templates._(template_id).versions._(version_id).patch(request_body: data) puts response.status_code puts response.body @@ -96,8 +96,8 @@ # Retrieve a specific transactional template version. # # GET /templates/{template_id}/versions/{version_id} # -template_id = "test_url_param" -version_id = "test_url_param" +template_id = 'test_url_param' +version_id = 'test_url_param' response = sg.client.templates._(template_id).versions._(version_id).get puts response.status_code puts response.body @@ -107,8 +107,8 @@ # Delete a transactional template version. # # DELETE /templates/{template_id}/versions/{version_id} # -template_id = "test_url_param" -version_id = "test_url_param" +template_id = 'test_url_param' +version_id = 'test_url_param' response = sg.client.templates._(template_id).versions._(version_id).delete puts response.status_code puts response.body @@ -118,8 +118,8 @@ # Activate a transactional template version. # # POST /templates/{template_id}/versions/{version_id}/activate # -template_id = "test_url_param" -version_id = "test_url_param" +template_id = 'test_url_param' +version_id = 'test_url_param' response = sg.client.templates._(template_id).versions._(version_id).activate.post puts response.status_code puts response.body diff --git a/examples/user/user.rb b/examples/user/user.rb index 8ada0e05..0f8f4f3f 100644 --- a/examples/user/user.rb +++ b/examples/user/user.rb @@ -106,7 +106,7 @@ data = JSON.parse('{ "status": "pause" }') -batch_id = "test_url_param" +batch_id = 'test_url_param' response = sg.client.user.scheduled_sends._(batch_id).patch(request_body: data) puts response.status_code puts response.body @@ -116,7 +116,7 @@ # Retrieve scheduled send # # GET /user/scheduled_sends/{batch_id} # -batch_id = "test_url_param" +batch_id = 'test_url_param' response = sg.client.user.scheduled_sends._(batch_id).get puts response.status_code puts response.body @@ -126,7 +126,7 @@ # Delete a cancellation or pause of a scheduled send # # DELETE /user/scheduled_sends/{batch_id} # -batch_id = "test_url_param" +batch_id = 'test_url_param' response = sg.client.user.scheduled_sends._(batch_id).delete puts response.status_code puts response.body @@ -253,7 +253,7 @@ "spam_check": false, "url": "http://newdomain.com/parse" }') -hostname = "test_url_param" +hostname = 'test_url_param' response = sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data) puts response.status_code puts response.body @@ -263,7 +263,7 @@ # Retrieve a specific parse setting # # GET /user/webhooks/parse/settings/{hostname} # -hostname = "test_url_param" +hostname = 'test_url_param' response = sg.client.user.webhooks.parse.settings._(hostname).get puts response.status_code puts response.body @@ -273,7 +273,7 @@ # Delete a parse setting # # DELETE /user/webhooks/parse/settings/{hostname} # -hostname = "test_url_param" +hostname = 'test_url_param' response = sg.client.user.webhooks.parse.settings._(hostname).delete puts response.status_code puts response.body diff --git a/lib/sendgrid/base_interface.rb b/lib/sendgrid/base_interface.rb index c333f175..c288e632 100644 --- a/lib/sendgrid/base_interface.rb +++ b/lib/sendgrid/base_interface.rb @@ -17,7 +17,7 @@ class BaseInterface def initialize(auth:, host:, request_headers: nil, version: nil, impersonate_subuser: nil) @auth = auth @host = host - @version = version ? version : 'v3' + @version = version || 'v3' @impersonate_subuser = impersonate_subuser @user_agent = "sendgrid/#{SendGrid::VERSION};ruby" @request_headers = JSON.parse(' diff --git a/lib/sendgrid/helpers/mail/header.rb b/lib/sendgrid/helpers/mail/header.rb index d104dfaf..c9a7227f 100644 --- a/lib/sendgrid/helpers/mail/header.rb +++ b/lib/sendgrid/helpers/mail/header.rb @@ -11,7 +11,7 @@ def initialize(key: nil, value: nil) def to_json(*) { - 'header' => self.header + 'header' => header }.delete_if { |_, value| value.to_s.strip == '' } end end diff --git a/lib/sendgrid/helpers/mail/mail.rb b/lib/sendgrid/helpers/mail/mail.rb index 6230919e..9e1ed7bb 100644 --- a/lib/sendgrid/helpers/mail/mail.rb +++ b/lib/sendgrid/helpers/mail/mail.rb @@ -4,7 +4,6 @@ module SendGrid class Mail - attr_accessor :subject, :ip_pool_name, :template_id, :send_at, :batch_id attr_reader :personalizations, :contents, :attachments, :categories, :sections, :headers, :custom_args attr_writer :from, :asm, :mail_settings, :tracking_settings, :reply_to diff --git a/lib/sendgrid/helpers/mail/personalization.rb b/lib/sendgrid/helpers/mail/personalization.rb index 70383e9f..bc1ee13a 100644 --- a/lib/sendgrid/helpers/mail/personalization.rb +++ b/lib/sendgrid/helpers/mail/personalization.rb @@ -2,7 +2,6 @@ module SendGrid class Personalization - attr_reader :tos, :ccs, :bccs, :headers, :substitutions, :custom_args, :dynamic_template_data diff --git a/lib/sendgrid/helpers/mail/substitution.rb b/lib/sendgrid/helpers/mail/substitution.rb index 92222c4e..738f4f5b 100644 --- a/lib/sendgrid/helpers/mail/substitution.rb +++ b/lib/sendgrid/helpers/mail/substitution.rb @@ -11,7 +11,7 @@ def initialize(key: nil, value: nil) def to_json(*) { - 'substitution' => self.substitution + 'substitution' => substitution }.delete_if { |_, value| value.to_s.strip == '' } end end diff --git a/sendgrid-ruby.gemspec b/sendgrid-ruby.gemspec index 8c65b77c..279d0c39 100644 --- a/sendgrid-ruby.gemspec +++ b/sendgrid-ruby.gemspec @@ -1,5 +1,4 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sendgrid/version' @@ -20,13 +19,13 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(/^(test|spec|features)/) spec.require_paths = ['lib'] spec.add_dependency 'ruby_http_client', '~> 3.4' - spec.add_development_dependency 'sinatra', '>= 1.4.7', '< 3' - spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec' - spec.add_development_dependency 'pry' spec.add_development_dependency 'faker' - spec.add_development_dependency 'rubocop' spec.add_development_dependency 'minitest', '~> 5.9' + spec.add_development_dependency 'pry' spec.add_development_dependency 'rack' + spec.add_development_dependency 'rake', '~> 13.0' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'rubocop' spec.add_development_dependency 'simplecov', '~> 0.18.5' + spec.add_development_dependency 'sinatra', '>= 1.4.7', '< 3' end diff --git a/spec/sendgrid/helpers/settings/settings_spec.rb b/spec/sendgrid/helpers/settings/settings_spec.rb index 543ebc89..640be2a3 100644 --- a/spec/sendgrid/helpers/settings/settings_spec.rb +++ b/spec/sendgrid/helpers/settings/settings_spec.rb @@ -18,7 +18,7 @@ describe '.update_bcc' do it 'updates bcc' do - bcc_response = settings.update_bcc(enabled: true, email: "email@example.com") + bcc_response = settings.update_bcc(enabled: true, email: 'email@example.com') expect(bcc_response).to be_a SendGrid::Response end end diff --git a/spec/sendgrid/helpers/stats/email_stats_spec.rb b/spec/sendgrid/helpers/stats/email_stats_spec.rb index 8c8cba0f..e9c6c633 100644 --- a/spec/sendgrid/helpers/stats/email_stats_spec.rb +++ b/spec/sendgrid/helpers/stats/email_stats_spec.rb @@ -7,26 +7,26 @@ let(:sample_response) do [{ - "date" => "2017-10-01", - "stats" => [ - { "metrics" => + 'date' => '2017-10-01', + 'stats' => [ + { 'metrics' => { - "blocks" => 101, - "bounce_drops" => 102, - "bounces" => 103, - "clicks" => 104, - "deferred" => 105, - "delivered" => 106, - "invalid_emails" => 107, - "opens" => 108, - "processed" => 109, - "requests" => 110, - "spam_report_drops" => 111, - "spam_reports" => 112, - "unique_clicks" => 113, - "unique_opens" => 114, - "unsubscribe_drops" => 115, - "unsubscribes" => 116 + 'blocks' => 101, + 'bounce_drops' => 102, + 'bounces' => 103, + 'clicks' => 104, + 'deferred' => 105, + 'delivered' => 106, + 'invalid_emails' => 107, + 'opens' => 108, + 'processed' => 109, + 'requests' => 110, + 'spam_report_drops' => 111, + 'spam_reports' => 112, + 'unique_clicks' => 113, + 'unique_opens' => 114, + 'unsubscribe_drops' => 115, + 'unsubscribes' => 116 } } ] }] @@ -34,9 +34,9 @@ let(:error_response) do { - "errors" => [ + 'errors' => [ { - "message" => "end_date should be a YYYY-MM-DD formatted date" + 'message' => 'end_date should be a YYYY-MM-DD formatted date' } ] } diff --git a/spec/sendgrid/helpers/stats/metrics_spec.rb b/spec/sendgrid/helpers/stats/metrics_spec.rb index fb53b7e8..b7a121b4 100644 --- a/spec/sendgrid/helpers/stats/metrics_spec.rb +++ b/spec/sendgrid/helpers/stats/metrics_spec.rb @@ -3,23 +3,23 @@ describe SendGrid::Metrics do let(:params) do { - "date" => "2017-10-01", - "blocks" => 101, - "bounce_drops" => 102, - "bounces" => 103, - "clicks" => 104, - "deferred" => 105, - "delivered" => 106, - "invalid_emails" => 107, - "opens" => 108, - "processed" => 109, - "requests" => 110, - "spam_report_drops" => 111, - "spam_reports" => 112, - "unique_clicks" => 113, - "unique_opens" => 114, - "unsubscribe_drops" => 115, - "unsubscribes" => 116 + 'date' => '2017-10-01', + 'blocks' => 101, + 'bounce_drops' => 102, + 'bounces' => 103, + 'clicks' => 104, + 'deferred' => 105, + 'delivered' => 106, + 'invalid_emails' => 107, + 'opens' => 108, + 'processed' => 109, + 'requests' => 110, + 'spam_report_drops' => 111, + 'spam_reports' => 112, + 'unique_clicks' => 113, + 'unique_opens' => 114, + 'unsubscribe_drops' => 115, + 'unsubscribes' => 116 } end diff --git a/spec/sendgrid/helpers/stats/stats_response_spec.rb b/spec/sendgrid/helpers/stats/stats_response_spec.rb index d6a3d30d..c3b99cbe 100644 --- a/spec/sendgrid/helpers/stats/stats_response_spec.rb +++ b/spec/sendgrid/helpers/stats/stats_response_spec.rb @@ -3,26 +3,26 @@ describe SendGrid::StatsResponse do let(:params) do [{ - "date" => "2017-10-01", - "stats" => [ - { "metrics" => + 'date' => '2017-10-01', + 'stats' => [ + { 'metrics' => { - "blocks" => 101, - "bounce_drops" => 102, - "bounces" => 103, - "clicks" => 104, - "deferred" => 105, - "delivered" => 106, - "invalid_emails" => 107, - "opens" => 108, - "processed" => 109, - "requests" => 110, - "spam_report_drops" => 111, - "spam_reports" => 112, - "unique_clicks" => 113, - "unique_opens" => 114, - "unsubscribe_drops" => 115, - "unsubscribes" => 116 + 'blocks' => 101, + 'bounce_drops' => 102, + 'bounces' => 103, + 'clicks' => 104, + 'deferred' => 105, + 'delivered' => 106, + 'invalid_emails' => 107, + 'opens' => 108, + 'processed' => 109, + 'requests' => 110, + 'spam_report_drops' => 111, + 'spam_reports' => 112, + 'unique_clicks' => 113, + 'unique_opens' => 114, + 'unsubscribe_drops' => 115, + 'unsubscribes' => 116 } } ] }] @@ -50,9 +50,9 @@ context 'errors' do let(:error_params) do { - "errors" => [ + 'errors' => [ { - "message" => "end_date should be a YYYY-MM-DD formatted date" + 'message' => 'end_date should be a YYYY-MM-DD formatted date' } ] } diff --git a/test/sendgrid/helpers/mail/test_email.rb b/test/sendgrid/helpers/mail/test_email.rb index 182c0d03..28f5c2ce 100644 --- a/test/sendgrid/helpers/mail/test_email.rb +++ b/test/sendgrid/helpers/mail/test_email.rb @@ -5,27 +5,27 @@ class TestEmail < Minitest::Test include SendGrid def test_split_email_full_email - @email = Email.new(email: "Example User ") + @email = Email.new(email: 'Example User ') expected_json = { - "email" => "test1@example.com", - "name" => "Example User" + 'email' => 'test1@example.com', + 'name' => 'Example User' } assert_equal @email.to_json, expected_json end def test_split_email_only_email - @email = Email.new(email: "test1@example.com") + @email = Email.new(email: 'test1@example.com') expected_json = { - "email" => "test1@example.com" + 'email' => 'test1@example.com' } assert_equal @email.to_json, expected_json end def test_split_email_name_and_email - @email = Email.new(name: "Example User", email: "test1@example.com") + @email = Email.new(name: 'Example User', email: 'test1@example.com') expected_json = { - "email" => "test1@example.com", - "name" => "Example User" + 'email' => 'test1@example.com', + 'name' => 'Example User' } assert_equal @email.to_json, expected_json end diff --git a/test/sendgrid/helpers/mail/test_mail.rb b/test/sendgrid/helpers/mail/test_mail.rb index e63b2d4a..fac32a0c 100644 --- a/test/sendgrid/helpers/mail/test_mail.rb +++ b/test/sendgrid/helpers/mail/test_mail.rb @@ -1,7 +1,7 @@ -require_relative "../../../../lib/sendgrid/helpers/mail/mail" -require_relative "../../../../lib/sendgrid/sendgrid" +require_relative '../../../../lib/sendgrid/helpers/mail/mail' +require_relative '../../../../lib/sendgrid/sendgrid' include SendGrid -require "json" +require 'json' require 'minitest/autorun' class TestMail < Minitest::Test @@ -19,100 +19,100 @@ def test_hello_world def test_kitchen_sink mail = SendGrid::Mail.new - mail.from = Email.new(email: "test@example.com") - mail.subject = "Hello World from the Twilio SendGrid Ruby Library" + mail.from = Email.new(email: 'test@example.com') + mail.subject = 'Hello World from the Twilio SendGrid Ruby Library' personalization = Personalization.new - personalization.add_to(Email.new(email: "test@example.com", name: "Example User")) - personalization.add_to(Email.new(email: "test@example.com", name: "Example User")) - personalization.add_cc(Email.new(email: "test@example.com", name: "Example User")) - personalization.add_cc(Email.new(email: "test@example.com", name: "Example User")) - personalization.add_bcc(Email.new(email: "test@example.com", name: "Example User")) - personalization.add_bcc(Email.new(email: "test@example.com", name: "Example User")) - personalization.subject = "Hello World from the Personalized Twilio SendGrid Ruby Library" - personalization.add_header(Header.new(key: "X-Test", value: "True")) - personalization.add_header(Header.new(key: "X-Mock", value: "False")) - personalization.add_substitution(Substitution.new(key: "%name%", value: "Example User")) - personalization.add_substitution(Substitution.new(key: "%city%", value: "Denver")) - personalization.add_custom_arg(CustomArg.new(key: "user_id", value: "343")) - personalization.add_custom_arg(CustomArg.new(key: "type", value: "marketing")) - personalization.send_at = 1443636843 + personalization.add_to(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.add_to(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.add_cc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.add_cc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.add_bcc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.add_bcc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization.subject = 'Hello World from the Personalized Twilio SendGrid Ruby Library' + personalization.add_header(Header.new(key: 'X-Test', value: 'True')) + personalization.add_header(Header.new(key: 'X-Mock', value: 'False')) + personalization.add_substitution(Substitution.new(key: '%name%', value: 'Example User')) + personalization.add_substitution(Substitution.new(key: '%city%', value: 'Denver')) + personalization.add_custom_arg(CustomArg.new(key: 'user_id', value: '343')) + personalization.add_custom_arg(CustomArg.new(key: 'type', value: 'marketing')) + personalization.send_at = 1_443_636_843 mail.add_personalization(personalization) personalization2 = Personalization.new - personalization2.add_to(Email.new(email: "test@example.com", name: "Example User")) - personalization2.add_to(Email.new(email: "test@example.com", name: "Example User")) - personalization2.add_cc(Email.new(email: "test@example.com", name: "Example User")) - personalization2.add_cc(Email.new(email: "test@example.com", name: "Example User")) - personalization2.add_bcc(Email.new(email: "test@example.com", name: "Example User")) - personalization2.add_bcc(Email.new(email: "test@example.com", name: "Example User")) - personalization2.subject = "Hello World from the Personalized Twilio SendGrid Ruby Library" - personalization2.add_header(Header.new(key: "X-Test", value: "True")) - personalization2.add_header(Header.new(key: "X-Mock", value: "False")) - personalization2.add_substitution(Substitution.new(key: "%name%", value: "Example User")) - personalization2.add_substitution(Substitution.new(key: "%city%", value: "Denver")) - personalization2.add_custom_arg(CustomArg.new(key: "user_id", value: "343")) - personalization2.add_custom_arg(CustomArg.new(key: "type", value: "marketing")) - personalization2.send_at = 1443636843 + personalization2.add_to(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.add_to(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.add_cc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.add_cc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.add_bcc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.add_bcc(Email.new(email: 'test@example.com', name: 'Example User')) + personalization2.subject = 'Hello World from the Personalized Twilio SendGrid Ruby Library' + personalization2.add_header(Header.new(key: 'X-Test', value: 'True')) + personalization2.add_header(Header.new(key: 'X-Mock', value: 'False')) + personalization2.add_substitution(Substitution.new(key: '%name%', value: 'Example User')) + personalization2.add_substitution(Substitution.new(key: '%city%', value: 'Denver')) + personalization2.add_custom_arg(CustomArg.new(key: 'user_id', value: '343')) + personalization2.add_custom_arg(CustomArg.new(key: 'type', value: 'marketing')) + personalization2.send_at = 1_443_636_843 mail.add_personalization(personalization2) - mail.add_content(Content.new(type: "text/plain", value: "some text here")) - mail.add_content(Content.new(type: "text/html", value: "some text here")) + mail.add_content(Content.new(type: 'text/plain', value: 'some text here')) + mail.add_content(Content.new(type: 'text/html', value: 'some text here')) attachment = Attachment.new - attachment.content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12" - attachment.type = "application/pdf" - attachment.filename = "balance_001.pdf" - attachment.disposition = "attachment" - attachment.content_id = "Balance Sheet" + attachment.content = 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12' + attachment.type = 'application/pdf' + attachment.filename = 'balance_001.pdf' + attachment.disposition = 'attachment' + attachment.content_id = 'Balance Sheet' mail.add_attachment(attachment) attachment2 = Attachment.new - attachment2.content = "BwdW" - attachment2.type = "image/png" - attachment2.filename = "banner.png" - attachment2.disposition = "inline" - attachment2.content_id = "Banner" + attachment2.content = 'BwdW' + attachment2.type = 'image/png' + attachment2.filename = 'banner.png' + attachment2.disposition = 'inline' + attachment2.content_id = 'Banner' mail.add_attachment(attachment2) - mail.template_id = "13b8f94f-bcae-4ec6-b752-70d6cb59f932" + mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932' - mail.add_section(Section.new(key: "%section1%", value: "Substitution Text for Section 1")) - mail.add_section(Section.new(key: "%section2%", value: "Substitution Text for Section 2")) + mail.add_section(Section.new(key: '%section1%', value: 'Substitution Text for Section 1')) + mail.add_section(Section.new(key: '%section2%', value: 'Substitution Text for Section 2')) - mail.add_header(Header.new(key: "X-Test3", value: "test3")) - mail.add_header(Header.new(key: "X-Test4", value: "test4")) + mail.add_header(Header.new(key: 'X-Test3', value: 'test3')) + mail.add_header(Header.new(key: 'X-Test4', value: 'test4')) - mail.add_category(Category.new(name: "May")) - mail.add_category(Category.new(name: "2016")) + mail.add_category(Category.new(name: 'May')) + mail.add_category(Category.new(name: '2016')) - mail.add_custom_arg(CustomArg.new(key: "campaign", value: "welcome")) - mail.add_custom_arg(CustomArg.new(key: "weekday", value: "morning")) + mail.add_custom_arg(CustomArg.new(key: 'campaign', value: 'welcome')) + mail.add_custom_arg(CustomArg.new(key: 'weekday', value: 'morning')) - mail.send_at = 1443636842 + mail.send_at = 1_443_636_842 - mail.batch_id = "sendgrid_batch_id" + mail.batch_id = 'sendgrid_batch_id' mail.asm = ASM.new(group_id: 99, groups_to_display: [4, 5, 6, 7, 8]) - mail.ip_pool_name = "23" + mail.ip_pool_name = '23' mail_settings = MailSettings.new - mail_settings.bcc = BccSettings.new(enable: true, email: "test@example.com") + mail_settings.bcc = BccSettings.new(enable: true, email: 'test@example.com') mail_settings.bypass_list_management = BypassListManagement.new(enable: true) - mail_settings.footer = Footer.new(enable: true, text: "Footer Text", html: "Footer Text") + mail_settings.footer = Footer.new(enable: true, text: 'Footer Text', html: 'Footer Text') mail_settings.sandbox_mode = SandBoxMode.new(enable: true) - mail_settings.spam_check = SpamCheck.new(enable: true, threshold: 1, post_to_url: "https://spamcatcher.sendgrid.com") + mail_settings.spam_check = SpamCheck.new(enable: true, threshold: 1, post_to_url: 'https://spamcatcher.sendgrid.com') mail.mail_settings = mail_settings tracking_settings = TrackingSettings.new tracking_settings.click_tracking = ClickTracking.new(enable: false, enable_text: false) - tracking_settings.open_tracking = OpenTracking.new(enable: true, substitution_tag: "Optional tag to replace with the open image in the body of the message") - tracking_settings.subscription_tracking = SubscriptionTracking.new(enable: true, text: "text to insert into the text/plain portion of the message", html: "html to insert into the text/html portion of the message", substitution_tag: "Optional tag to replace with the open image in the body of the message") - tracking_settings.ganalytics = Ganalytics.new(enable: true, utm_source: "some source", utm_medium: "some medium", utm_term: "some term", utm_content: "some content", utm_campaign: "some campaign") + tracking_settings.open_tracking = OpenTracking.new(enable: true, substitution_tag: 'Optional tag to replace with the open image in the body of the message') + tracking_settings.subscription_tracking = SubscriptionTracking.new(enable: true, text: 'text to insert into the text/plain portion of the message', html: 'html to insert into the text/html portion of the message', substitution_tag: 'Optional tag to replace with the open image in the body of the message') + tracking_settings.ganalytics = Ganalytics.new(enable: true, utm_source: 'some source', utm_medium: 'some medium', utm_term: 'some term', utm_content: 'some content', utm_campaign: 'some campaign') mail.tracking_settings = tracking_settings - mail.reply_to = Email.new(email: "test@example.com") + mail.reply_to = Email.new(email: 'test@example.com') assert_equal(mail.to_json, JSON.parse('{"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","content_id":"Balance Sheet","disposition":"attachment","filename":"balance_001.pdf","type":"application/pdf"},{"content":"BwdW","content_id":"Banner","disposition":"inline","filename":"banner.png","type":"image/png"}],"batch_id":"sendgrid_batch_id","categories":["May","2016"],"content":[{"type":"text/plain","value":"some text here"},{"type":"text/html","value":"some text here"}],"custom_args":{"campaign":"welcome","weekday":"morning"},"from":{"email":"test@example.com"},"headers":{"X-Test3":"test3","X-Test4":"test4"},"ip_pool_name":"23","mail_settings":{"bcc":{"email":"test@example.com","enable":true},"bypass_list_management":{"enable":true},"footer":{"enable":true,"html":"Footer Text","text":"Footer Text"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"post_to_url":"https://spamcatcher.sendgrid.com","threshold":1}},"personalizations":[{"bcc":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}],"cc":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}],"custom_args":{"type":"marketing","user_id":"343"},"headers":{"X-Mock":"False","X-Test":"True"},"send_at":1443636843,"subject":"Hello World from the Personalized Twilio SendGrid Ruby Library","substitutions":{"%city%":"Denver","%name%":"Example User"},"to":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}]},{"bcc":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}],"cc":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}],"custom_args":{"type":"marketing","user_id":"343"},"headers":{"X-Mock":"False","X-Test":"True"},"send_at":1443636843,"subject":"Hello World from the Personalized Twilio SendGrid Ruby Library","substitutions":{"%city%":"Denver","%name%":"Example User"},"to":[{"email":"test@example.com","name":"Example User"},{"email":"test@example.com","name":"Example User"}]}],"reply_to":{"email":"test@example.com"},"sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"send_at":1443636842,"subject":"Hello World from the Twilio SendGrid Ruby Library","template_id":"13b8f94f-bcae-4ec6-b752-70d6cb59f932","tracking_settings":{"click_tracking":{"enable":false,"enable_text":false},"ganalytics":{"enable":true,"utm_campaign":"some campaign","utm_content":"some content","utm_medium":"some medium","utm_source":"some source","utm_term":"some term"},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"html":"html to insert into the text/html portion of the message","substitution_tag":"Optional tag to replace with the open image in the body of the message","text":"text to insert into the text/plain portion of the message"}}}')) end @@ -153,16 +153,16 @@ def test_add_section mail = SendGrid::Mail.new mail.add_section(Section.new(key: '%section1%', value: 'Substitution Text for Section 1')) expected_json = { - "sections" => { - "%section1%" => "Substitution Text for Section 1" + 'sections' => { + '%section1%' => 'Substitution Text for Section 1' } } assert_equal mail.to_json, expected_json mail.add_section(Section.new(key: '%section2%', value: 'Substitution Text for Section 2')) expected_json = { - "sections" => { - "%section1%" => "Substitution Text for Section 1", - "%section2%" => "Substitution Text for Section 2" + 'sections' => { + '%section1%' => 'Substitution Text for Section 1', + '%section2%' => 'Substitution Text for Section 2' } } assert_equal mail.to_json, expected_json @@ -172,16 +172,16 @@ def test_add_header mail = SendGrid::Mail.new mail.add_header(Header.new(key: 'X-Test3', value: 'test3')) expected_json = { - "headers" => { - "X-Test3" => "test3" + 'headers' => { + 'X-Test3' => 'test3' } } assert_equal mail.to_json, expected_json mail.add_header(Header.new(key: 'X-Test4', value: 'test4')) expected_json = { - "headers" => { - "X-Test3" => "test3", - "X-Test4" => "test4" + 'headers' => { + 'X-Test3' => 'test3', + 'X-Test4' => 'test4' } } assert_equal mail.to_json, expected_json @@ -191,16 +191,16 @@ def test_add_custom_arg mail = SendGrid::Mail.new mail.add_custom_arg(CustomArg.new(key: 'campaign 1', value: 'welcome 1')) expected_json = { - "custom_args" => { - "campaign 1" => "welcome 1" + 'custom_args' => { + 'campaign 1' => 'welcome 1' } } assert_equal mail.to_json, expected_json mail.add_custom_arg(CustomArg.new(key: 'campaign 2', value: 'welcome 2')) expected_json = { - "custom_args" => { - "campaign 1" => "welcome 1", - "campaign 2" => "welcome 2" + 'custom_args' => { + 'campaign 1' => 'welcome 1', + 'campaign 2' => 'welcome 2' } } assert_equal mail.to_json, expected_json @@ -208,14 +208,14 @@ def test_add_custom_arg def test_add_non_string_custom_arg mail = Mail.new - mail.add_custom_arg(CustomArg.new(key: "Integer", value: 1)) - mail.add_custom_arg(CustomArg.new(key: "Array", value: [1, "a", true])) - mail.add_custom_arg(CustomArg.new(key: "Hash", value: { "a" => 1, "b" => 2 })) + mail.add_custom_arg(CustomArg.new(key: 'Integer', value: 1)) + mail.add_custom_arg(CustomArg.new(key: 'Array', value: [1, 'a', true])) + mail.add_custom_arg(CustomArg.new(key: 'Hash', value: { 'a' => 1, 'b' => 2 })) expected_json = { - "custom_args" => { - "Integer" => "1", - "Array" => "[1, \"a\", true]", - "Hash" => "{\"a\"=>1, \"b\"=>2}" + 'custom_args' => { + 'Integer' => '1', + 'Array' => '[1, "a", true]', + 'Hash' => '{"a"=>1, "b"=>2}' } } assert_equal mail.to_json, expected_json @@ -240,7 +240,7 @@ def test_add_more_than_1_valid_category category_2 = Category.new(name: 'bar') mail.add_category(category_1) mail.add_category(category_2) - assert_equal(['foo', 'bar'], mail.categories) + assert_equal(%w[foo bar], mail.categories) end def test_add_invalid_category diff --git a/test/sendgrid/helpers/mail/test_personalizations.rb b/test/sendgrid/helpers/mail/test_personalizations.rb index b6517e86..3b8c0efe 100644 --- a/test/sendgrid/helpers/mail/test_personalizations.rb +++ b/test/sendgrid/helpers/mail/test_personalizations.rb @@ -9,14 +9,14 @@ def test_add_to @personalization.add_to(Email.new(email: 'test1@example.com', name: 'Example User')) @personalization.add_to(Email.new(email: 'test2@example.com', name: 'Example User 2')) expected_json = { - "to" => [ + 'to' => [ { - "email" => "test1@example.com", - "name" => "Example User" + 'email' => 'test1@example.com', + 'name' => 'Example User' }, { - "email" => "test2@example.com", - "name" => "Example User 2" + 'email' => 'test2@example.com', + 'name' => 'Example User 2' } ] } @@ -28,14 +28,14 @@ def test_add_cc @personalization.add_cc(Email.new(email: 'test1@example.com', name: 'Example User')) @personalization.add_cc(Email.new(email: 'test2@example.com', name: 'Example User 2')) expected_json = { - "cc" => [ + 'cc' => [ { - "email" => "test1@example.com", - "name" => "Example User" + 'email' => 'test1@example.com', + 'name' => 'Example User' }, { - "email" => "test2@example.com", - "name" => "Example User 2" + 'email' => 'test2@example.com', + 'name' => 'Example User 2' } ] } @@ -47,14 +47,14 @@ def test_add_bcc @personalization.add_bcc(Email.new(email: 'test1@example.com', name: 'Example User')) @personalization.add_bcc(Email.new(email: 'test2@example.com', name: 'Example User 2')) expected_json = { - "bcc" => [ + 'bcc' => [ { - "email" => "test1@example.com", - "name" => "Example User" + 'email' => 'test1@example.com', + 'name' => 'Example User' }, { - "email" => "test2@example.com", - "name" => "Example User 2" + 'email' => 'test2@example.com', + 'name' => 'Example User 2' } ] } @@ -65,16 +65,16 @@ def test_add_header @personalization = Personalization.new @personalization.add_header(Header.new(key: 'X-Test', value: 'True')) expected_json = { - "headers" => { - "X-Test" => "True" + 'headers' => { + 'X-Test' => 'True' } } assert_equal @personalization.to_json, expected_json @personalization.add_header(Header.new(key: 'X-Test 1', value: 'False')) expected_json = { - "headers" => { - "X-Test" => "True", - "X-Test 1" => "False" + 'headers' => { + 'X-Test' => 'True', + 'X-Test 1' => 'False' } } assert_equal @personalization.to_json, expected_json @@ -84,16 +84,16 @@ def test_add_substitution @personalization = Personalization.new @personalization.add_substitution(Substitution.new(key: '%name%', value: 'Example User')) expected_json = { - "substitutions" => { - "%name%" => "Example User" + 'substitutions' => { + '%name%' => 'Example User' } } assert_equal @personalization.to_json, expected_json @personalization.add_substitution(Substitution.new(key: '%name 1%', value: 'Example User 1')) expected_json = { - "substitutions" => { - "%name%" => "Example User", - "%name 1%" => "Example User 1" + 'substitutions' => { + '%name%' => 'Example User', + '%name 1%' => 'Example User 1' } } assert_equal @personalization.to_json, expected_json @@ -103,16 +103,16 @@ def test_add_custom_arg @personalization = Personalization.new @personalization.add_custom_arg(CustomArg.new(key: 'user_id', value: '343')) expected_json = { - "custom_args" => { - "user_id" => "343" + 'custom_args' => { + 'user_id' => '343' } } assert_equal @personalization.to_json, expected_json @personalization.add_custom_arg(CustomArg.new(key: 'city', value: 'denver')) expected_json = { - "custom_args" => { - "user_id" => "343", - "city" => "denver" + 'custom_args' => { + 'user_id' => '343', + 'city' => 'denver' } } assert_equal @personalization.to_json, expected_json @@ -121,13 +121,13 @@ def test_add_custom_arg def test_add_dynamic_template_data @personalization = Personalization.new @personalization.add_dynamic_template_data( - "name" => "Example User", - "city" => "Denver" + 'name' => 'Example User', + 'city' => 'Denver' ) expected_json = { - "dynamic_template_data" => { - "name" => "Example User", - "city" => "Denver" + 'dynamic_template_data' => { + 'name' => 'Example User', + 'city' => 'Denver' } } assert_equal @personalization.to_json, expected_json diff --git a/test/sendgrid/test_sendgrid-ruby.rb b/test/sendgrid/test_sendgrid-ruby.rb index e5357174..04052581 100644 --- a/test/sendgrid/test_sendgrid-ruby.rb +++ b/test/sendgrid/test_sendgrid-ruby.rb @@ -8,7 +8,7 @@ class TestAPI < MiniTest::Test def setup - @sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY") + @sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY') end def test_init @@ -18,9 +18,9 @@ def test_init } ') subuser = 'test_user' - sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY", host: "https://api.test.com", request_headers: headers, version: "v3", impersonate_subuser: subuser) + sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', host: 'https://api.test.com', request_headers: headers, version: 'v3', impersonate_subuser: subuser) - assert_equal("https://api.test.com", sg.host) + assert_equal('https://api.test.com', sg.host) user_agent = "sendgrid/#{SendGrid::VERSION};ruby" test_headers = JSON.parse(' { @@ -32,20 +32,18 @@ def test_init } ') assert_equal(test_headers, sg.request_headers) - assert_equal("v3", sg.version) + assert_equal('v3', sg.version) assert_equal(subuser, sg.impersonate_subuser) - assert_equal("6.3.4", SendGrid::VERSION) + assert_equal('6.3.4', SendGrid::VERSION) assert_instance_of(SendGrid::Client, sg.client) end - def test_init_when_impersonate_subuser_is_not_given - sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY", host: "https://api.test.com", version: "v3") + def test_init_when_impersonate_subuser_is_not_given + sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', host: 'https://api.test.com', version: 'v3') refute_includes(sg.request_headers, 'On-Behalf-Of') - end - - def test_access_settings_activity_get - params = JSON.parse('{"limit": 1}') - headers = JSON.parse('{"X-Mock": 200}') + enddef test_access_settings_activity_get + params = JSON.parse('{"limit": 1}') + headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.access_settings.activity.get(query_params: params, request_headers: headers) @@ -97,7 +95,7 @@ def test_access_settings_whitelist_delete end def test_access_settings_whitelist__rule_id__get - rule_id = "test_url_param" + rule_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.access_settings.whitelist._(rule_id).get(request_headers: headers) @@ -106,7 +104,7 @@ def test_access_settings_whitelist__rule_id__get end def test_access_settings_whitelist__rule_id__delete - rule_id = "test_url_param" + rule_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.access_settings.whitelist._(rule_id).delete(request_headers: headers) @@ -139,7 +137,7 @@ def test_alerts__alert_id__patch data = JSON.parse('{ "email_to": "example@example.com" }') - alert_id = "test_url_param" + alert_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.alerts._(alert_id).patch(request_body: data, request_headers: headers) @@ -148,7 +146,7 @@ def test_alerts__alert_id__patch end def test_alerts__alert_id__get - alert_id = "test_url_param" + alert_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.alerts._(alert_id).get(request_headers: headers) @@ -157,7 +155,7 @@ def test_alerts__alert_id__get end def test_alerts__alert_id__delete - alert_id = "test_url_param" + alert_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.alerts._(alert_id).delete(request_headers: headers) @@ -199,7 +197,7 @@ def test_api_keys__api_key_id__put "user.profile.update" ] }') - api_key_id = "test_url_param" + api_key_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.api_keys._(api_key_id).put(request_body: data, request_headers: headers) @@ -211,7 +209,7 @@ def test_api_keys__api_key_id__patch data = JSON.parse('{ "name": "A New Hope" }') - api_key_id = "test_url_param" + api_key_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.api_keys._(api_key_id).patch(request_body: data, request_headers: headers) @@ -220,7 +218,7 @@ def test_api_keys__api_key_id__patch end def test_api_keys__api_key_id__get - api_key_id = "test_url_param" + api_key_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.api_keys._(api_key_id).get(request_headers: headers) @@ -229,7 +227,7 @@ def test_api_keys__api_key_id__get end def test_api_keys__api_key_id__delete - api_key_id = "test_url_param" + api_key_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.api_keys._(api_key_id).delete(request_headers: headers) @@ -265,7 +263,7 @@ def test_asm_groups__group_id__patch "id": 103, "name": "Item Suggestions" }') - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.asm.groups._(group_id).patch(request_body: data, request_headers: headers) @@ -274,7 +272,7 @@ def test_asm_groups__group_id__patch end def test_asm_groups__group_id__get - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.asm.groups._(group_id).get(request_headers: headers) @@ -283,7 +281,7 @@ def test_asm_groups__group_id__get end def test_asm_groups__group_id__delete - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.asm.groups._(group_id).delete(request_headers: headers) @@ -298,7 +296,7 @@ def test_asm_groups__group_id__suppressions_post "test2@example.com" ] }') - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.asm.groups._(group_id).suppressions.post(request_body: data, request_headers: headers) @@ -307,7 +305,7 @@ def test_asm_groups__group_id__suppressions_post end def test_asm_groups__group_id__suppressions_get - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.asm.groups._(group_id).suppressions.get(request_headers: headers) @@ -323,7 +321,7 @@ def test_asm_groups__group_id__suppressions_search_post "doesnotexists@example.com" ] }') - group_id = "test_url_param" + group_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data, request_headers: headers) @@ -332,8 +330,8 @@ def test_asm_groups__group_id__suppressions_search_post end def test_asm_groups__group_id__suppressions__email__delete - group_id = "test_url_param" - email = "test_url_param" + group_id = 'test_url_param' + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.asm.groups._(group_id).suppressions._(email).delete(request_headers: headers) @@ -364,7 +362,7 @@ def test_asm_suppressions_global_post end def test_asm_suppressions_global__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.asm.suppressions.global._(email).get(request_headers: headers) @@ -373,7 +371,7 @@ def test_asm_suppressions_global__email__get end def test_asm_suppressions_global__email__delete - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.asm.suppressions.global._(email).delete(request_headers: headers) @@ -382,7 +380,7 @@ def test_asm_suppressions_global__email__delete end def test_asm_suppressions__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.asm.suppressions._(email).get(request_headers: headers) @@ -446,7 +444,7 @@ def test_campaigns__campaign_id__patch "subject": "New Products for Summer!", "title": "May Newsletter" }') - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.campaigns._(campaign_id).patch(request_body: data, request_headers: headers) @@ -455,7 +453,7 @@ def test_campaigns__campaign_id__patch end def test_campaigns__campaign_id__get - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.campaigns._(campaign_id).get(request_headers: headers) @@ -464,7 +462,7 @@ def test_campaigns__campaign_id__get end def test_campaigns__campaign_id__delete - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.campaigns._(campaign_id).delete(request_headers: headers) @@ -476,7 +474,7 @@ def test_campaigns__campaign_id__schedules_patch data = JSON.parse('{ "send_at": 1489451436 }') - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.campaigns._(campaign_id).schedules.patch(request_body: data, request_headers: headers) @@ -488,7 +486,7 @@ def test_campaigns__campaign_id__schedules_post data = JSON.parse('{ "send_at": 1489771528 }') - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.campaigns._(campaign_id).schedules.post(request_body: data, request_headers: headers) @@ -497,7 +495,7 @@ def test_campaigns__campaign_id__schedules_post end def test_campaigns__campaign_id__schedules_get - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.campaigns._(campaign_id).schedules.get(request_headers: headers) @@ -506,7 +504,7 @@ def test_campaigns__campaign_id__schedules_get end def test_campaigns__campaign_id__schedules_delete - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.campaigns._(campaign_id).schedules.delete(request_headers: headers) @@ -515,7 +513,7 @@ def test_campaigns__campaign_id__schedules_delete end def test_campaigns__campaign_id__schedules_now_post - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.campaigns._(campaign_id).schedules.now.post(request_headers: headers) @@ -527,7 +525,7 @@ def test_campaigns__campaign_id__schedules_test_post data = JSON.parse('{ "to": "your.email@example.com" }') - campaign_id = "test_url_param" + campaign_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.campaigns._(campaign_id).schedules.test.post(request_body: data, request_headers: headers) @@ -573,7 +571,7 @@ def test_clients_stats_get def test_clients__client_type__stats_get params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}') - client_type = "test_url_param" + client_type = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.clients._(client_type).stats.get(query_params: params, request_headers: headers) @@ -602,7 +600,7 @@ def test_contactdb_custom_fields_get end def test_contactdb_custom_fields__custom_field_id__get - custom_field_id = "test_url_param" + custom_field_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.custom_fields._(custom_field_id).get(request_headers: headers) @@ -611,7 +609,7 @@ def test_contactdb_custom_fields__custom_field_id__get end def test_contactdb_custom_fields__custom_field_id__delete - custom_field_id = "test_url_param" + custom_field_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 202}') response = @sg.client.contactdb.custom_fields._(custom_field_id).delete(request_headers: headers) @@ -657,7 +655,7 @@ def test_contactdb_lists__list_id__patch "name": "newlistname" }') params = JSON.parse('{"list_id": 1}') - list_id = "test_url_param" + list_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params, request_headers: headers) @@ -667,7 +665,7 @@ def test_contactdb_lists__list_id__patch def test_contactdb_lists__list_id__get params = JSON.parse('{"list_id": 1}') - list_id = "test_url_param" + list_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.lists._(list_id).get(query_params: params, request_headers: headers) @@ -677,7 +675,7 @@ def test_contactdb_lists__list_id__get def test_contactdb_lists__list_id__delete params = JSON.parse('{"delete_contacts": "true"}') - list_id = "test_url_param" + list_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 202}') response = @sg.client.contactdb.lists._(list_id).delete(query_params: params, request_headers: headers) @@ -690,7 +688,7 @@ def test_contactdb_lists__list_id__recipients_post "recipient_id1", "recipient_id2" ]') - list_id = "test_url_param" + list_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.contactdb.lists._(list_id).recipients.post(request_body: data, request_headers: headers) @@ -700,7 +698,7 @@ def test_contactdb_lists__list_id__recipients_post def test_contactdb_lists__list_id__recipients_get params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}') - list_id = "test_url_param" + list_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.lists._(list_id).recipients.get(query_params: params, request_headers: headers) @@ -709,8 +707,8 @@ def test_contactdb_lists__list_id__recipients_get end def test_contactdb_lists__list_id__recipients__recipient_id__post - list_id = "test_url_param" - recipient_id = "test_url_param" + list_id = 'test_url_param' + recipient_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(request_headers: headers) @@ -720,8 +718,8 @@ def test_contactdb_lists__list_id__recipients__recipient_id__post def test_contactdb_lists__list_id__recipients__recipient_id__delete params = JSON.parse('{"recipient_id": 1, "list_id": 1}') - list_id = "test_url_param" - recipient_id = "test_url_param" + list_id = 'test_url_param' + recipient_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params, request_headers: headers) @@ -804,7 +802,7 @@ def test_contactdb_recipients_count_get end def test_contactdb_recipients_search_get - params = { field_name: "test_string" } + params = { field_name: 'test_string' } headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.recipients.search.get(query_params: params, request_headers: headers) @@ -813,7 +811,7 @@ def test_contactdb_recipients_search_get end def test_contactdb_recipients__recipient_id__get - recipient_id = "test_url_param" + recipient_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.recipients._(recipient_id).get(request_headers: headers) @@ -822,7 +820,7 @@ def test_contactdb_recipients__recipient_id__get end def test_contactdb_recipients__recipient_id__delete - recipient_id = "test_url_param" + recipient_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.contactdb.recipients._(recipient_id).delete(request_headers: headers) @@ -831,7 +829,7 @@ def test_contactdb_recipients__recipient_id__delete end def test_contactdb_recipients__recipient_id__lists_get - recipient_id = "test_url_param" + recipient_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.recipients._(recipient_id).lists.get(request_headers: headers) @@ -901,7 +899,7 @@ def test_contactdb_segments__segment_id__patch "name": "The Millers" }') params = JSON.parse('{"segment_id": "test_string"}') - segment_id = "test_url_param" + segment_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.segments._(segment_id).patch(request_body: data, query_params: params, request_headers: headers) @@ -911,7 +909,7 @@ def test_contactdb_segments__segment_id__patch def test_contactdb_segments__segment_id__get params = JSON.parse('{"segment_id": 1}') - segment_id = "test_url_param" + segment_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.segments._(segment_id).get(query_params: params, request_headers: headers) @@ -921,7 +919,7 @@ def test_contactdb_segments__segment_id__get def test_contactdb_segments__segment_id__delete params = JSON.parse('{"delete_contacts": "true"}') - segment_id = "test_url_param" + segment_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.contactdb.segments._(segment_id).delete(query_params: params, request_headers: headers) @@ -931,7 +929,7 @@ def test_contactdb_segments__segment_id__delete def test_contactdb_segments__segment_id__recipients_get params = JSON.parse('{"page": 1, "page_size": 1}') - segment_id = "test_url_param" + segment_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.contactdb.segments._(segment_id).recipients.get(query_params: params, request_headers: headers) @@ -997,7 +995,7 @@ def test_ips_pools__pool_name__put data = JSON.parse('{ "name": "new_pool_name" }') - pool_name = "test_url_param" + pool_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.ips.pools._(pool_name).put(request_body: data, request_headers: headers) @@ -1006,7 +1004,7 @@ def test_ips_pools__pool_name__put end def test_ips_pools__pool_name__get - pool_name = "test_url_param" + pool_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.ips.pools._(pool_name).get(request_headers: headers) @@ -1015,7 +1013,7 @@ def test_ips_pools__pool_name__get end def test_ips_pools__pool_name__delete - pool_name = "test_url_param" + pool_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.ips.pools._(pool_name).delete(request_headers: headers) @@ -1027,7 +1025,7 @@ def test_ips_pools__pool_name__ips_post data = JSON.parse('{ "ip": "0.0.0.0" }') - pool_name = "test_url_param" + pool_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.ips.pools._(pool_name).ips.post(request_body: data, request_headers: headers) @@ -1036,8 +1034,8 @@ def test_ips_pools__pool_name__ips_post end def test_ips_pools__pool_name__ips__ip__delete - pool_name = "test_url_param" - ip = "test_url_param" + pool_name = 'test_url_param' + ip = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.ips.pools._(pool_name).ips._(ip).delete(request_headers: headers) @@ -1065,7 +1063,7 @@ def test_ips_warmup_get end def test_ips_warmup__ip_address__get - ip_address = "test_url_param" + ip_address = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.ips.warmup._(ip_address).get(request_headers: headers) @@ -1074,7 +1072,7 @@ def test_ips_warmup__ip_address__get end def test_ips_warmup__ip_address__delete - ip_address = "test_url_param" + ip_address = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.ips.warmup._(ip_address).delete(request_headers: headers) @@ -1083,7 +1081,7 @@ def test_ips_warmup__ip_address__delete end def test_ips__ip_address__get - ip_address = "test_url_param" + ip_address = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.ips._(ip_address).get(request_headers: headers) @@ -1100,7 +1098,7 @@ def test_mail_batch_post end def test_mail_batch__batch_id__get - batch_id = "test_url_param" + batch_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.mail.batch._(batch_id).get(request_headers: headers) @@ -1249,7 +1247,7 @@ def test_mail_send_post }') headers = JSON.parse('{"X-Mock": 202}') - response = @sg.client.mail._("send").post(request_body: data, request_headers: headers) + response = @sg.client.mail._('send').post(request_body: data, request_headers: headers) assert_equal('202', response.status_code) end @@ -1515,13 +1513,13 @@ def test_senders_post }') headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.senders.post(request_body: data, request_headers: headers) - assert_equal(response.status_code, "201") + assert_equal(response.status_code, '201') end def test_senders_get headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.senders.get(request_headers: headers) - assert_equal(response.status_code, "200") + assert_equal(response.status_code, '200') end def test_senders__sender_id__patch @@ -1542,31 +1540,31 @@ def test_senders__sender_id__patch "state": "Colorado", "zip": "80202" }') - sender_id = "test_url_param" + sender_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.senders._(sender_id).patch(request_body: data, request_headers: headers) - assert_equal(response.status_code, "200") + assert_equal(response.status_code, '200') end def test_senders__sender_id__get - sender_id = "test_url_param" + sender_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.senders._(sender_id).get(request_headers: headers) - assert_equal(response.status_code, "200") + assert_equal(response.status_code, '200') end def test_senders__sender_id__delete - sender_id = "test_url_param" + sender_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.senders._(sender_id).delete(request_headers: headers) - assert_equal(response.status_code, "204") + assert_equal(response.status_code, '204') end def test_senders__sender_id__resend_verification_post - sender_id = "test_url_param" + sender_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.senders._(sender_id).resend_verification.post(request_headers: headers) - assert_equal(response.status_code, "204") + assert_equal(response.status_code, '204') end def test_stats_get @@ -1644,7 +1642,7 @@ def test_subusers__subuser_name__patch data = JSON.parse('{ "disabled": false }') - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.subusers._(subuser_name).patch(request_body: data, request_headers: headers) @@ -1653,7 +1651,7 @@ def test_subusers__subuser_name__patch end def test_subusers__subuser_name__delete - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.subusers._(subuser_name).delete(request_headers: headers) @@ -1665,7 +1663,7 @@ def test_subusers__subuser_name__ips_put data = JSON.parse('[ "127.0.0.1" ]') - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.subusers._(subuser_name).ips.put(request_body: data, request_headers: headers) @@ -1678,7 +1676,7 @@ def test_subusers__subuser_name__monitor_put "email": "example@example.com", "frequency": 500 }') - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.subusers._(subuser_name).monitor.put(request_body: data, request_headers: headers) @@ -1691,7 +1689,7 @@ def test_subusers__subuser_name__monitor_post "email": "example@example.com", "frequency": 50000 }') - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.subusers._(subuser_name).monitor.post(request_body: data, request_headers: headers) @@ -1700,7 +1698,7 @@ def test_subusers__subuser_name__monitor_post end def test_subusers__subuser_name__monitor_get - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.subusers._(subuser_name).monitor.get(request_headers: headers) @@ -1709,7 +1707,7 @@ def test_subusers__subuser_name__monitor_get end def test_subusers__subuser_name__monitor_delete - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.subusers._(subuser_name).monitor.delete(request_headers: headers) @@ -1719,7 +1717,7 @@ def test_subusers__subuser_name__monitor_delete def test_subusers__subuser_name__stats_monthly_get params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}') - subuser_name = "test_url_param" + subuser_name = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params, request_headers: headers) @@ -1752,7 +1750,7 @@ def test_suppression_blocks_delete end def test_suppression_blocks__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.suppression.blocks._(email).get(request_headers: headers) @@ -1761,7 +1759,7 @@ def test_suppression_blocks__email__get end def test_suppression_blocks__email__delete - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.suppression.blocks._(email).delete(request_headers: headers) @@ -1794,7 +1792,7 @@ def test_suppression_bounces_delete end def test_suppression_bounces__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.suppression.bounces._(email).get(request_headers: headers) @@ -1804,7 +1802,7 @@ def test_suppression_bounces__email__get def test_suppression_bounces__email__delete params = JSON.parse('{"email_address": "example@example.com"}') - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.suppression.bounces._(email).delete(query_params: params, request_headers: headers) @@ -1837,7 +1835,7 @@ def test_suppression_invalid_emails_delete end def test_suppression_invalid_emails__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.suppression.invalid_emails._(email).get(request_headers: headers) @@ -1846,7 +1844,7 @@ def test_suppression_invalid_emails__email__get end def test_suppression_invalid_emails__email__delete - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.suppression.invalid_emails._(email).delete(request_headers: headers) @@ -1855,7 +1853,7 @@ def test_suppression_invalid_emails__email__delete end def test_suppression_spam_report__email__get - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.suppression.spam_reports._(email).get(request_headers: headers) @@ -1864,10 +1862,10 @@ def test_suppression_spam_report__email__get end def test_suppression_spam_report__email__delete - email = "test_url_param" + email = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') - response = @sg.client.suppression.spam_reports._(email).delete(request_headers: headers) + response = @sg.client.suppression.spam_reports._(email).delete(request_headers: headers) assert_equal('204', response.status_code) end @@ -1928,7 +1926,7 @@ def test_templates__template_id__patch data = JSON.parse('{ "name": "new_example_name" }') - template_id = "test_url_param" + template_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.templates._(template_id).patch(request_body: data, request_headers: headers) @@ -1937,7 +1935,7 @@ def test_templates__template_id__patch end def test_templates__template_id__get - template_id = "test_url_param" + template_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.templates._(template_id).get(request_headers: headers) @@ -1946,7 +1944,7 @@ def test_templates__template_id__get end def test_templates__template_id__delete - template_id = "test_url_param" + template_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.templates._(template_id).delete(request_headers: headers) @@ -1963,7 +1961,7 @@ def test_templates__template_id__versions_post "subject": "<%subject%>", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" }') - template_id = "test_url_param" + template_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.templates._(template_id).versions.post(request_body: data, request_headers: headers) @@ -1979,8 +1977,8 @@ def test_templates__template_id__versions__version_id__patch "plain_content": "<%body%>", "subject": "<%subject%>" }') - template_id = "test_url_param" - version_id = "test_url_param" + template_id = 'test_url_param' + version_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.templates._(template_id).versions._(version_id).patch(request_body: data, request_headers: headers) @@ -1989,8 +1987,8 @@ def test_templates__template_id__versions__version_id__patch end def test_templates__template_id__versions__version_id__get - template_id = "test_url_param" - version_id = "test_url_param" + template_id = 'test_url_param' + version_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.templates._(template_id).versions._(version_id).get(request_headers: headers) @@ -1999,8 +1997,8 @@ def test_templates__template_id__versions__version_id__get end def test_templates__template_id__versions__version_id__delete - template_id = "test_url_param" - version_id = "test_url_param" + template_id = 'test_url_param' + version_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.templates._(template_id).versions._(version_id).delete(request_headers: headers) @@ -2009,8 +2007,8 @@ def test_templates__template_id__versions__version_id__delete end def test_templates__template_id__versions__version_id__activate_post - template_id = "test_url_param" - version_id = "test_url_param" + template_id = 'test_url_param' + version_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.templates._(template_id).versions._(version_id).activate.post(request_headers: headers) @@ -2205,7 +2203,7 @@ def test_user_scheduled_sends__batch_id__patch data = JSON.parse('{ "status": "pause" }') - batch_id = "test_url_param" + batch_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.user.scheduled_sends._(batch_id).patch(request_body: data, request_headers: headers) @@ -2214,7 +2212,7 @@ def test_user_scheduled_sends__batch_id__patch end def test_user_scheduled_sends__batch_id__get - batch_id = "test_url_param" + batch_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.user.scheduled_sends._(batch_id).get(request_headers: headers) @@ -2223,7 +2221,7 @@ def test_user_scheduled_sends__batch_id__get end def test_user_scheduled_sends__batch_id__delete - batch_id = "test_url_param" + batch_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.user.scheduled_sends._(batch_id).delete(request_headers: headers) @@ -2340,7 +2338,7 @@ def test_user_webhooks_parse_settings__hostname__patch "spam_check": false, "url": "http://newdomain.com/parse" }') - hostname = "test_url_param" + hostname = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data, request_headers: headers) @@ -2349,7 +2347,7 @@ def test_user_webhooks_parse_settings__hostname__patch end def test_user_webhooks_parse_settings__hostname__get - hostname = "test_url_param" + hostname = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.user.webhooks.parse.settings._(hostname).get(request_headers: headers) @@ -2358,7 +2356,7 @@ def test_user_webhooks_parse_settings__hostname__get end def test_user_webhooks_parse_settings__hostname__delete - hostname = "test_url_param" + hostname = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.user.webhooks.parse.settings._(hostname).delete(request_headers: headers) @@ -2433,7 +2431,7 @@ def test_whitelabel_domains__domain_id__patch "custom_spf": true, "default": false }') - domain_id = "test_url_param" + domain_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.domains._(domain_id).patch(request_body: data, request_headers: headers) @@ -2442,7 +2440,7 @@ def test_whitelabel_domains__domain_id__patch end def test_whitelabel_domains__domain_id__get - domain_id = "test_url_param" + domain_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.domains._(domain_id).get(request_headers: headers) @@ -2451,7 +2449,7 @@ def test_whitelabel_domains__domain_id__get end def test_whitelabel_domains__domain_id__delete - domain_id = "test_url_param" + domain_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.whitelabel.domains._(domain_id).delete(request_headers: headers) @@ -2463,7 +2461,7 @@ def test_whitelabel_domains__domain_id__subuser_post data = JSON.parse('{ "username": "jane@example.com" }') - domain_id = "test_url_param" + domain_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 201}') response = @sg.client.whitelabel.domains._(domain_id).subuser.post(request_body: data, request_headers: headers) @@ -2475,7 +2473,7 @@ def test_whitelabel_domains__id__ips_post data = JSON.parse('{ "ip": "192.168.0.1" }') - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.domains._(id).ips.post(request_body: data, request_headers: headers) @@ -2484,8 +2482,8 @@ def test_whitelabel_domains__id__ips_post end def test_whitelabel_domains__id__ips__ip__delete - id = "test_url_param" - ip = "test_url_param" + id = 'test_url_param' + ip = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.domains._(id).ips._(ip).delete(request_headers: headers) @@ -2494,7 +2492,7 @@ def test_whitelabel_domains__id__ips__ip__delete end def test_whitelabel_domains__id__validate_post - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.domains._(id).validate.post(request_headers: headers) @@ -2525,7 +2523,7 @@ def test_whitelabel_ips_get end def test_whitelabel_ips__id__get - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.ips._(id).get(request_headers: headers) @@ -2534,7 +2532,7 @@ def test_whitelabel_ips__id__get end def test_whitelabel_ips__id__delete - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.whitelabel.ips._(id).delete(request_headers: headers) @@ -2543,7 +2541,7 @@ def test_whitelabel_ips__id__delete end def test_whitelabel_ips__id__validate_post - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.ips._(id).validate.post(request_headers: headers) @@ -2605,7 +2603,7 @@ def test_whitelabel_links__id__patch data = JSON.parse('{ "default": true }') - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.links._(id).patch(request_body: data, request_headers: headers) @@ -2614,7 +2612,7 @@ def test_whitelabel_links__id__patch end def test_whitelabel_links__id__get - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.links._(id).get(request_headers: headers) @@ -2623,7 +2621,7 @@ def test_whitelabel_links__id__get end def test_whitelabel_links__id__delete - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 204}') response = @sg.client.whitelabel.links._(id).delete(request_headers: headers) @@ -2632,7 +2630,7 @@ def test_whitelabel_links__id__delete end def test_whitelabel_links__id__validate_post - id = "test_url_param" + id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.links._(id).validate.post(request_headers: headers) @@ -2644,7 +2642,7 @@ def test_whitelabel_links__link_id__subuser_post data = JSON.parse('{ "username": "jane@example.com" }') - link_id = "test_url_param" + link_id = 'test_url_param' headers = JSON.parse('{"X-Mock": 200}') response = @sg.client.whitelabel.links._(link_id).subuser.post(request_body: data, request_headers: headers)