sendgrid-ruby 6.3.1 → 6.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +109 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.md +61 -9
- data/CONTRIBUTING.md +10 -20
- data/FIRST_TIMERS.md +79 -0
- data/ISSUE_TEMPLATE.md +5 -1
- data/Makefile +3 -2
- data/PULL_REQUEST_TEMPLATE.md +1 -1
- data/README.md +22 -27
- data/Rakefile +2 -3
- data/TROUBLESHOOTING.md +5 -5
- data/USAGE.md +145 -38
- data/examples/accesssettings/accesssettings.rb +9 -12
- data/examples/alerts/alerts.rb +8 -11
- data/examples/apikeys/apikeys.rb +12 -15
- data/examples/asm/asm.rb +27 -30
- data/examples/browsers/browsers.rb +0 -3
- data/examples/campaigns/campaigns.rb +29 -32
- data/examples/categories/categories.rb +0 -3
- data/examples/clients/clients.rb +1 -4
- data/examples/contactdb/contactdb.rb +63 -66
- data/examples/devices/devices.rb +0 -3
- data/examples/emailactivity/emailactivity.rb +52 -0
- data/examples/geo/geo.rb +0 -3
- data/examples/helpers/eventwebhook/example.rb +4 -4
- data/examples/helpers/mail/example.rb +19 -13
- data/examples/helpers/settings/example.rb +1 -1
- data/examples/helpers/stats/example.rb +4 -4
- data/examples/ips/ips.rb +19 -22
- data/examples/mail/mail.rb +72 -75
- data/examples/mailboxproviders/mailboxproviders.rb +0 -3
- data/examples/mailsettings/mailsettings.rb +21 -24
- data/examples/partnersettings/partnersettings.rb +3 -6
- data/examples/scopes/scopes.rb +7 -9
- data/examples/senderauthentication/senderauthentication.rb +41 -44
- data/examples/senders/senders.rb +28 -31
- data/examples/stats/stats.rb +0 -3
- data/examples/subusers/subusers.rb +17 -20
- data/examples/suppression/suppression.rb +15 -18
- data/examples/templates/templates.rb +29 -31
- data/examples/trackingsettings/trackingsettings.rb +14 -17
- data/examples/user/user.rb +41 -44
- data/lib/rack/sendgrid_webhook_verification.rb +5 -2
- data/lib/sendgrid/base_interface.rb +1 -1
- data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +4 -6
- data/lib/sendgrid/helpers/inbound/README.md +5 -5
- data/lib/sendgrid/helpers/inbound/app.rb +1 -1
- data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
- data/lib/sendgrid/helpers/inbound/send.rb +2 -2
- data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
- data/lib/sendgrid/helpers/mail/README.md +3 -3
- data/lib/sendgrid/helpers/mail/asm.rb +6 -18
- data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
- data/lib/sendgrid/helpers/mail/category.rb +2 -2
- data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/content.rb +4 -3
- data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
- data/lib/sendgrid/helpers/mail/email.rb +5 -4
- data/lib/sendgrid/helpers/mail/footer.rb +7 -27
- data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
- data/lib/sendgrid/helpers/mail/header.rb +6 -10
- data/lib/sendgrid/helpers/mail/mail.rb +30 -48
- data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
- data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/personalization.rb +34 -27
- data/lib/sendgrid/helpers/mail/section.rb +6 -10
- data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
- data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +7 -20
- data/lib/sendgrid/helpers/permissions/scope.rb +1 -1
- data/lib/sendgrid/helpers/settings/README.md +2 -2
- data/lib/sendgrid/helpers/settings/settings.rb +1 -1
- data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
- data/lib/sendgrid/helpers/stats/metrics.rb +5 -5
- data/lib/sendgrid/sendgrid.rb +1 -1
- data/lib/sendgrid/twilio_email.rb +1 -1
- data/lib/sendgrid/version.rb +1 -1
- data/mail_helper_v3.md +12 -12
- data/sendgrid-ruby.gemspec +8 -8
- data/spec/fixtures/event_webhook.rb +17 -11
- data/spec/rack/sendgrid_webhook_verification_spec.rb +30 -4
- data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +38 -36
- data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
- data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
- data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
- data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
- data/spec/spec_helper.rb +3 -1
- data/static/img/github-fork.png +0 -0
- data/static/img/github-sign-up.png +0 -0
- data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
- data/test/sendgrid/helpers/mail/test_category.rb +0 -2
- data/test/sendgrid/helpers/mail/test_email.rb +9 -11
- data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
- data/test/sendgrid/helpers/mail/test_personalizations.rb +106 -93
- data/test/sendgrid/permissions/test_scopes.rb +0 -2
- data/test/sendgrid/test_sendgrid-ruby.rb +1948 -1958
- data/twilio_sendgrid_logo.png +0 -0
- data/use-cases/README.md +16 -0
- data/use-cases/domain-authentication.md +5 -0
- data/use-cases/email-statistics.md +52 -0
- data/use-cases/legacy-templates.md +98 -0
- data/use-cases/sms.md +39 -0
- data/use-cases/transactional-templates.md +111 -0
- data/use-cases/twilio-email.md +13 -0
- data/use-cases/twilio-setup.md +54 -0
- metadata +53 -28
- data/USE_CASES.md +0 -405
- data/docker/Dockerfile +0 -12
- data/docker/README.md +0 -30
data/examples/senders/senders.rb
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
require 'sendgrid-ruby'
|
2
2
|
|
3
|
-
|
4
3
|
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
4
|
|
6
|
-
|
7
5
|
##################################################
|
8
6
|
# Create a Sender Identity #
|
9
7
|
# POST /senders #
|
10
8
|
|
11
9
|
data = JSON.parse('{
|
12
|
-
"address": "123 Elm St.",
|
13
|
-
"address_2": "Apt. 456",
|
14
|
-
"city": "Denver",
|
15
|
-
"country": "United States",
|
10
|
+
"address": "123 Elm St.",
|
11
|
+
"address_2": "Apt. 456",
|
12
|
+
"city": "Denver",
|
13
|
+
"country": "United States",
|
16
14
|
"from": {
|
17
|
-
"email": "from@example.com",
|
15
|
+
"email": "from@example.com",
|
18
16
|
"name": "Example INC"
|
19
|
-
},
|
20
|
-
"nickname": "My Sender ID",
|
17
|
+
},
|
18
|
+
"nickname": "My Sender ID",
|
21
19
|
"reply_to": {
|
22
|
-
"email": "replyto@example.com",
|
20
|
+
"email": "replyto@example.com",
|
23
21
|
"name": "Example INC"
|
24
|
-
},
|
25
|
-
"state": "Colorado",
|
22
|
+
},
|
23
|
+
"state": "Colorado",
|
26
24
|
"zip": "80202"
|
27
25
|
}')
|
28
26
|
response = sg.client.senders.post(request_body: data)
|
@@ -34,7 +32,7 @@ puts response.headers
|
|
34
32
|
# Get all Sender Identities #
|
35
33
|
# GET /senders #
|
36
34
|
|
37
|
-
response = sg.client.senders.get
|
35
|
+
response = sg.client.senders.get
|
38
36
|
puts response.status_code
|
39
37
|
puts response.body
|
40
38
|
puts response.headers
|
@@ -44,23 +42,23 @@ puts response.headers
|
|
44
42
|
# PATCH /senders/{sender_id} #
|
45
43
|
|
46
44
|
data = JSON.parse('{
|
47
|
-
"address": "123 Elm St.",
|
48
|
-
"address_2": "Apt. 456",
|
49
|
-
"city": "Denver",
|
50
|
-
"country": "United States",
|
45
|
+
"address": "123 Elm St.",
|
46
|
+
"address_2": "Apt. 456",
|
47
|
+
"city": "Denver",
|
48
|
+
"country": "United States",
|
51
49
|
"from": {
|
52
|
-
"email": "from@example.com",
|
50
|
+
"email": "from@example.com",
|
53
51
|
"name": "Example INC"
|
54
|
-
},
|
55
|
-
"nickname": "My Sender ID",
|
52
|
+
},
|
53
|
+
"nickname": "My Sender ID",
|
56
54
|
"reply_to": {
|
57
|
-
"email": "replyto@example.com",
|
55
|
+
"email": "replyto@example.com",
|
58
56
|
"name": "Example INC"
|
59
|
-
},
|
60
|
-
"state": "Colorado",
|
57
|
+
},
|
58
|
+
"state": "Colorado",
|
61
59
|
"zip": "80202"
|
62
60
|
}')
|
63
|
-
sender_id =
|
61
|
+
sender_id = 'test_url_param'
|
64
62
|
response = sg.client.senders._(sender_id).patch(request_body: data)
|
65
63
|
puts response.status_code
|
66
64
|
puts response.body
|
@@ -70,8 +68,8 @@ puts response.headers
|
|
70
68
|
# View a Sender Identity #
|
71
69
|
# GET /senders/{sender_id} #
|
72
70
|
|
73
|
-
sender_id =
|
74
|
-
response = sg.client.senders._(sender_id).get
|
71
|
+
sender_id = 'test_url_param'
|
72
|
+
response = sg.client.senders._(sender_id).get
|
75
73
|
puts response.status_code
|
76
74
|
puts response.body
|
77
75
|
puts response.headers
|
@@ -80,8 +78,8 @@ puts response.headers
|
|
80
78
|
# Delete a Sender Identity #
|
81
79
|
# DELETE /senders/{sender_id} #
|
82
80
|
|
83
|
-
sender_id =
|
84
|
-
response = sg.client.senders._(sender_id).delete
|
81
|
+
sender_id = 'test_url_param'
|
82
|
+
response = sg.client.senders._(sender_id).delete
|
85
83
|
puts response.status_code
|
86
84
|
puts response.body
|
87
85
|
puts response.headers
|
@@ -90,9 +88,8 @@ puts response.headers
|
|
90
88
|
# Resend Sender Identity Verification #
|
91
89
|
# POST /senders/{sender_id}/resend_verification #
|
92
90
|
|
93
|
-
sender_id =
|
94
|
-
response = sg.client.senders._(sender_id).resend_verification.post
|
91
|
+
sender_id = 'test_url_param'
|
92
|
+
response = sg.client.senders._(sender_id).resend_verification.post
|
95
93
|
puts response.status_code
|
96
94
|
puts response.body
|
97
95
|
puts response.headers
|
98
|
-
|
data/examples/stats/stats.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'sendgrid-ruby'
|
2
2
|
|
3
|
-
|
4
3
|
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
4
|
|
6
|
-
|
7
5
|
##################################################
|
8
6
|
# Retrieve global email statistics #
|
9
7
|
# GET /stats #
|
@@ -13,4 +11,3 @@ response = sg.client.stats.get(query_params: params)
|
|
13
11
|
puts response.status_code
|
14
12
|
puts response.body
|
15
13
|
puts response.headers
|
16
|
-
|
@@ -1,20 +1,18 @@
|
|
1
1
|
require 'sendgrid-ruby'
|
2
2
|
|
3
|
-
|
4
3
|
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
4
|
|
6
|
-
|
7
5
|
##################################################
|
8
6
|
# Create Subuser #
|
9
7
|
# POST /subusers #
|
10
8
|
|
11
9
|
data = JSON.parse('{
|
12
|
-
"email": "John@example.com",
|
10
|
+
"email": "John@example.com",
|
13
11
|
"ips": [
|
14
|
-
"1.1.1.1",
|
12
|
+
"1.1.1.1",
|
15
13
|
"2.2.2.2"
|
16
|
-
],
|
17
|
-
"password": "johns_password",
|
14
|
+
],
|
15
|
+
"password": "johns_password",
|
18
16
|
"username": "John@example.com"
|
19
17
|
}')
|
20
18
|
response = sg.client.subusers.post(request_body: data)
|
@@ -79,7 +77,7 @@ puts response.headers
|
|
79
77
|
data = JSON.parse('{
|
80
78
|
"disabled": false
|
81
79
|
}')
|
82
|
-
subuser_name =
|
80
|
+
subuser_name = 'test_url_param'
|
83
81
|
response = sg.client.subusers._(subuser_name).patch(request_body: data)
|
84
82
|
puts response.status_code
|
85
83
|
puts response.body
|
@@ -89,8 +87,8 @@ puts response.headers
|
|
89
87
|
# Delete a subuser #
|
90
88
|
# DELETE /subusers/{subuser_name} #
|
91
89
|
|
92
|
-
subuser_name =
|
93
|
-
response = sg.client.subusers._(subuser_name).delete
|
90
|
+
subuser_name = 'test_url_param'
|
91
|
+
response = sg.client.subusers._(subuser_name).delete
|
94
92
|
puts response.status_code
|
95
93
|
puts response.body
|
96
94
|
puts response.headers
|
@@ -102,7 +100,7 @@ puts response.headers
|
|
102
100
|
data = JSON.parse('[
|
103
101
|
"127.0.0.1"
|
104
102
|
]')
|
105
|
-
subuser_name =
|
103
|
+
subuser_name = 'test_url_param'
|
106
104
|
response = sg.client.subusers._(subuser_name).ips.put(request_body: data)
|
107
105
|
puts response.status_code
|
108
106
|
puts response.body
|
@@ -113,10 +111,10 @@ puts response.headers
|
|
113
111
|
# PUT /subusers/{subuser_name}/monitor #
|
114
112
|
|
115
113
|
data = JSON.parse('{
|
116
|
-
"email": "example@example.com",
|
114
|
+
"email": "example@example.com",
|
117
115
|
"frequency": 500
|
118
116
|
}')
|
119
|
-
subuser_name =
|
117
|
+
subuser_name = 'test_url_param'
|
120
118
|
response = sg.client.subusers._(subuser_name).monitor.put(request_body: data)
|
121
119
|
puts response.status_code
|
122
120
|
puts response.body
|
@@ -127,10 +125,10 @@ puts response.headers
|
|
127
125
|
# POST /subusers/{subuser_name}/monitor #
|
128
126
|
|
129
127
|
data = JSON.parse('{
|
130
|
-
"email": "example@example.com",
|
128
|
+
"email": "example@example.com",
|
131
129
|
"frequency": 50000
|
132
130
|
}')
|
133
|
-
subuser_name =
|
131
|
+
subuser_name = 'test_url_param'
|
134
132
|
response = sg.client.subusers._(subuser_name).monitor.post(request_body: data)
|
135
133
|
puts response.status_code
|
136
134
|
puts response.body
|
@@ -140,8 +138,8 @@ puts response.headers
|
|
140
138
|
# Retrieve monitor settings for a subuser #
|
141
139
|
# GET /subusers/{subuser_name}/monitor #
|
142
140
|
|
143
|
-
subuser_name =
|
144
|
-
response = sg.client.subusers._(subuser_name).monitor.get
|
141
|
+
subuser_name = 'test_url_param'
|
142
|
+
response = sg.client.subusers._(subuser_name).monitor.get
|
145
143
|
puts response.status_code
|
146
144
|
puts response.body
|
147
145
|
puts response.headers
|
@@ -150,8 +148,8 @@ puts response.headers
|
|
150
148
|
# Delete monitor settings #
|
151
149
|
# DELETE /subusers/{subuser_name}/monitor #
|
152
150
|
|
153
|
-
subuser_name =
|
154
|
-
response = sg.client.subusers._(subuser_name).monitor.delete
|
151
|
+
subuser_name = 'test_url_param'
|
152
|
+
response = sg.client.subusers._(subuser_name).monitor.delete
|
155
153
|
puts response.status_code
|
156
154
|
puts response.body
|
157
155
|
puts response.headers
|
@@ -161,9 +159,8 @@ puts response.headers
|
|
161
159
|
# GET /subusers/{subuser_name}/stats/monthly #
|
162
160
|
|
163
161
|
params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
|
164
|
-
subuser_name =
|
162
|
+
subuser_name = 'test_url_param'
|
165
163
|
response = sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params)
|
166
164
|
puts response.status_code
|
167
165
|
puts response.body
|
168
166
|
puts response.headers
|
169
|
-
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'sendgrid-ruby'
|
2
2
|
|
3
|
-
|
4
3
|
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
4
|
|
6
|
-
|
7
5
|
##################################################
|
8
6
|
# Retrieve all blocks #
|
9
7
|
# GET /suppression/blocks #
|
@@ -34,8 +32,8 @@ puts response.headers
|
|
34
32
|
# Retrieve a specific block #
|
35
33
|
# GET /suppression/blocks/{email} #
|
36
34
|
|
37
|
-
email =
|
38
|
-
response = sg.client.suppression.blocks._(email).get
|
35
|
+
email = 'test_url_param'
|
36
|
+
response = sg.client.suppression.blocks._(email).get
|
39
37
|
puts response.status_code
|
40
38
|
puts response.body
|
41
39
|
puts response.headers
|
@@ -44,8 +42,8 @@ puts response.headers
|
|
44
42
|
# Delete a specific block #
|
45
43
|
# DELETE /suppression/blocks/{email} #
|
46
44
|
|
47
|
-
email =
|
48
|
-
response = sg.client.suppression.blocks._(email).delete
|
45
|
+
email = 'test_url_param'
|
46
|
+
response = sg.client.suppression.blocks._(email).delete
|
49
47
|
puts response.status_code
|
50
48
|
puts response.body
|
51
49
|
puts response.headers
|
@@ -80,8 +78,8 @@ puts response.headers
|
|
80
78
|
# Retrieve a Bounce #
|
81
79
|
# GET /suppression/bounces/{email} #
|
82
80
|
|
83
|
-
email =
|
84
|
-
response = sg.client.suppression.bounces._(email).get
|
81
|
+
email = 'test_url_param'
|
82
|
+
response = sg.client.suppression.bounces._(email).get
|
85
83
|
puts response.status_code
|
86
84
|
puts response.body
|
87
85
|
puts response.headers
|
@@ -91,7 +89,7 @@ puts response.headers
|
|
91
89
|
# DELETE /suppression/bounces/{email} #
|
92
90
|
|
93
91
|
params = JSON.parse('{"email_address": "example@example.com"}')
|
94
|
-
email =
|
92
|
+
email = 'test_url_param'
|
95
93
|
response = sg.client.suppression.bounces._(email).delete(query_params: params)
|
96
94
|
puts response.status_code
|
97
95
|
puts response.body
|
@@ -127,8 +125,8 @@ puts response.headers
|
|
127
125
|
# Retrieve a specific invalid email #
|
128
126
|
# GET /suppression/invalid_emails/{email} #
|
129
127
|
|
130
|
-
email =
|
131
|
-
response = sg.client.suppression.invalid_emails._(email).get
|
128
|
+
email = 'test_url_param'
|
129
|
+
response = sg.client.suppression.invalid_emails._(email).get
|
132
130
|
puts response.status_code
|
133
131
|
puts response.body
|
134
132
|
puts response.headers
|
@@ -137,8 +135,8 @@ puts response.headers
|
|
137
135
|
# Delete a specific invalid email #
|
138
136
|
# DELETE /suppression/invalid_emails/{email} #
|
139
137
|
|
140
|
-
email =
|
141
|
-
response = sg.client.suppression.invalid_emails._(email).delete
|
138
|
+
email = 'test_url_param'
|
139
|
+
response = sg.client.suppression.invalid_emails._(email).delete
|
142
140
|
puts response.status_code
|
143
141
|
puts response.body
|
144
142
|
puts response.headers
|
@@ -147,8 +145,8 @@ puts response.headers
|
|
147
145
|
# Retrieve a specific spam report #
|
148
146
|
# GET /suppression/spam_report/{email} #
|
149
147
|
|
150
|
-
email =
|
151
|
-
response = sg.client.suppression.
|
148
|
+
email = 'test_url_param'
|
149
|
+
response = sg.client.suppression.spam_report._(email).get
|
152
150
|
puts response.status_code
|
153
151
|
puts response.body
|
154
152
|
puts response.headers
|
@@ -157,8 +155,8 @@ puts response.headers
|
|
157
155
|
# Delete a specific spam report #
|
158
156
|
# DELETE /suppression/spam_report/{email} #
|
159
157
|
|
160
|
-
email =
|
161
|
-
response = sg.client.suppression.spam_reports._(email).delete
|
158
|
+
email = 'test_url_param'
|
159
|
+
response = sg.client.suppression.spam_reports._(email).delete
|
162
160
|
puts response.status_code
|
163
161
|
puts response.body
|
164
162
|
puts response.headers
|
@@ -198,4 +196,3 @@ response = sg.client.suppression.unsubscribes.get(query_params: params)
|
|
198
196
|
puts response.status_code
|
199
197
|
puts response.body
|
200
198
|
puts response.headers
|
201
|
-
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'sendgrid-ruby'
|
2
2
|
|
3
|
-
|
4
3
|
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
4
|
|
6
|
-
|
7
5
|
##################################################
|
8
6
|
# Create a transactional template. #
|
9
7
|
# POST /templates #
|
@@ -17,10 +15,11 @@ puts response.body
|
|
17
15
|
puts response.headers
|
18
16
|
|
19
17
|
##################################################
|
20
|
-
# Retrieve all transactional templates. #
|
18
|
+
# Retrieve all transactional templates (legacy & dynamic). #
|
21
19
|
# GET /templates #
|
22
20
|
|
23
|
-
|
21
|
+
params = JSON.parse('{"generations": "legacy,dynamic"}')
|
22
|
+
response = sg.client.templates.get(query_params: params)
|
24
23
|
puts response.status_code
|
25
24
|
puts response.body
|
26
25
|
puts response.headers
|
@@ -32,7 +31,7 @@ puts response.headers
|
|
32
31
|
data = JSON.parse('{
|
33
32
|
"name": "new_example_name"
|
34
33
|
}')
|
35
|
-
template_id =
|
34
|
+
template_id = 'test_url_param'
|
36
35
|
response = sg.client.templates._(template_id).patch(request_body: data)
|
37
36
|
puts response.status_code
|
38
37
|
puts response.body
|
@@ -42,8 +41,8 @@ puts response.headers
|
|
42
41
|
# Retrieve a single transactional template. #
|
43
42
|
# GET /templates/{template_id} #
|
44
43
|
|
45
|
-
template_id =
|
46
|
-
response = sg.client.templates._(template_id).get
|
44
|
+
template_id = 'test_url_param'
|
45
|
+
response = sg.client.templates._(template_id).get
|
47
46
|
puts response.status_code
|
48
47
|
puts response.body
|
49
48
|
puts response.headers
|
@@ -52,8 +51,8 @@ puts response.headers
|
|
52
51
|
# Delete a template. #
|
53
52
|
# DELETE /templates/{template_id} #
|
54
53
|
|
55
|
-
template_id =
|
56
|
-
response = sg.client.templates._(template_id).delete
|
54
|
+
template_id = 'test_url_param'
|
55
|
+
response = sg.client.templates._(template_id).delete
|
57
56
|
puts response.status_code
|
58
57
|
puts response.body
|
59
58
|
puts response.headers
|
@@ -63,14 +62,14 @@ puts response.headers
|
|
63
62
|
# POST /templates/{template_id}/versions #
|
64
63
|
|
65
64
|
data = JSON.parse('{
|
66
|
-
"active": 1,
|
67
|
-
"html_content": "<%body%>",
|
68
|
-
"name": "example_version_name",
|
69
|
-
"plain_content": "<%body%>",
|
70
|
-
"subject": "<%subject%>",
|
65
|
+
"active": 1,
|
66
|
+
"html_content": "<%body%>",
|
67
|
+
"name": "example_version_name",
|
68
|
+
"plain_content": "<%body%>",
|
69
|
+
"subject": "<%subject%>",
|
71
70
|
"template_id": "ddb96bbc-9b92-425e-8979-99464621b543"
|
72
71
|
}')
|
73
|
-
template_id =
|
72
|
+
template_id = 'test_url_param'
|
74
73
|
response = sg.client.templates._(template_id).versions.post(request_body: data)
|
75
74
|
puts response.status_code
|
76
75
|
puts response.body
|
@@ -81,14 +80,14 @@ puts response.headers
|
|
81
80
|
# PATCH /templates/{template_id}/versions/{version_id} #
|
82
81
|
|
83
82
|
data = JSON.parse('{
|
84
|
-
"active": 1,
|
85
|
-
"html_content": "<%body%>",
|
86
|
-
"name": "updated_example_name",
|
87
|
-
"plain_content": "<%body%>",
|
83
|
+
"active": 1,
|
84
|
+
"html_content": "<%body%>",
|
85
|
+
"name": "updated_example_name",
|
86
|
+
"plain_content": "<%body%>",
|
88
87
|
"subject": "<%subject%>"
|
89
88
|
}')
|
90
|
-
template_id =
|
91
|
-
version_id =
|
89
|
+
template_id = 'test_url_param'
|
90
|
+
version_id = 'test_url_param'
|
92
91
|
response = sg.client.templates._(template_id).versions._(version_id).patch(request_body: data)
|
93
92
|
puts response.status_code
|
94
93
|
puts response.body
|
@@ -98,9 +97,9 @@ puts response.headers
|
|
98
97
|
# Retrieve a specific transactional template version. #
|
99
98
|
# GET /templates/{template_id}/versions/{version_id} #
|
100
99
|
|
101
|
-
template_id =
|
102
|
-
version_id =
|
103
|
-
response = sg.client.templates._(template_id).versions._(version_id).get
|
100
|
+
template_id = 'test_url_param'
|
101
|
+
version_id = 'test_url_param'
|
102
|
+
response = sg.client.templates._(template_id).versions._(version_id).get
|
104
103
|
puts response.status_code
|
105
104
|
puts response.body
|
106
105
|
puts response.headers
|
@@ -109,9 +108,9 @@ puts response.headers
|
|
109
108
|
# Delete a transactional template version. #
|
110
109
|
# DELETE /templates/{template_id}/versions/{version_id} #
|
111
110
|
|
112
|
-
template_id =
|
113
|
-
version_id =
|
114
|
-
response = sg.client.templates._(template_id).versions._(version_id).delete
|
111
|
+
template_id = 'test_url_param'
|
112
|
+
version_id = 'test_url_param'
|
113
|
+
response = sg.client.templates._(template_id).versions._(version_id).delete
|
115
114
|
puts response.status_code
|
116
115
|
puts response.body
|
117
116
|
puts response.headers
|
@@ -120,10 +119,9 @@ puts response.headers
|
|
120
119
|
# Activate a transactional template version. #
|
121
120
|
# POST /templates/{template_id}/versions/{version_id}/activate #
|
122
121
|
|
123
|
-
template_id =
|
124
|
-
version_id =
|
125
|
-
response = sg.client.templates._(template_id).versions._(version_id).activate.post
|
122
|
+
template_id = 'test_url_param'
|
123
|
+
version_id = 'test_url_param'
|
124
|
+
response = sg.client.templates._(template_id).versions._(version_id).activate.post
|
126
125
|
puts response.status_code
|
127
126
|
puts response.body
|
128
127
|
puts response.headers
|
129
|
-
|