sendgrid-ruby 1.1.6 → 6.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +21 -0
- data/.env_sample +1 -3
- data/.gitignore +1 -0
- data/.travis.yml +28 -17
- data/CHANGELOG.md +231 -1
- data/CODE_OF_CONDUCT.md +73 -0
- data/CONTRIBUTING.md +214 -0
- data/Gemfile +5 -4
- data/ISSUE_TEMPLATE.md +26 -0
- data/LICENSE.md +21 -0
- data/Makefile +7 -0
- data/PULL_REQUEST_TEMPLATE.md +31 -0
- data/README.md +161 -225
- data/Rakefile +9 -2
- data/TROUBLESHOOTING.md +137 -0
- data/UPGRADE.md +5 -0
- data/USAGE.md +5037 -0
- data/USE_CASES.md +377 -0
- data/config.ru +4 -0
- data/docker/Dockerfile +12 -0
- data/docker/README.md +30 -0
- data/examples/accesssettings/accesssettings.rb +83 -0
- data/examples/alerts/alerts.rb +62 -0
- data/examples/apikeys/apikeys.rb +84 -0
- data/examples/asm/asm.rb +173 -0
- data/examples/browsers/browsers.rb +16 -0
- data/examples/campaigns/campaigns.rb +153 -0
- data/examples/categories/categories.rb +36 -0
- data/examples/clients/clients.rb +27 -0
- data/examples/contactdb/contactdb.rb +395 -0
- data/examples/devices/devices.rb +16 -0
- data/examples/geo/geo.rb +16 -0
- data/examples/helpers/mail/example.rb +147 -0
- data/examples/helpers/settings/example.rb +23 -0
- data/examples/helpers/stats/example.rb +42 -0
- data/examples/ips/ips.rb +167 -0
- data/examples/mail/mail.rb +173 -0
- data/examples/mailboxproviders/mailboxproviders.rb +16 -0
- data/examples/mailsettings/mailsettings.rb +219 -0
- data/examples/partnersettings/partnersettings.rb +39 -0
- data/examples/scopes/scopes.rb +61 -0
- data/examples/senderauthentication/senderauthentication.rb +310 -0
- data/examples/senders/senders.rb +98 -0
- data/examples/stats/stats.rb +16 -0
- data/examples/subusers/subusers.rb +169 -0
- data/examples/suppression/suppression.rb +201 -0
- data/examples/templates/templates.rb +129 -0
- data/examples/trackingsettings/trackingsettings.rb +110 -0
- data/examples/user/user.rb +293 -0
- data/gemfiles/Sinatra_1.gemfile +6 -0
- data/gemfiles/Sinatra_2.gemfile +6 -0
- data/lib/sendgrid/client.rb +33 -57
- data/lib/sendgrid/helpers/inbound/README.md +98 -0
- data/lib/sendgrid/helpers/inbound/app.rb +32 -0
- data/lib/sendgrid/helpers/inbound/config.yml +26 -0
- data/lib/sendgrid/helpers/inbound/public/index.html +10 -0
- data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +58 -0
- data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +57 -0
- data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +298 -0
- data/lib/sendgrid/helpers/inbound/send.rb +26 -0
- data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
- data/lib/sendgrid/helpers/mail/README.md +14 -0
- data/lib/sendgrid/helpers/mail/asm.rb +33 -0
- data/lib/sendgrid/helpers/mail/attachment.rb +86 -0
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +33 -0
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +43 -0
- data/lib/sendgrid/helpers/mail/category.rb +20 -0
- data/lib/sendgrid/helpers/mail/click_tracking.rb +33 -0
- data/lib/sendgrid/helpers/mail/content.rb +20 -0
- data/lib/sendgrid/helpers/mail/custom_arg.rb +24 -0
- data/lib/sendgrid/helpers/mail/email.rb +29 -0
- data/lib/sendgrid/helpers/mail/footer.rb +43 -0
- data/lib/sendgrid/helpers/mail/ganalytics.rb +74 -0
- data/lib/sendgrid/helpers/mail/header.rb +24 -0
- data/lib/sendgrid/helpers/mail/mail.rb +140 -0
- data/lib/sendgrid/helpers/mail/mail_settings.rb +63 -0
- data/lib/sendgrid/helpers/mail/open_tracking.rb +33 -0
- data/lib/sendgrid/helpers/mail/personalization.rb +82 -0
- data/lib/sendgrid/helpers/mail/section.rb +24 -0
- data/lib/sendgrid/helpers/mail/spam_check.rb +43 -0
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +53 -0
- data/lib/sendgrid/helpers/mail/substitution.rb +24 -0
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +53 -0
- data/lib/sendgrid/helpers/permissions/scope.rb +28 -0
- data/lib/sendgrid/helpers/permissions/scopes.yml +309 -0
- data/lib/sendgrid/helpers/settings/README.md +14 -0
- data/lib/sendgrid/helpers/settings/mail_settings_dto.rb +13 -0
- data/lib/sendgrid/helpers/settings/partner_settings_dto.rb +13 -0
- data/lib/sendgrid/helpers/settings/settings.rb +28 -0
- data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +24 -0
- data/lib/sendgrid/helpers/settings/user_settings_dto.rb +13 -0
- data/lib/sendgrid/helpers/stats/email_stats.rb +46 -0
- data/lib/sendgrid/helpers/stats/metrics.rb +35 -0
- data/lib/sendgrid/helpers/stats/stats_response.rb +31 -0
- data/lib/sendgrid/version.rb +1 -1
- data/lib/sendgrid-ruby.rb +27 -6
- data/mail_helper_v3.md +390 -0
- data/sendgrid-ruby.gemspec +13 -17
- data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
- data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +32 -0
- data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +24 -0
- data/spec/sendgrid/helpers/settings/settings_spec.rb +25 -0
- data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +27 -0
- data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +24 -0
- data/spec/sendgrid/helpers/stats/email_stats_spec.rb +112 -0
- data/spec/sendgrid/helpers/stats/metrics_spec.rb +46 -0
- data/spec/sendgrid/helpers/stats/stats_response_spec.rb +76 -0
- data/spec/spec_helper.rb +10 -1
- data/test/prism.sh +42 -0
- data/test/sendgrid/helpers/mail/test_attachment.rb +35 -0
- data/test/sendgrid/helpers/mail/test_category.rb +27 -0
- data/test/sendgrid/helpers/mail/test_email.rb +34 -0
- data/test/sendgrid/helpers/mail/test_mail.rb +261 -0
- data/test/sendgrid/helpers/mail/test_personalizations.rb +161 -0
- data/test/sendgrid/permissions/test_scopes.rb +38 -0
- data/test/sendgrid/test_sendgrid-ruby.rb +2751 -0
- metadata +149 -115
- data/.rspec +0 -2
- data/.rubocop.yml +0 -30
- data/FETCH_HEAD +0 -0
- data/Guardfile +0 -10
- data/LICENSE.txt +0 -22
- data/example.rb +0 -41
- data/lib/sendgrid/exceptions.rb +0 -7
- data/lib/sendgrid/mail.rb +0 -182
- data/lib/sendgrid/recipient.rb +0 -29
- data/lib/sendgrid/response.rb +0 -14
- data/lib/sendgrid/template.rb +0 -26
- data/lib/sendgrid/template_mailer.rb +0 -59
- data/spec/lib/sendgrid/client_spec.rb +0 -87
- data/spec/lib/sendgrid/mail_spec.rb +0 -151
- data/spec/lib/sendgrid/recipient_spec.rb +0 -91
- data/spec/lib/sendgrid/template_mailer_spec.rb +0 -86
- data/spec/lib/sendgrid/template_spec.rb +0 -61
- data/spec/lib/sendgrid_spec.rb +0 -7
@@ -0,0 +1,201 @@
|
|
1
|
+
require 'sendgrid-ruby'
|
2
|
+
|
3
|
+
|
4
|
+
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
|
+
|
6
|
+
|
7
|
+
##################################################
|
8
|
+
# Retrieve all blocks #
|
9
|
+
# GET /suppression/blocks #
|
10
|
+
|
11
|
+
params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
|
12
|
+
response = sg.client.suppression.blocks.get(query_params: params)
|
13
|
+
puts response.status_code
|
14
|
+
puts response.body
|
15
|
+
puts response.headers
|
16
|
+
|
17
|
+
##################################################
|
18
|
+
# Delete blocks #
|
19
|
+
# DELETE /suppression/blocks #
|
20
|
+
|
21
|
+
data = JSON.parse('{
|
22
|
+
"delete_all": false,
|
23
|
+
"emails": [
|
24
|
+
"example1@example.com",
|
25
|
+
"example2@example.com"
|
26
|
+
]
|
27
|
+
}')
|
28
|
+
response = sg.client.suppression.blocks.delete(request_body: data)
|
29
|
+
puts response.status_code
|
30
|
+
puts response.body
|
31
|
+
puts response.headers
|
32
|
+
|
33
|
+
##################################################
|
34
|
+
# Retrieve a specific block #
|
35
|
+
# GET /suppression/blocks/{email} #
|
36
|
+
|
37
|
+
email = "test_url_param"
|
38
|
+
response = sg.client.suppression.blocks._(email).get()
|
39
|
+
puts response.status_code
|
40
|
+
puts response.body
|
41
|
+
puts response.headers
|
42
|
+
|
43
|
+
##################################################
|
44
|
+
# Delete a specific block #
|
45
|
+
# DELETE /suppression/blocks/{email} #
|
46
|
+
|
47
|
+
email = "test_url_param"
|
48
|
+
response = sg.client.suppression.blocks._(email).delete()
|
49
|
+
puts response.status_code
|
50
|
+
puts response.body
|
51
|
+
puts response.headers
|
52
|
+
|
53
|
+
##################################################
|
54
|
+
# Retrieve all bounces #
|
55
|
+
# GET /suppression/bounces #
|
56
|
+
|
57
|
+
params = JSON.parse('{"start_time": 1, "end_time": 1}')
|
58
|
+
response = sg.client.suppression.bounces.get(query_params: params)
|
59
|
+
puts response.status_code
|
60
|
+
puts response.body
|
61
|
+
puts response.headers
|
62
|
+
|
63
|
+
##################################################
|
64
|
+
# Delete bounces #
|
65
|
+
# DELETE /suppression/bounces #
|
66
|
+
|
67
|
+
data = JSON.parse('{
|
68
|
+
"delete_all": true,
|
69
|
+
"emails": [
|
70
|
+
"example@example.com",
|
71
|
+
"example2@example.com"
|
72
|
+
]
|
73
|
+
}')
|
74
|
+
response = sg.client.suppression.bounces.delete(request_body: data)
|
75
|
+
puts response.status_code
|
76
|
+
puts response.body
|
77
|
+
puts response.headers
|
78
|
+
|
79
|
+
##################################################
|
80
|
+
# Retrieve a Bounce #
|
81
|
+
# GET /suppression/bounces/{email} #
|
82
|
+
|
83
|
+
email = "test_url_param"
|
84
|
+
response = sg.client.suppression.bounces._(email).get()
|
85
|
+
puts response.status_code
|
86
|
+
puts response.body
|
87
|
+
puts response.headers
|
88
|
+
|
89
|
+
##################################################
|
90
|
+
# Delete a bounce #
|
91
|
+
# DELETE /suppression/bounces/{email} #
|
92
|
+
|
93
|
+
params = JSON.parse('{"email_address": "example@example.com"}')
|
94
|
+
email = "test_url_param"
|
95
|
+
response = sg.client.suppression.bounces._(email).delete(query_params: params)
|
96
|
+
puts response.status_code
|
97
|
+
puts response.body
|
98
|
+
puts response.headers
|
99
|
+
|
100
|
+
##################################################
|
101
|
+
# Retrieve all invalid emails #
|
102
|
+
# GET /suppression/invalid_emails #
|
103
|
+
|
104
|
+
params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
|
105
|
+
response = sg.client.suppression.invalid_emails.get(query_params: params)
|
106
|
+
puts response.status_code
|
107
|
+
puts response.body
|
108
|
+
puts response.headers
|
109
|
+
|
110
|
+
##################################################
|
111
|
+
# Delete invalid emails #
|
112
|
+
# DELETE /suppression/invalid_emails #
|
113
|
+
|
114
|
+
data = JSON.parse('{
|
115
|
+
"delete_all": false,
|
116
|
+
"emails": [
|
117
|
+
"example1@example.com",
|
118
|
+
"example2@example.com"
|
119
|
+
]
|
120
|
+
}')
|
121
|
+
response = sg.client.suppression.invalid_emails.delete(request_body: data)
|
122
|
+
puts response.status_code
|
123
|
+
puts response.body
|
124
|
+
puts response.headers
|
125
|
+
|
126
|
+
##################################################
|
127
|
+
# Retrieve a specific invalid email #
|
128
|
+
# GET /suppression/invalid_emails/{email} #
|
129
|
+
|
130
|
+
email = "test_url_param"
|
131
|
+
response = sg.client.suppression.invalid_emails._(email).get()
|
132
|
+
puts response.status_code
|
133
|
+
puts response.body
|
134
|
+
puts response.headers
|
135
|
+
|
136
|
+
##################################################
|
137
|
+
# Delete a specific invalid email #
|
138
|
+
# DELETE /suppression/invalid_emails/{email} #
|
139
|
+
|
140
|
+
email = "test_url_param"
|
141
|
+
response = sg.client.suppression.invalid_emails._(email).delete()
|
142
|
+
puts response.status_code
|
143
|
+
puts response.body
|
144
|
+
puts response.headers
|
145
|
+
|
146
|
+
##################################################
|
147
|
+
# Retrieve a specific spam report #
|
148
|
+
# GET /suppression/spam_report/{email} #
|
149
|
+
|
150
|
+
email = "test_url_param"
|
151
|
+
response = sg.client.suppression.spam_reports._(email).get()
|
152
|
+
puts response.status_code
|
153
|
+
puts response.body
|
154
|
+
puts response.headers
|
155
|
+
|
156
|
+
##################################################
|
157
|
+
# Delete a specific spam report #
|
158
|
+
# DELETE /suppression/spam_report/{email} #
|
159
|
+
|
160
|
+
email = "test_url_param"
|
161
|
+
response = sg.client.suppression.spam_reports._(email).delete()
|
162
|
+
puts response.status_code
|
163
|
+
puts response.body
|
164
|
+
puts response.headers
|
165
|
+
|
166
|
+
##################################################
|
167
|
+
# Retrieve all spam reports #
|
168
|
+
# GET /suppression/spam_reports #
|
169
|
+
|
170
|
+
params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
|
171
|
+
response = sg.client.suppression.spam_reports.get(query_params: params)
|
172
|
+
puts response.status_code
|
173
|
+
puts response.body
|
174
|
+
puts response.headers
|
175
|
+
|
176
|
+
##################################################
|
177
|
+
# Delete spam reports #
|
178
|
+
# DELETE /suppression/spam_reports #
|
179
|
+
|
180
|
+
data = JSON.parse('{
|
181
|
+
"delete_all": false,
|
182
|
+
"emails": [
|
183
|
+
"example1@example.com",
|
184
|
+
"example2@example.com"
|
185
|
+
]
|
186
|
+
}')
|
187
|
+
response = sg.client.suppression.spam_reports.delete(request_body: data)
|
188
|
+
puts response.status_code
|
189
|
+
puts response.body
|
190
|
+
puts response.headers
|
191
|
+
|
192
|
+
##################################################
|
193
|
+
# Retrieve all global suppressions #
|
194
|
+
# GET /suppression/unsubscribes #
|
195
|
+
|
196
|
+
params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
|
197
|
+
response = sg.client.suppression.unsubscribes.get(query_params: params)
|
198
|
+
puts response.status_code
|
199
|
+
puts response.body
|
200
|
+
puts response.headers
|
201
|
+
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'sendgrid-ruby'
|
2
|
+
|
3
|
+
|
4
|
+
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
|
+
|
6
|
+
|
7
|
+
##################################################
|
8
|
+
# Create a transactional template. #
|
9
|
+
# POST /templates #
|
10
|
+
|
11
|
+
data = JSON.parse('{
|
12
|
+
"name": "example_name"
|
13
|
+
}')
|
14
|
+
response = sg.client.templates.post(request_body: data)
|
15
|
+
puts response.status_code
|
16
|
+
puts response.body
|
17
|
+
puts response.headers
|
18
|
+
|
19
|
+
##################################################
|
20
|
+
# Retrieve all transactional templates. #
|
21
|
+
# GET /templates #
|
22
|
+
|
23
|
+
response = sg.client.templates.get()
|
24
|
+
puts response.status_code
|
25
|
+
puts response.body
|
26
|
+
puts response.headers
|
27
|
+
|
28
|
+
##################################################
|
29
|
+
# Edit a transactional template. #
|
30
|
+
# PATCH /templates/{template_id} #
|
31
|
+
|
32
|
+
data = JSON.parse('{
|
33
|
+
"name": "new_example_name"
|
34
|
+
}')
|
35
|
+
template_id = "test_url_param"
|
36
|
+
response = sg.client.templates._(template_id).patch(request_body: data)
|
37
|
+
puts response.status_code
|
38
|
+
puts response.body
|
39
|
+
puts response.headers
|
40
|
+
|
41
|
+
##################################################
|
42
|
+
# Retrieve a single transactional template. #
|
43
|
+
# GET /templates/{template_id} #
|
44
|
+
|
45
|
+
template_id = "test_url_param"
|
46
|
+
response = sg.client.templates._(template_id).get()
|
47
|
+
puts response.status_code
|
48
|
+
puts response.body
|
49
|
+
puts response.headers
|
50
|
+
|
51
|
+
##################################################
|
52
|
+
# Delete a template. #
|
53
|
+
# DELETE /templates/{template_id} #
|
54
|
+
|
55
|
+
template_id = "test_url_param"
|
56
|
+
response = sg.client.templates._(template_id).delete()
|
57
|
+
puts response.status_code
|
58
|
+
puts response.body
|
59
|
+
puts response.headers
|
60
|
+
|
61
|
+
##################################################
|
62
|
+
# Create a new transactional template version. #
|
63
|
+
# POST /templates/{template_id}/versions #
|
64
|
+
|
65
|
+
data = JSON.parse('{
|
66
|
+
"active": 1,
|
67
|
+
"html_content": "<%body%>",
|
68
|
+
"name": "example_version_name",
|
69
|
+
"plain_content": "<%body%>",
|
70
|
+
"subject": "<%subject%>",
|
71
|
+
"template_id": "ddb96bbc-9b92-425e-8979-99464621b543"
|
72
|
+
}')
|
73
|
+
template_id = "test_url_param"
|
74
|
+
response = sg.client.templates._(template_id).versions.post(request_body: data)
|
75
|
+
puts response.status_code
|
76
|
+
puts response.body
|
77
|
+
puts response.headers
|
78
|
+
|
79
|
+
##################################################
|
80
|
+
# Edit a transactional template version. #
|
81
|
+
# PATCH /templates/{template_id}/versions/{version_id} #
|
82
|
+
|
83
|
+
data = JSON.parse('{
|
84
|
+
"active": 1,
|
85
|
+
"html_content": "<%body%>",
|
86
|
+
"name": "updated_example_name",
|
87
|
+
"plain_content": "<%body%>",
|
88
|
+
"subject": "<%subject%>"
|
89
|
+
}')
|
90
|
+
template_id = "test_url_param"
|
91
|
+
version_id = "test_url_param"
|
92
|
+
response = sg.client.templates._(template_id).versions._(version_id).patch(request_body: data)
|
93
|
+
puts response.status_code
|
94
|
+
puts response.body
|
95
|
+
puts response.headers
|
96
|
+
|
97
|
+
##################################################
|
98
|
+
# Retrieve a specific transactional template version. #
|
99
|
+
# GET /templates/{template_id}/versions/{version_id} #
|
100
|
+
|
101
|
+
template_id = "test_url_param"
|
102
|
+
version_id = "test_url_param"
|
103
|
+
response = sg.client.templates._(template_id).versions._(version_id).get()
|
104
|
+
puts response.status_code
|
105
|
+
puts response.body
|
106
|
+
puts response.headers
|
107
|
+
|
108
|
+
##################################################
|
109
|
+
# Delete a transactional template version. #
|
110
|
+
# DELETE /templates/{template_id}/versions/{version_id} #
|
111
|
+
|
112
|
+
template_id = "test_url_param"
|
113
|
+
version_id = "test_url_param"
|
114
|
+
response = sg.client.templates._(template_id).versions._(version_id).delete()
|
115
|
+
puts response.status_code
|
116
|
+
puts response.body
|
117
|
+
puts response.headers
|
118
|
+
|
119
|
+
##################################################
|
120
|
+
# Activate a transactional template version. #
|
121
|
+
# POST /templates/{template_id}/versions/{version_id}/activate #
|
122
|
+
|
123
|
+
template_id = "test_url_param"
|
124
|
+
version_id = "test_url_param"
|
125
|
+
response = sg.client.templates._(template_id).versions._(version_id).activate.post()
|
126
|
+
puts response.status_code
|
127
|
+
puts response.body
|
128
|
+
puts response.headers
|
129
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'sendgrid-ruby'
|
2
|
+
|
3
|
+
|
4
|
+
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
5
|
+
|
6
|
+
|
7
|
+
##################################################
|
8
|
+
# Retrieve Tracking Settings #
|
9
|
+
# GET /tracking_settings #
|
10
|
+
|
11
|
+
params = JSON.parse('{"limit": 1, "offset": 1}')
|
12
|
+
response = sg.client.tracking_settings.get(query_params: params)
|
13
|
+
puts response.status_code
|
14
|
+
puts response.body
|
15
|
+
puts response.headers
|
16
|
+
|
17
|
+
##################################################
|
18
|
+
# Update Click Tracking Settings #
|
19
|
+
# PATCH /tracking_settings/click #
|
20
|
+
|
21
|
+
data = JSON.parse('{
|
22
|
+
"enabled": true
|
23
|
+
}')
|
24
|
+
response = sg.client.tracking_settings.click.patch(request_body: data)
|
25
|
+
puts response.status_code
|
26
|
+
puts response.body
|
27
|
+
puts response.headers
|
28
|
+
|
29
|
+
##################################################
|
30
|
+
# Retrieve Click Track Settings #
|
31
|
+
# GET /tracking_settings/click #
|
32
|
+
|
33
|
+
response = sg.client.tracking_settings.click.get()
|
34
|
+
puts response.status_code
|
35
|
+
puts response.body
|
36
|
+
puts response.headers
|
37
|
+
|
38
|
+
##################################################
|
39
|
+
# Update Google Analytics Settings #
|
40
|
+
# PATCH /tracking_settings/google_analytics #
|
41
|
+
|
42
|
+
data = JSON.parse('{
|
43
|
+
"enabled": true,
|
44
|
+
"utm_campaign": "website",
|
45
|
+
"utm_content": "",
|
46
|
+
"utm_medium": "email",
|
47
|
+
"utm_source": "sendgrid.com",
|
48
|
+
"utm_term": ""
|
49
|
+
}')
|
50
|
+
response = sg.client.tracking_settings.google_analytics.patch(request_body: data)
|
51
|
+
puts response.status_code
|
52
|
+
puts response.body
|
53
|
+
puts response.headers
|
54
|
+
|
55
|
+
##################################################
|
56
|
+
# Retrieve Google Analytics Settings #
|
57
|
+
# GET /tracking_settings/google_analytics #
|
58
|
+
|
59
|
+
response = sg.client.tracking_settings.google_analytics.get()
|
60
|
+
puts response.status_code
|
61
|
+
puts response.body
|
62
|
+
puts response.headers
|
63
|
+
|
64
|
+
##################################################
|
65
|
+
# Update Open Tracking Settings #
|
66
|
+
# PATCH /tracking_settings/open #
|
67
|
+
|
68
|
+
data = JSON.parse('{
|
69
|
+
"enabled": true
|
70
|
+
}')
|
71
|
+
response = sg.client.tracking_settings.open.patch(request_body: data)
|
72
|
+
puts response.status_code
|
73
|
+
puts response.body
|
74
|
+
puts response.headers
|
75
|
+
|
76
|
+
##################################################
|
77
|
+
# Get Open Tracking Settings #
|
78
|
+
# GET /tracking_settings/open #
|
79
|
+
|
80
|
+
response = sg.client.tracking_settings.open.get()
|
81
|
+
puts response.status_code
|
82
|
+
puts response.body
|
83
|
+
puts response.headers
|
84
|
+
|
85
|
+
##################################################
|
86
|
+
# Update Subscription Tracking Settings #
|
87
|
+
# PATCH /tracking_settings/subscription #
|
88
|
+
|
89
|
+
data = JSON.parse('{
|
90
|
+
"enabled": true,
|
91
|
+
"html_content": "html content",
|
92
|
+
"landing": "landing page html",
|
93
|
+
"plain_content": "text content",
|
94
|
+
"replace": "replacement tag",
|
95
|
+
"url": "url"
|
96
|
+
}')
|
97
|
+
response = sg.client.tracking_settings.subscription.patch(request_body: data)
|
98
|
+
puts response.status_code
|
99
|
+
puts response.body
|
100
|
+
puts response.headers
|
101
|
+
|
102
|
+
##################################################
|
103
|
+
# Retrieve Subscription Tracking Settings #
|
104
|
+
# GET /tracking_settings/subscription #
|
105
|
+
|
106
|
+
response = sg.client.tracking_settings.subscription.get()
|
107
|
+
puts response.status_code
|
108
|
+
puts response.body
|
109
|
+
puts response.headers
|
110
|
+
|