sendgrid4r 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -2
- data/README.md +1 -0
- data/lib/sendgrid4r/factory/campaign_factory.rb +18 -5
- data/lib/sendgrid4r/factory/condition_factory.rb +1 -1
- data/lib/sendgrid4r/factory/mail_factory.rb +57 -0
- data/lib/sendgrid4r/factory/segment_factory.rb +2 -5
- data/lib/sendgrid4r/factory/version_factory.rb +1 -1
- data/lib/sendgrid4r/rest/api.rb +48 -49
- data/lib/sendgrid4r/rest/api_keys_management/api_keys.rb +75 -0
- data/lib/sendgrid4r/rest/api_keys_management/permissions.rb +31 -0
- data/lib/sendgrid4r/rest/blocks.rb +49 -68
- data/lib/sendgrid4r/rest/bounces.rb +45 -64
- data/lib/sendgrid4r/rest/cancel_scheduled_sends.rb +53 -72
- data/lib/sendgrid4r/rest/categories.rb +31 -0
- data/lib/sendgrid4r/rest/email_activity.rb +72 -0
- data/lib/sendgrid4r/rest/invalid_emails.rb +50 -68
- data/lib/sendgrid4r/rest/ip_access_management.rb +86 -111
- data/lib/sendgrid4r/rest/ips/addresses.rb +50 -59
- data/lib/sendgrid4r/rest/ips/pools.rb +42 -53
- data/lib/sendgrid4r/rest/ips/warmup.rb +46 -55
- data/lib/sendgrid4r/rest/mail/address.rb +14 -0
- data/lib/sendgrid4r/rest/mail/attachment.rb +22 -0
- data/lib/sendgrid4r/rest/mail/content.rb +10 -0
- data/lib/sendgrid4r/rest/mail/mail.rb +28 -0
- data/lib/sendgrid4r/rest/mail/mail_settings.rb +62 -0
- data/lib/sendgrid4r/rest/mail/params.rb +64 -0
- data/lib/sendgrid4r/rest/mail/personalization.rb +33 -0
- data/lib/sendgrid4r/rest/mail/tracking_settings.rb +74 -0
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/custom_fields.rb +12 -27
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/lists.rb +20 -34
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/recipients.rb +134 -0
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/reserved_fields.rb +6 -9
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/segments.rb +86 -0
- data/lib/sendgrid4r/rest/marketing_campaigns/marketing_campaigns.rb +119 -0
- data/lib/sendgrid4r/rest/marketing_campaigns/senders.rb +101 -0
- data/lib/sendgrid4r/rest/request.rb +61 -63
- data/lib/sendgrid4r/rest/settings/enforced_tls.rb +23 -26
- data/lib/sendgrid4r/rest/settings/mail.rb +167 -183
- data/lib/sendgrid4r/rest/settings/partner.rb +33 -36
- data/lib/sendgrid4r/rest/settings/settings.rb +17 -22
- data/lib/sendgrid4r/rest/settings/tracking.rb +97 -107
- data/lib/sendgrid4r/rest/sm/global_unsubscribes.rb +52 -60
- data/lib/sendgrid4r/rest/sm/groups.rb +52 -58
- data/lib/sendgrid4r/rest/sm/sm.rb +15 -17
- data/lib/sendgrid4r/rest/sm/suppressions.rb +50 -67
- data/lib/sendgrid4r/rest/spam_reports.rb +49 -69
- data/lib/sendgrid4r/rest/stats/advanced.rb +100 -102
- data/lib/sendgrid4r/rest/stats/category.rb +31 -33
- data/lib/sendgrid4r/rest/stats/global.rb +17 -19
- data/lib/sendgrid4r/rest/stats/parse.rb +18 -20
- data/lib/sendgrid4r/rest/stats/stats.rb +59 -69
- data/lib/sendgrid4r/rest/stats/subuser.rb +70 -32
- data/lib/sendgrid4r/rest/subusers.rb +106 -134
- data/lib/sendgrid4r/rest/transactional_templates/templates.rb +63 -0
- data/lib/sendgrid4r/rest/transactional_templates/versions.rb +90 -0
- data/lib/sendgrid4r/rest/users.rb +125 -57
- data/lib/sendgrid4r/rest/webhooks/event.rb +36 -42
- data/lib/sendgrid4r/rest/webhooks/parse.rb +28 -37
- data/lib/sendgrid4r/rest/whitelabel/domains.rb +176 -222
- data/lib/sendgrid4r/rest/whitelabel/ips.rb +107 -128
- data/lib/sendgrid4r/rest/whitelabel/links.rb +131 -167
- data/lib/sendgrid4r/version.rb +1 -1
- data/lib/sendgrid4r.rb +23 -13
- data/sendgrid4r.gemspec +1 -1
- data/spec/client_spec.rb +12 -1
- data/spec/factory/campaign_factory_spec.rb +75 -35
- data/spec/factory/condition_factory_spec.rb +19 -18
- data/spec/factory/segment_factory_spec.rb +28 -21
- data/spec/factory/version_factory_spec.rb +28 -27
- data/spec/photo.jpg +0 -0
- data/spec/rest/api_keys_management/api_keys_spec.rb +174 -0
- data/spec/rest/api_keys_management/permissions_spec.rb +54 -0
- data/spec/rest/blocks_spec.rb +78 -106
- data/spec/rest/bounces_spec.rb +91 -118
- data/spec/rest/cancel_scheduled_sends_spec.rb +94 -149
- data/spec/rest/categories_spec.rb +77 -0
- data/spec/rest/email_activity_spec.rb +151 -0
- data/spec/rest/invalid_emails_spec.rb +85 -119
- data/spec/rest/ip_access_management_spec.rb +157 -195
- data/spec/rest/ips/addresses_spec.rb +94 -122
- data/spec/rest/ips/pools_spec.rb +84 -112
- data/spec/rest/ips/warmup_spec.rb +63 -71
- data/spec/rest/mail/address_spec.rb +28 -0
- data/spec/rest/mail/attachment_spec.rb +48 -0
- data/spec/rest/mail/content_spec.rb +32 -0
- data/spec/rest/mail/mail_settings_spec.rb +51 -0
- data/spec/rest/mail/mail_spec.rb +136 -0
- data/spec/rest/mail/params_spec.rb +152 -0
- data/spec/rest/mail/personalization_spec.rb +66 -0
- data/spec/rest/mail/tracking_settings_spec.rb +63 -0
- data/spec/rest/marketing_campaigns/contacts/custom_fields_spec.rb +146 -0
- data/spec/rest/marketing_campaigns/contacts/lists_spec.rb +307 -0
- data/spec/rest/marketing_campaigns/contacts/recipients_spec.rb +331 -0
- data/spec/rest/marketing_campaigns/contacts/reserved_fields_spec.rb +119 -0
- data/spec/rest/marketing_campaigns/contacts/segments_spec.rb +268 -0
- data/spec/rest/marketing_campaigns/marketing_campaigns_spec.rb +427 -0
- data/spec/rest/marketing_campaigns/senders_spec.rb +230 -0
- data/spec/rest/settings/enforced_tls_spec.rb +38 -54
- data/spec/rest/settings/mail_spec.rb +227 -330
- data/spec/rest/settings/partner_spec.rb +40 -59
- data/spec/rest/settings/settings_spec.rb +44 -42
- data/spec/rest/settings/tracking_spec.rb +130 -189
- data/spec/rest/sm/global_unsubscribes_spec.rb +47 -72
- data/spec/rest/sm/groups_spec.rb +88 -123
- data/spec/rest/sm/sm_spec.rb +32 -30
- data/spec/rest/sm/suppressions_spec.rb +105 -140
- data/spec/rest/spam_reports_spec.rb +81 -109
- data/spec/rest/stats/advanced_spec.rb +67 -125
- data/spec/rest/stats/category_spec.rb +27 -45
- data/spec/rest/stats/global_spec.rb +34 -42
- data/spec/rest/stats/parse_spec.rb +32 -30
- data/spec/rest/stats/stats_spec.rb +174 -172
- data/spec/rest/stats/subuser_spec.rb +97 -57
- data/spec/rest/subusers_spec.rb +156 -209
- data/spec/rest/transactional_templates/templates_spec.rb +199 -0
- data/spec/rest/transactional_templates/versions_spec.rb +228 -0
- data/spec/rest/users_spec.rb +176 -91
- data/spec/rest/webhooks/event_spec.rb +59 -85
- data/spec/rest/webhooks/parse_spec.rb +51 -71
- data/spec/rest/whitelabel/domains_spec.rb +333 -513
- data/spec/rest/whitelabel/ips_spec.rb +109 -147
- data/spec/rest/whitelabel/links_spec.rb +181 -265
- metadata +70 -40
- data/lib/sendgrid4r/rest/api_keys/api_keys.rb +0 -80
- data/lib/sendgrid4r/rest/api_keys/permissions.rb +0 -33
- data/lib/sendgrid4r/rest/campaigns/campaigns.rb +0 -126
- data/lib/sendgrid4r/rest/categories/categories.rb +0 -43
- data/lib/sendgrid4r/rest/contacts/recipients.rb +0 -150
- data/lib/sendgrid4r/rest/contacts/segments.rb +0 -97
- data/lib/sendgrid4r/rest/email_activity/email_activity.rb +0 -81
- data/lib/sendgrid4r/rest/templates/templates.rb +0 -69
- data/lib/sendgrid4r/rest/templates/versions.rb +0 -95
- data/spec/rest/api_keys/api_keys_spec.rb +0 -210
- data/spec/rest/api_keys/permissions_spec.rb +0 -65
- data/spec/rest/campaigns/campaigns_spec.rb +0 -492
- data/spec/rest/categories/categories_spec.rb +0 -96
- data/spec/rest/contacts/custom_fields_spec.rb +0 -174
- data/spec/rest/contacts/lists_spec.rb +0 -372
- data/spec/rest/contacts/recipients_spec.rb +0 -343
- data/spec/rest/contacts/reserved_fields_spec.rb +0 -146
- data/spec/rest/contacts/segments_spec.rb +0 -307
- data/spec/rest/email_activity/email_activity_spec.rb +0 -179
- data/spec/rest/templates/templates_spec.rb +0 -222
- data/spec/rest/templates/versions_spec.rb +0 -252
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendgrid4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- awwa500@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: 1.6.0
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
62
|
+
version: 1.13.0
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: 1.6.0
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 1.
|
72
|
+
version: 1.13.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rspec
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,27 +124,37 @@ files:
|
|
124
124
|
- lib/sendgrid4r/client.rb
|
125
125
|
- lib/sendgrid4r/factory/campaign_factory.rb
|
126
126
|
- lib/sendgrid4r/factory/condition_factory.rb
|
127
|
+
- lib/sendgrid4r/factory/mail_factory.rb
|
127
128
|
- lib/sendgrid4r/factory/segment_factory.rb
|
128
129
|
- lib/sendgrid4r/factory/version_factory.rb
|
129
130
|
- lib/sendgrid4r/rest/api.rb
|
130
|
-
- lib/sendgrid4r/rest/
|
131
|
-
- lib/sendgrid4r/rest/
|
131
|
+
- lib/sendgrid4r/rest/api_keys_management/api_keys.rb
|
132
|
+
- lib/sendgrid4r/rest/api_keys_management/permissions.rb
|
132
133
|
- lib/sendgrid4r/rest/blocks.rb
|
133
134
|
- lib/sendgrid4r/rest/bounces.rb
|
134
|
-
- lib/sendgrid4r/rest/campaigns/campaigns.rb
|
135
135
|
- lib/sendgrid4r/rest/cancel_scheduled_sends.rb
|
136
|
-
- lib/sendgrid4r/rest/categories
|
137
|
-
- lib/sendgrid4r/rest/
|
138
|
-
- lib/sendgrid4r/rest/contacts/lists.rb
|
139
|
-
- lib/sendgrid4r/rest/contacts/recipients.rb
|
140
|
-
- lib/sendgrid4r/rest/contacts/reserved_fields.rb
|
141
|
-
- lib/sendgrid4r/rest/contacts/segments.rb
|
142
|
-
- lib/sendgrid4r/rest/email_activity/email_activity.rb
|
136
|
+
- lib/sendgrid4r/rest/categories.rb
|
137
|
+
- lib/sendgrid4r/rest/email_activity.rb
|
143
138
|
- lib/sendgrid4r/rest/invalid_emails.rb
|
144
139
|
- lib/sendgrid4r/rest/ip_access_management.rb
|
145
140
|
- lib/sendgrid4r/rest/ips/addresses.rb
|
146
141
|
- lib/sendgrid4r/rest/ips/pools.rb
|
147
142
|
- lib/sendgrid4r/rest/ips/warmup.rb
|
143
|
+
- lib/sendgrid4r/rest/mail/address.rb
|
144
|
+
- lib/sendgrid4r/rest/mail/attachment.rb
|
145
|
+
- lib/sendgrid4r/rest/mail/content.rb
|
146
|
+
- lib/sendgrid4r/rest/mail/mail.rb
|
147
|
+
- lib/sendgrid4r/rest/mail/mail_settings.rb
|
148
|
+
- lib/sendgrid4r/rest/mail/params.rb
|
149
|
+
- lib/sendgrid4r/rest/mail/personalization.rb
|
150
|
+
- lib/sendgrid4r/rest/mail/tracking_settings.rb
|
151
|
+
- lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb
|
152
|
+
- lib/sendgrid4r/rest/marketing_campaigns/contacts/lists.rb
|
153
|
+
- lib/sendgrid4r/rest/marketing_campaigns/contacts/recipients.rb
|
154
|
+
- lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb
|
155
|
+
- lib/sendgrid4r/rest/marketing_campaigns/contacts/segments.rb
|
156
|
+
- lib/sendgrid4r/rest/marketing_campaigns/marketing_campaigns.rb
|
157
|
+
- lib/sendgrid4r/rest/marketing_campaigns/senders.rb
|
148
158
|
- lib/sendgrid4r/rest/request.rb
|
149
159
|
- lib/sendgrid4r/rest/settings/enforced_tls.rb
|
150
160
|
- lib/sendgrid4r/rest/settings/mail.rb
|
@@ -163,8 +173,8 @@ files:
|
|
163
173
|
- lib/sendgrid4r/rest/stats/stats.rb
|
164
174
|
- lib/sendgrid4r/rest/stats/subuser.rb
|
165
175
|
- lib/sendgrid4r/rest/subusers.rb
|
166
|
-
- lib/sendgrid4r/rest/
|
167
|
-
- lib/sendgrid4r/rest/
|
176
|
+
- lib/sendgrid4r/rest/transactional_templates/templates.rb
|
177
|
+
- lib/sendgrid4r/rest/transactional_templates/versions.rb
|
168
178
|
- lib/sendgrid4r/rest/users.rb
|
169
179
|
- lib/sendgrid4r/rest/webhooks/event.rb
|
170
180
|
- lib/sendgrid4r/rest/webhooks/parse.rb
|
@@ -178,24 +188,34 @@ files:
|
|
178
188
|
- spec/factory/condition_factory_spec.rb
|
179
189
|
- spec/factory/segment_factory_spec.rb
|
180
190
|
- spec/factory/version_factory_spec.rb
|
181
|
-
- spec/
|
182
|
-
- spec/rest/
|
191
|
+
- spec/photo.jpg
|
192
|
+
- spec/rest/api_keys_management/api_keys_spec.rb
|
193
|
+
- spec/rest/api_keys_management/permissions_spec.rb
|
183
194
|
- spec/rest/blocks_spec.rb
|
184
195
|
- spec/rest/bounces_spec.rb
|
185
|
-
- spec/rest/campaigns/campaigns_spec.rb
|
186
196
|
- spec/rest/cancel_scheduled_sends_spec.rb
|
187
|
-
- spec/rest/
|
188
|
-
- spec/rest/
|
189
|
-
- spec/rest/contacts/lists_spec.rb
|
190
|
-
- spec/rest/contacts/recipients_spec.rb
|
191
|
-
- spec/rest/contacts/reserved_fields_spec.rb
|
192
|
-
- spec/rest/contacts/segments_spec.rb
|
193
|
-
- spec/rest/email_activity/email_activity_spec.rb
|
197
|
+
- spec/rest/categories_spec.rb
|
198
|
+
- spec/rest/email_activity_spec.rb
|
194
199
|
- spec/rest/invalid_emails_spec.rb
|
195
200
|
- spec/rest/ip_access_management_spec.rb
|
196
201
|
- spec/rest/ips/addresses_spec.rb
|
197
202
|
- spec/rest/ips/pools_spec.rb
|
198
203
|
- spec/rest/ips/warmup_spec.rb
|
204
|
+
- spec/rest/mail/address_spec.rb
|
205
|
+
- spec/rest/mail/attachment_spec.rb
|
206
|
+
- spec/rest/mail/content_spec.rb
|
207
|
+
- spec/rest/mail/mail_settings_spec.rb
|
208
|
+
- spec/rest/mail/mail_spec.rb
|
209
|
+
- spec/rest/mail/params_spec.rb
|
210
|
+
- spec/rest/mail/personalization_spec.rb
|
211
|
+
- spec/rest/mail/tracking_settings_spec.rb
|
212
|
+
- spec/rest/marketing_campaigns/contacts/custom_fields_spec.rb
|
213
|
+
- spec/rest/marketing_campaigns/contacts/lists_spec.rb
|
214
|
+
- spec/rest/marketing_campaigns/contacts/recipients_spec.rb
|
215
|
+
- spec/rest/marketing_campaigns/contacts/reserved_fields_spec.rb
|
216
|
+
- spec/rest/marketing_campaigns/contacts/segments_spec.rb
|
217
|
+
- spec/rest/marketing_campaigns/marketing_campaigns_spec.rb
|
218
|
+
- spec/rest/marketing_campaigns/senders_spec.rb
|
199
219
|
- spec/rest/settings/enforced_tls_spec.rb
|
200
220
|
- spec/rest/settings/mail_spec.rb
|
201
221
|
- spec/rest/settings/partner_spec.rb
|
@@ -213,8 +233,8 @@ files:
|
|
213
233
|
- spec/rest/stats/stats_spec.rb
|
214
234
|
- spec/rest/stats/subuser_spec.rb
|
215
235
|
- spec/rest/subusers_spec.rb
|
216
|
-
- spec/rest/
|
217
|
-
- spec/rest/
|
236
|
+
- spec/rest/transactional_templates/templates_spec.rb
|
237
|
+
- spec/rest/transactional_templates/versions_spec.rb
|
218
238
|
- spec/rest/users_spec.rb
|
219
239
|
- spec/rest/webhooks/event_spec.rb
|
220
240
|
- spec/rest/webhooks/parse_spec.rb
|
@@ -252,24 +272,34 @@ test_files:
|
|
252
272
|
- spec/factory/condition_factory_spec.rb
|
253
273
|
- spec/factory/segment_factory_spec.rb
|
254
274
|
- spec/factory/version_factory_spec.rb
|
255
|
-
- spec/
|
256
|
-
- spec/rest/
|
275
|
+
- spec/photo.jpg
|
276
|
+
- spec/rest/api_keys_management/api_keys_spec.rb
|
277
|
+
- spec/rest/api_keys_management/permissions_spec.rb
|
257
278
|
- spec/rest/blocks_spec.rb
|
258
279
|
- spec/rest/bounces_spec.rb
|
259
|
-
- spec/rest/campaigns/campaigns_spec.rb
|
260
280
|
- spec/rest/cancel_scheduled_sends_spec.rb
|
261
|
-
- spec/rest/
|
262
|
-
- spec/rest/
|
263
|
-
- spec/rest/contacts/lists_spec.rb
|
264
|
-
- spec/rest/contacts/recipients_spec.rb
|
265
|
-
- spec/rest/contacts/reserved_fields_spec.rb
|
266
|
-
- spec/rest/contacts/segments_spec.rb
|
267
|
-
- spec/rest/email_activity/email_activity_spec.rb
|
281
|
+
- spec/rest/categories_spec.rb
|
282
|
+
- spec/rest/email_activity_spec.rb
|
268
283
|
- spec/rest/invalid_emails_spec.rb
|
269
284
|
- spec/rest/ip_access_management_spec.rb
|
270
285
|
- spec/rest/ips/addresses_spec.rb
|
271
286
|
- spec/rest/ips/pools_spec.rb
|
272
287
|
- spec/rest/ips/warmup_spec.rb
|
288
|
+
- spec/rest/mail/address_spec.rb
|
289
|
+
- spec/rest/mail/attachment_spec.rb
|
290
|
+
- spec/rest/mail/content_spec.rb
|
291
|
+
- spec/rest/mail/mail_settings_spec.rb
|
292
|
+
- spec/rest/mail/mail_spec.rb
|
293
|
+
- spec/rest/mail/params_spec.rb
|
294
|
+
- spec/rest/mail/personalization_spec.rb
|
295
|
+
- spec/rest/mail/tracking_settings_spec.rb
|
296
|
+
- spec/rest/marketing_campaigns/contacts/custom_fields_spec.rb
|
297
|
+
- spec/rest/marketing_campaigns/contacts/lists_spec.rb
|
298
|
+
- spec/rest/marketing_campaigns/contacts/recipients_spec.rb
|
299
|
+
- spec/rest/marketing_campaigns/contacts/reserved_fields_spec.rb
|
300
|
+
- spec/rest/marketing_campaigns/contacts/segments_spec.rb
|
301
|
+
- spec/rest/marketing_campaigns/marketing_campaigns_spec.rb
|
302
|
+
- spec/rest/marketing_campaigns/senders_spec.rb
|
273
303
|
- spec/rest/settings/enforced_tls_spec.rb
|
274
304
|
- spec/rest/settings/mail_spec.rb
|
275
305
|
- spec/rest/settings/partner_spec.rb
|
@@ -287,8 +317,8 @@ test_files:
|
|
287
317
|
- spec/rest/stats/stats_spec.rb
|
288
318
|
- spec/rest/stats/subuser_spec.rb
|
289
319
|
- spec/rest/subusers_spec.rb
|
290
|
-
- spec/rest/
|
291
|
-
- spec/rest/
|
320
|
+
- spec/rest/transactional_templates/templates_spec.rb
|
321
|
+
- spec/rest/transactional_templates/versions_spec.rb
|
292
322
|
- spec/rest/users_spec.rb
|
293
323
|
- spec/rest/webhooks/event_spec.rb
|
294
324
|
- spec/rest/webhooks/parse_spec.rb
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module SendGrid4r
|
4
|
-
module REST
|
5
|
-
#
|
6
|
-
# SendGrid Web API v3 ApiKeys
|
7
|
-
#
|
8
|
-
module ApiKeys
|
9
|
-
include SendGrid4r::REST::Request
|
10
|
-
|
11
|
-
ApiKeys = Struct.new(:result)
|
12
|
-
ApiKey = Struct.new(:name, :api_key_id, :api_key, :scopes)
|
13
|
-
|
14
|
-
def self.url(api_key_id = nil)
|
15
|
-
url = "#{BASE_URL}/api_keys"
|
16
|
-
url = "#{url}/#{api_key_id}" unless api_key_id.nil?
|
17
|
-
url
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.create_api_keys(resp)
|
21
|
-
return resp if resp.nil?
|
22
|
-
api_keys = []
|
23
|
-
resp['result'].each do |api_key|
|
24
|
-
api_keys.push(SendGrid4r::REST::ApiKeys.create_api_key(api_key))
|
25
|
-
end
|
26
|
-
ApiKeys.new(api_keys)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.create_api_key(resp)
|
30
|
-
return resp if resp.nil?
|
31
|
-
ApiKey.new(
|
32
|
-
resp['name'],
|
33
|
-
resp['api_key_id'],
|
34
|
-
resp['api_key'],
|
35
|
-
resp['scopes']
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def get_api_keys(&block)
|
40
|
-
resp = get(@auth, SendGrid4r::REST::ApiKeys.url, &block)
|
41
|
-
SendGrid4r::REST::ApiKeys.create_api_keys(resp)
|
42
|
-
end
|
43
|
-
|
44
|
-
def post_api_key(name:, scopes: nil, &block)
|
45
|
-
params = {}
|
46
|
-
params['name'] = name
|
47
|
-
params['scopes'] = scopes unless scopes.nil?
|
48
|
-
resp = post(@auth, SendGrid4r::REST::ApiKeys.url, params, &block)
|
49
|
-
SendGrid4r::REST::ApiKeys.create_api_key(resp)
|
50
|
-
end
|
51
|
-
|
52
|
-
def get_api_key(api_key_id:, &block)
|
53
|
-
endpoint = SendGrid4r::REST::ApiKeys.url(api_key_id)
|
54
|
-
resp = get(@auth, endpoint, &block)
|
55
|
-
SendGrid4r::REST::ApiKeys.create_api_key(resp)
|
56
|
-
end
|
57
|
-
|
58
|
-
def delete_api_key(api_key_id:, &block)
|
59
|
-
delete(@auth, SendGrid4r::REST::ApiKeys.url(api_key_id), &block)
|
60
|
-
end
|
61
|
-
|
62
|
-
def patch_api_key(api_key_id:, name:, &block)
|
63
|
-
params = {}
|
64
|
-
params['name'] = name
|
65
|
-
endpoint = SendGrid4r::REST::ApiKeys.url(api_key_id)
|
66
|
-
resp = patch(@auth, endpoint, params, &block)
|
67
|
-
SendGrid4r::REST::ApiKeys.create_api_key(resp)
|
68
|
-
end
|
69
|
-
|
70
|
-
def put_api_key(api_key_id:, name:, scopes:, &block)
|
71
|
-
params = {}
|
72
|
-
params['name'] = name unless name.nil?
|
73
|
-
params['scopes'] = scopes unless scopes.nil?
|
74
|
-
endpoint = SendGrid4r::REST::ApiKeys.url(api_key_id)
|
75
|
-
resp = put(@auth, endpoint, params, &block)
|
76
|
-
SendGrid4r::REST::ApiKeys.create_api_key(resp)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module SendGrid4r
|
4
|
-
module REST
|
5
|
-
#
|
6
|
-
# SendGrid Web API v3 ApiKeys
|
7
|
-
#
|
8
|
-
module ApiKeys
|
9
|
-
#
|
10
|
-
# SendGrid Web API v3 ApiKeys Permissions
|
11
|
-
#
|
12
|
-
module Permissions
|
13
|
-
include SendGrid4r::REST::Request
|
14
|
-
|
15
|
-
Permissions = Struct.new(:scopes)
|
16
|
-
|
17
|
-
def self.url
|
18
|
-
"#{BASE_URL}/scopes"
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.create_permissions(resp)
|
22
|
-
return resp if resp.nil?
|
23
|
-
Permissions.new(resp['scopes'])
|
24
|
-
end
|
25
|
-
|
26
|
-
def get_permissions(&block)
|
27
|
-
resp = get(@auth, SendGrid4r::REST::ApiKeys::Permissions.url, &block)
|
28
|
-
SendGrid4r::REST::ApiKeys::Permissions.create_permissions(resp)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module SendGrid4r
|
4
|
-
module REST
|
5
|
-
module Campaigns
|
6
|
-
#
|
7
|
-
# SendGrid Web API v3 Campaigns - Campaigns
|
8
|
-
#
|
9
|
-
module Campaigns
|
10
|
-
include SendGrid4r::REST::Request
|
11
|
-
|
12
|
-
Campaign = Struct.new(
|
13
|
-
:id, :title, :subject, :sender_id, :list_ids, :segment_ids,
|
14
|
-
:categories, :suppression_group_id, :custom_unsubscribe_url,
|
15
|
-
:ip_pool, :html_content, :plain_content, :send_at, :status
|
16
|
-
)
|
17
|
-
|
18
|
-
Campaigns = Struct.new(:result)
|
19
|
-
|
20
|
-
def self.create_campaign(resp)
|
21
|
-
return resp if resp.nil?
|
22
|
-
send_at = Time.at(resp['send_at']) unless resp['send_at'].nil?
|
23
|
-
Campaign.new(
|
24
|
-
resp['id'], resp['title'], resp['subject'], resp['sender_id'],
|
25
|
-
resp['list_ids'], resp['segment_ids'], resp['categories'],
|
26
|
-
resp['suppression_group_id'], resp['custom_unsubscribe_url'],
|
27
|
-
resp['ip_pool'], resp['html_content'], resp['plain_content'],
|
28
|
-
send_at, resp['status']
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.create_campaigns(resp)
|
33
|
-
return resp if resp.nil?
|
34
|
-
result = []
|
35
|
-
resp['result'].each do |campaign|
|
36
|
-
result.push(
|
37
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(campaign)
|
38
|
-
)
|
39
|
-
end
|
40
|
-
Campaigns.new(result)
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.url(campaign_id = nil)
|
44
|
-
url = "#{BASE_URL}/campaigns"
|
45
|
-
url = "#{url}/#{campaign_id}" unless campaign_id.nil?
|
46
|
-
url
|
47
|
-
end
|
48
|
-
|
49
|
-
def post_campaign(params:, &block)
|
50
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url
|
51
|
-
resp = post(@auth, endpoint, params, &block)
|
52
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
53
|
-
end
|
54
|
-
|
55
|
-
def get_campaigns(&block)
|
56
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url
|
57
|
-
resp = get(@auth, endpoint, &block)
|
58
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaigns(resp)
|
59
|
-
end
|
60
|
-
|
61
|
-
def get_campaign(campaign_id:, &block)
|
62
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
63
|
-
resp = get(@auth, endpoint, &block)
|
64
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
65
|
-
end
|
66
|
-
|
67
|
-
def delete_campaign(campaign_id:, &block)
|
68
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
69
|
-
delete(@auth, endpoint, &block)
|
70
|
-
end
|
71
|
-
|
72
|
-
def patch_campaign(campaign_id:, params:, &block)
|
73
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
74
|
-
resp = patch(@auth, endpoint, params.to_h, &block)
|
75
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
76
|
-
end
|
77
|
-
|
78
|
-
def send_campaign(campaign_id:, &block)
|
79
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
80
|
-
endpoint = "#{endpoint}/schedules/now"
|
81
|
-
resp = post(@auth, endpoint, nil, &block)
|
82
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
83
|
-
end
|
84
|
-
|
85
|
-
def schedule_campaign(campaign_id:, send_at:, &block)
|
86
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
87
|
-
endpoint = "#{endpoint}/schedules"
|
88
|
-
payload = {}
|
89
|
-
payload['send_at'] = send_at.to_i
|
90
|
-
resp = post(@auth, endpoint, payload, &block)
|
91
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
92
|
-
end
|
93
|
-
|
94
|
-
def reschedule_campaign(campaign_id:, send_at:, &block)
|
95
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
96
|
-
endpoint = "#{endpoint}/schedules"
|
97
|
-
payload = {}
|
98
|
-
payload['send_at'] = send_at.to_i
|
99
|
-
resp = patch(@auth, endpoint, payload, &block)
|
100
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
101
|
-
end
|
102
|
-
|
103
|
-
def get_schedule_time_campaign(campaign_id:, &block)
|
104
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
105
|
-
endpoint = "#{endpoint}/schedules"
|
106
|
-
resp = get(@auth, endpoint, &block)
|
107
|
-
SendGrid4r::REST::Campaigns::Campaigns.create_campaign(resp)
|
108
|
-
end
|
109
|
-
|
110
|
-
def unschedule_campaign(campaign_id:, &block)
|
111
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
112
|
-
endpoint = "#{endpoint}/schedules"
|
113
|
-
delete(@auth, endpoint, &block)
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_campaign(campaign_id:, to:, &block)
|
117
|
-
endpoint = SendGrid4r::REST::Campaigns::Campaigns.url(campaign_id)
|
118
|
-
endpoint = "#{endpoint}/schedules/test"
|
119
|
-
payload = {}
|
120
|
-
payload['to'] = to
|
121
|
-
post(@auth, endpoint, payload, &block)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module SendGrid4r
|
4
|
-
module REST
|
5
|
-
module Categories
|
6
|
-
#
|
7
|
-
# SendGrid Web API v3 Categories - Categories
|
8
|
-
#
|
9
|
-
module Categories
|
10
|
-
include SendGrid4r::REST::Request
|
11
|
-
|
12
|
-
Category = Struct.new(:category)
|
13
|
-
|
14
|
-
def self.create_category(resp)
|
15
|
-
return resp if resp.nil?
|
16
|
-
Category.new(resp['category'])
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.create_categories(resp)
|
20
|
-
return resp if resp.nil?
|
21
|
-
categories = []
|
22
|
-
resp.each do |category|
|
23
|
-
categories.push(
|
24
|
-
SendGrid4r::REST::Categories::Categories.create_category(
|
25
|
-
category
|
26
|
-
)
|
27
|
-
)
|
28
|
-
end
|
29
|
-
categories
|
30
|
-
end
|
31
|
-
|
32
|
-
def get_categories(category: nil, limit: nil, offset: nil, &block)
|
33
|
-
params = {}
|
34
|
-
params['category'] = category unless category.nil?
|
35
|
-
params['limit'] = limit unless limit.nil?
|
36
|
-
params['offset'] = offset unless limit.nil?
|
37
|
-
resp = get(@auth, "#{BASE_URL}/categories", params, &block)
|
38
|
-
SendGrid4r::REST::Categories::Categories.create_categories(resp)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module SendGrid4r
|
4
|
-
module REST
|
5
|
-
module Contacts
|
6
|
-
#
|
7
|
-
# SendGrid Web API v3 Contacts - Recipients
|
8
|
-
#
|
9
|
-
module Recipients
|
10
|
-
include SendGrid4r::REST::Request
|
11
|
-
|
12
|
-
Recipient = Struct.new(
|
13
|
-
:created_at,
|
14
|
-
:custom_fields,
|
15
|
-
:email,
|
16
|
-
:first_name,
|
17
|
-
:id,
|
18
|
-
:last_clicked,
|
19
|
-
:last_emailed,
|
20
|
-
:last_name,
|
21
|
-
:last_opened,
|
22
|
-
:updated_at
|
23
|
-
)
|
24
|
-
|
25
|
-
Recipients = Struct.new(:recipients)
|
26
|
-
|
27
|
-
def self.create_recipient(resp)
|
28
|
-
return resp if resp.nil?
|
29
|
-
custom_fields = []
|
30
|
-
unless resp['custom_fields'].nil?
|
31
|
-
resp['custom_fields'].each do |field|
|
32
|
-
custom_fields.push(
|
33
|
-
SendGrid4r::REST::Contacts::CustomFields.create_field(field)
|
34
|
-
)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
Recipient.new(
|
38
|
-
Time.at(resp['created_at']), custom_fields,
|
39
|
-
resp['email'], resp['first_name'], resp['id'],
|
40
|
-
resp['last_clicked'], resp['last_emailed'],
|
41
|
-
resp['last_name'], resp['last_opened'],
|
42
|
-
Time.at(resp['updated_at'])
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.create_recipients(resp)
|
47
|
-
return resp if resp.nil?
|
48
|
-
recipients = []
|
49
|
-
resp['recipients'].each do |recipient|
|
50
|
-
recipients.push(
|
51
|
-
SendGrid4r::REST::Contacts::Recipients.create_recipient(recipient)
|
52
|
-
)
|
53
|
-
end
|
54
|
-
Recipients.new(recipients)
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.url(recipient_id = nil)
|
58
|
-
url = "#{BASE_URL}/contactdb/recipients"
|
59
|
-
url = "#{url}/#{recipient_id}" unless recipient_id.nil?
|
60
|
-
url
|
61
|
-
end
|
62
|
-
|
63
|
-
def post_recipients(params:, &block)
|
64
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url
|
65
|
-
resp = post(@auth, endpoint, params, &block)
|
66
|
-
SendGrid4r::REST::Contacts::Recipients.create_result(resp)
|
67
|
-
end
|
68
|
-
|
69
|
-
def patch_recipients(params:, &block)
|
70
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url
|
71
|
-
resp = patch(@auth, endpoint, params, &block)
|
72
|
-
SendGrid4r::REST::Contacts::Recipients.create_result(resp)
|
73
|
-
end
|
74
|
-
|
75
|
-
def delete_recipients(recipient_ids:, &block)
|
76
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url
|
77
|
-
delete(@auth, endpoint, nil, recipient_ids, &block)
|
78
|
-
end
|
79
|
-
|
80
|
-
def get_recipients(page: nil, page_size: nil, &block)
|
81
|
-
params = {}
|
82
|
-
params['page_size'] = page_size unless page_size.nil?
|
83
|
-
params['page'] = page unless page.nil?
|
84
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url
|
85
|
-
resp = get(@auth, endpoint, params, &block)
|
86
|
-
SendGrid4r::REST::Contacts::Recipients.create_recipients(resp)
|
87
|
-
end
|
88
|
-
|
89
|
-
def get_recipient(recipient_id:, &block)
|
90
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url(recipient_id)
|
91
|
-
resp = get(@auth, endpoint, &block)
|
92
|
-
SendGrid4r::REST::Contacts::Recipients.create_recipient(resp)
|
93
|
-
end
|
94
|
-
|
95
|
-
def delete_recipient(recipient_id:, &block)
|
96
|
-
endpoint = SendGrid4r::REST::Contacts::Recipients.url(recipient_id)
|
97
|
-
delete(@auth, endpoint, &block)
|
98
|
-
end
|
99
|
-
|
100
|
-
def get_lists_recipient_belong(recipient_id:, &block)
|
101
|
-
resp = get(
|
102
|
-
@auth,
|
103
|
-
"#{SendGrid4r::REST::Contacts::Recipients.url(recipient_id)}/lists",
|
104
|
-
&block
|
105
|
-
)
|
106
|
-
SendGrid4r::REST::Contacts::Lists.create_lists(resp)
|
107
|
-
end
|
108
|
-
|
109
|
-
def get_recipients_count(&block)
|
110
|
-
endpoint = "#{SendGrid4r::REST::Contacts::Recipients.url}/count"
|
111
|
-
resp = get(@auth, endpoint, &block)
|
112
|
-
resp['recipient_count'] unless resp.nil?
|
113
|
-
end
|
114
|
-
|
115
|
-
def search_recipients(params:, &block)
|
116
|
-
endpoint = "#{SendGrid4r::REST::Contacts::Recipients.url}/search"
|
117
|
-
resp = get(@auth, endpoint, params, &block)
|
118
|
-
SendGrid4r::REST::Contacts::Recipients.create_recipients(resp)
|
119
|
-
end
|
120
|
-
|
121
|
-
Result = Struct.new(
|
122
|
-
:error_count,
|
123
|
-
:error_indices,
|
124
|
-
:new_count,
|
125
|
-
:persisted_recipients,
|
126
|
-
:updated_count
|
127
|
-
)
|
128
|
-
|
129
|
-
def self.create_result(resp)
|
130
|
-
return resp if resp.nil?
|
131
|
-
error_indices = []
|
132
|
-
resp['error_indices'].each do |index|
|
133
|
-
error_indices.push(index)
|
134
|
-
end
|
135
|
-
persisted_recipients = []
|
136
|
-
resp['persisted_recipients'].each do |value|
|
137
|
-
persisted_recipients.push(value)
|
138
|
-
end
|
139
|
-
Result.new(
|
140
|
-
resp['error_count'],
|
141
|
-
error_indices,
|
142
|
-
resp['new_count'],
|
143
|
-
persisted_recipients,
|
144
|
-
resp['updated_count']
|
145
|
-
)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|