sendgrid4r 1.11.0 → 1.12.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 -1
- data/exe/sg +5 -0
- data/lib/sendgrid4r/cli/api_keys/api_key.rb +53 -0
- data/lib/sendgrid4r/cli/api_keys/permission.rb +15 -0
- data/lib/sendgrid4r/cli/campaign/campaign.rb +134 -0
- data/lib/sendgrid4r/cli/campaign/contact/contact.rb +25 -0
- data/lib/sendgrid4r/cli/campaign/contact/custom_field.rb +42 -0
- data/lib/sendgrid4r/cli/campaign/contact/list.rb +71 -0
- data/lib/sendgrid4r/cli/campaign/contact/recipient.rb +78 -0
- data/lib/sendgrid4r/cli/campaign/contact/reserved_field.rb +17 -0
- data/lib/sendgrid4r/cli/campaign/contact/segment.rb +96 -0
- data/lib/sendgrid4r/cli/campaign/sender.rb +83 -0
- data/lib/sendgrid4r/cli/cancel_schedules/batch_id.rb +23 -0
- data/lib/sendgrid4r/cli/cancel_schedules/cancel_schedule.rb +55 -0
- data/lib/sendgrid4r/cli/category.rb +16 -0
- data/lib/sendgrid4r/cli/ipam/activity.rb +16 -0
- data/lib/sendgrid4r/cli/ipam/ipam.rb +14 -0
- data/lib/sendgrid4r/cli/ipam/whitelist.rb +39 -0
- data/lib/sendgrid4r/cli/ips/address.rb +48 -0
- data/lib/sendgrid4r/cli/ips/ip.rb +17 -0
- data/lib/sendgrid4r/cli/ips/pool.rb +48 -0
- data/lib/sendgrid4r/cli/ips/warmup.rb +39 -0
- data/lib/sendgrid4r/cli/mail.rb +34 -0
- data/lib/sendgrid4r/cli/settings/enforced_tls.rb +24 -0
- data/lib/sendgrid4r/cli/settings/mail.rb +171 -0
- data/lib/sendgrid4r/cli/settings/partner.rb +34 -0
- data/lib/sendgrid4r/cli/settings/settings.rb +20 -0
- data/lib/sendgrid4r/cli/settings/tracking.rb +92 -0
- data/lib/sendgrid4r/cli/sg.rb +55 -0
- data/lib/sendgrid4r/cli/sg_thor.rb +34 -0
- data/lib/sendgrid4r/cli/stats/advanced.rb +72 -0
- data/lib/sendgrid4r/cli/stats/category.rb +35 -0
- data/lib/sendgrid4r/cli/stats/global.rb +18 -0
- data/lib/sendgrid4r/cli/stats/parse.rb +18 -0
- data/lib/sendgrid4r/cli/stats/stats.rb +23 -0
- data/lib/sendgrid4r/cli/stats/subuser.rb +67 -0
- data/lib/sendgrid4r/cli/subusers/monitor.rb +44 -0
- data/lib/sendgrid4r/cli/subusers/subuser.rb +77 -0
- data/lib/sendgrid4r/cli/suppressions/block.rb +43 -0
- data/lib/sendgrid4r/cli/suppressions/bounce.rb +41 -0
- data/lib/sendgrid4r/cli/suppressions/global_unsubscribe.rb +43 -0
- data/lib/sendgrid4r/cli/suppressions/group.rb +56 -0
- data/lib/sendgrid4r/cli/suppressions/group_unsubscribe.rb +34 -0
- data/lib/sendgrid4r/cli/suppressions/invalid_email.rb +43 -0
- data/lib/sendgrid4r/cli/suppressions/spam_report.rb +43 -0
- data/lib/sendgrid4r/cli/suppressions/suppression.rb +36 -0
- data/lib/sendgrid4r/cli/templates/template.rb +51 -0
- data/lib/sendgrid4r/cli/templates/version.rb +78 -0
- data/lib/sendgrid4r/cli/user.rb +86 -0
- data/lib/sendgrid4r/cli/webhooks/event.rb +53 -0
- data/lib/sendgrid4r/cli/webhooks/parse.rb +15 -0
- data/lib/sendgrid4r/cli/webhooks/webhook.rb +14 -0
- data/lib/sendgrid4r/cli/whitelabel/domain.rb +117 -0
- data/lib/sendgrid4r/cli/whitelabel/ip.rb +52 -0
- data/lib/sendgrid4r/cli/whitelabel/link.rb +96 -0
- data/lib/sendgrid4r/cli/whitelabel/whitelabel.rb +17 -0
- data/lib/sendgrid4r/client.rb +4 -1
- data/lib/sendgrid4r/factory/campaign_factory.rb +1 -1
- data/lib/sendgrid4r/factory/condition_factory.rb +2 -2
- data/lib/sendgrid4r/factory/event_factory.rb +21 -0
- data/lib/sendgrid4r/rest/api_keys_management/api_keys.rb +5 -5
- data/lib/sendgrid4r/rest/api_keys_management/permissions.rb +3 -1
- data/lib/sendgrid4r/rest/blocks.rb +2 -2
- data/lib/sendgrid4r/rest/bounces.rb +2 -2
- data/lib/sendgrid4r/rest/cancel_scheduled_sends.rb +12 -4
- data/lib/sendgrid4r/rest/categories.rb +1 -1
- data/lib/sendgrid4r/rest/email_activity.rb +1 -1
- data/lib/sendgrid4r/rest/invalid_emails.rb +2 -2
- data/lib/sendgrid4r/rest/ip_access_management.rb +12 -4
- data/lib/sendgrid4r/rest/ips/addresses.rb +4 -4
- data/lib/sendgrid4r/rest/ips/pools.rb +4 -4
- data/lib/sendgrid4r/rest/ips/warmup.rb +3 -3
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb +9 -3
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/lists.rb +7 -5
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/recipients.rb +22 -7
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb +3 -1
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/segments.rb +7 -5
- data/lib/sendgrid4r/rest/marketing_campaigns/marketing_campaigns.rb +8 -8
- data/lib/sendgrid4r/rest/marketing_campaigns/senders.rb +4 -4
- data/lib/sendgrid4r/rest/request.rb +6 -4
- data/lib/sendgrid4r/rest/settings/enforced_tls.rb +6 -2
- data/lib/sendgrid4r/rest/settings/mail.rb +71 -17
- data/lib/sendgrid4r/rest/settings/partner.rb +3 -3
- data/lib/sendgrid4r/rest/settings/tracking.rb +17 -9
- data/lib/sendgrid4r/rest/sm/global_unsubscribes.rb +5 -3
- data/lib/sendgrid4r/rest/sm/groups.rb +4 -4
- data/lib/sendgrid4r/rest/sm/suppressions.rb +6 -3
- data/lib/sendgrid4r/rest/spam_reports.rb +2 -2
- data/lib/sendgrid4r/rest/stats/advanced.rb +8 -8
- data/lib/sendgrid4r/rest/stats/category.rb +2 -2
- data/lib/sendgrid4r/rest/stats/global.rb +1 -1
- data/lib/sendgrid4r/rest/stats/parse.rb +1 -1
- data/lib/sendgrid4r/rest/stats/subuser.rb +4 -4
- data/lib/sendgrid4r/rest/subusers.rb +15 -10
- data/lib/sendgrid4r/rest/transactional_templates/templates.rb +12 -4
- data/lib/sendgrid4r/rest/transactional_templates/versions.rb +4 -4
- data/lib/sendgrid4r/rest/users.rb +9 -9
- data/lib/sendgrid4r/rest/webhooks/event.rb +2 -2
- data/lib/sendgrid4r/rest/webhooks/parse.rb +1 -1
- data/lib/sendgrid4r/rest/whitelabel/domains.rb +10 -11
- data/lib/sendgrid4r/rest/whitelabel/ips.rb +4 -4
- data/lib/sendgrid4r/rest/whitelabel/links.rb +8 -8
- data/lib/sendgrid4r/version.rb +1 -1
- data/lib/sendgrid4r.rb +57 -0
- data/sendgrid4r.gemspec +3 -1
- data/spec/cli/api_keys/api_key_spec.rb +77 -0
- data/spec/cli/api_keys/permission_spec.rb +29 -0
- data/spec/cli/campaign/campaign_spec.rb +136 -0
- data/spec/cli/campaign/contact/custom_field_spec.rb +48 -0
- data/spec/cli/campaign/contact/list_spec.rb +88 -0
- data/spec/cli/campaign/contact/recipient_spec.rb +93 -0
- data/spec/cli/campaign/contact/reserved_field_spec.rb +20 -0
- data/spec/cli/campaign/contact/segment_spec.rb +93 -0
- data/spec/cli/campaign/sender_spec.rb +83 -0
- data/spec/cli/cancel_schedules/batch_id_spec.rb +33 -0
- data/spec/cli/cancel_schedules/cancel_schedule_spec.rb +69 -0
- data/spec/cli/category_spec.rb +23 -0
- data/spec/cli/ipam/activity_spec.rb +21 -0
- data/spec/cli/ipam/ipam_spec.rb +26 -0
- data/spec/cli/ipam/whitelist_spec.rb +47 -0
- data/spec/cli/ips/address_spec.rb +57 -0
- data/spec/cli/ips/ip_spec.rb +33 -0
- data/spec/cli/ips/pool_spec.rb +57 -0
- data/spec/cli/ips/warmup_spec.rb +47 -0
- data/spec/cli/mail_spec.rb +37 -0
- data/spec/cli/settings/enforced_tls_spec.rb +30 -0
- data/spec/cli/settings/mail_spec.rb +255 -0
- data/spec/cli/settings/partner_spec.rb +47 -0
- data/spec/cli/settings/settings_spec.rb +40 -0
- data/spec/cli/settings/tracking_spec.rb +128 -0
- data/spec/cli/sg_spec.rb +82 -0
- data/spec/cli/stats/advanced_spec.rb +137 -0
- data/spec/cli/stats/category_spec.rb +57 -0
- data/spec/cli/stats/global_spec.rb +32 -0
- data/spec/cli/stats/parse_spec.rb +32 -0
- data/spec/cli/stats/stats_spec.rb +40 -0
- data/spec/cli/stats/subuser_spec.rb +104 -0
- data/spec/cli/subusers/monitor_spec.rb +52 -0
- data/spec/cli/subusers/subuser_spec.rb +88 -0
- data/spec/cli/suppressions/block_spec.rb +60 -0
- data/spec/cli/suppressions/bounce_spec.rb +58 -0
- data/spec/cli/suppressions/global_unsubscribe_spec.rb +59 -0
- data/spec/cli/suppressions/group_spec.rb +69 -0
- data/spec/cli/suppressions/group_unsubscribe_spec.rb +41 -0
- data/spec/cli/suppressions/invalid_email_spec.rb +60 -0
- data/spec/cli/suppressions/spam_report_spec.rb +60 -0
- data/spec/cli/suppressions/suppression_spec.rb +68 -0
- data/spec/cli/templates/template_spec.rb +65 -0
- data/spec/cli/templates/version_spec.rb +71 -0
- data/spec/cli/user_spec.rb +82 -0
- data/spec/cli/webhooks/event_spec.rb +67 -0
- data/spec/cli/webhooks/parse_spec.rb +20 -0
- data/spec/cli/webhooks/webhook_spec.rb +28 -0
- data/spec/cli/whitelabel/domain_spec.rb +112 -0
- data/spec/cli/whitelabel/ip_spec.rb +61 -0
- data/spec/cli/whitelabel/link_spec.rb +110 -0
- data/spec/cli/whitelabel/whitelabel_spec.rb +27 -0
- data/spec/client_spec.rb +1 -1
- data/spec/factory/campaign_factory_spec.rb +2 -2
- data/spec/factory/event_factory_spec.rb +36 -0
- data/spec/rest/api_keys_management/api_keys_spec.rb +24 -24
- data/spec/rest/api_keys_management/permissions_spec.rb +8 -10
- data/spec/rest/blocks_spec.rb +14 -18
- data/spec/rest/bounces_spec.rb +28 -32
- data/spec/rest/cancel_scheduled_sends_spec.rb +15 -19
- data/spec/rest/categories_spec.rb +8 -10
- data/spec/rest/email_activity_spec.rb +18 -22
- data/spec/rest/invalid_emails_spec.rb +19 -23
- data/spec/rest/ip_access_management_spec.rb +46 -52
- data/spec/rest/ips/addresses_spec.rb +21 -25
- data/spec/rest/ips/pools_spec.rb +20 -24
- data/spec/rest/ips/warmup_spec.rb +11 -15
- data/spec/rest/marketing_campaigns/contacts/custom_fields_spec.rb +26 -30
- data/spec/rest/marketing_campaigns/contacts/lists_spec.rb +58 -66
- data/spec/rest/marketing_campaigns/contacts/recipients_spec.rb +77 -87
- data/spec/rest/marketing_campaigns/contacts/reserved_fields_spec.rb +46 -50
- data/spec/rest/marketing_campaigns/contacts/segments_spec.rb +75 -78
- data/spec/rest/marketing_campaigns/marketing_campaigns_spec.rb +92 -94
- data/spec/rest/marketing_campaigns/senders_spec.rb +51 -51
- data/spec/rest/settings/enforced_tls_spec.rb +5 -7
- data/spec/rest/settings/mail_spec.rb +89 -60
- data/spec/rest/settings/partner_spec.rb +5 -7
- data/spec/rest/settings/settings_spec.rb +18 -22
- data/spec/rest/settings/tracking_spec.rb +26 -34
- data/spec/rest/sm/global_unsubscribes_spec.rb +9 -13
- data/spec/rest/sm/groups_spec.rb +24 -28
- data/spec/rest/sm/sm_spec.rb +15 -15
- data/spec/rest/sm/suppressions_spec.rb +34 -44
- data/spec/rest/spam_reports_spec.rb +19 -23
- data/spec/rest/stats/advanced_spec.rb +4 -4
- data/spec/rest/stats/global_spec.rb +0 -21
- data/spec/rest/subusers_spec.rb +38 -47
- data/spec/rest/transactional_templates/templates_spec.rb +29 -33
- data/spec/rest/transactional_templates/versions_spec.rb +11 -93
- data/spec/rest/users_spec.rb +42 -54
- data/spec/rest/webhooks/event_spec.rb +16 -18
- data/spec/rest/webhooks/parse_spec.rb +16 -20
- data/spec/rest/whitelabel/domains_spec.rb +93 -100
- data/spec/rest/whitelabel/ips_spec.rb +28 -32
- data/spec/rest/whitelabel/links_spec.rb +41 -45
- metadata +181 -4
|
@@ -150,79 +150,71 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
let(:list) do
|
|
153
|
-
|
|
154
|
-
'
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
'}'
|
|
159
|
-
)
|
|
153
|
+
'{'\
|
|
154
|
+
'"id": 1,'\
|
|
155
|
+
'"name": "listname",'\
|
|
156
|
+
'"recipient_count": 0'\
|
|
157
|
+
'}'
|
|
160
158
|
end
|
|
161
159
|
|
|
162
160
|
let(:lists) do
|
|
163
|
-
|
|
164
|
-
'
|
|
165
|
-
'
|
|
166
|
-
'
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
'}'
|
|
173
|
-
)
|
|
161
|
+
'{'\
|
|
162
|
+
'"lists": ['\
|
|
163
|
+
'{'\
|
|
164
|
+
'"id": 1,'\
|
|
165
|
+
'"name": "the jones",'\
|
|
166
|
+
'"recipient_count": 1'\
|
|
167
|
+
'}'\
|
|
168
|
+
']'\
|
|
169
|
+
'}'
|
|
174
170
|
end
|
|
175
171
|
|
|
176
172
|
let(:recipient) do
|
|
177
|
-
|
|
178
|
-
'
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
'
|
|
189
|
-
'
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
'}'
|
|
197
|
-
)
|
|
173
|
+
'{'\
|
|
174
|
+
'"created_at": 1422313607,'\
|
|
175
|
+
'"email": "jones@example.com",'\
|
|
176
|
+
'"first_name": null,'\
|
|
177
|
+
'"id": "jones@example.com",'\
|
|
178
|
+
'"last_clicked": null,'\
|
|
179
|
+
'"last_emailed": null,'\
|
|
180
|
+
'"last_name": "Jones",'\
|
|
181
|
+
'"last_opened": null,'\
|
|
182
|
+
'"updated_at": 1422313790,'\
|
|
183
|
+
'"custom_fields": ['\
|
|
184
|
+
'{'\
|
|
185
|
+
'"id": 23,'\
|
|
186
|
+
'"name": "pet",'\
|
|
187
|
+
'"value": "Fluffy",'\
|
|
188
|
+
'"type": "text"'\
|
|
189
|
+
'}'\
|
|
190
|
+
']'\
|
|
191
|
+
'}'
|
|
198
192
|
end
|
|
199
193
|
|
|
200
194
|
let(:recipients) do
|
|
201
|
-
|
|
202
|
-
'
|
|
203
|
-
'
|
|
204
|
-
'
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
'
|
|
215
|
-
'
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
'}'
|
|
225
|
-
)
|
|
195
|
+
'{'\
|
|
196
|
+
'"recipients": ['\
|
|
197
|
+
'{'\
|
|
198
|
+
'"created_at": 1422313607,'\
|
|
199
|
+
'"email": "jones@example.com",'\
|
|
200
|
+
'"first_name": null,'\
|
|
201
|
+
'"id": "jones@example.com",'\
|
|
202
|
+
'"last_clicked": null,'\
|
|
203
|
+
'"last_emailed": null,'\
|
|
204
|
+
'"last_name": "Jones",'\
|
|
205
|
+
'"last_opened": null,'\
|
|
206
|
+
'"updated_at": 1422313790,'\
|
|
207
|
+
'"custom_fields": ['\
|
|
208
|
+
'{'\
|
|
209
|
+
'"id": 23,'\
|
|
210
|
+
'"name": "pet",'\
|
|
211
|
+
'"value": "Fluffy",'\
|
|
212
|
+
'"type": "text"'\
|
|
213
|
+
'}'\
|
|
214
|
+
']'\
|
|
215
|
+
'}'\
|
|
216
|
+
']'\
|
|
217
|
+
'}'
|
|
226
218
|
end
|
|
227
219
|
|
|
228
220
|
it '#post_list' do
|
|
@@ -288,7 +280,7 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
288
280
|
end
|
|
289
281
|
|
|
290
282
|
it 'creates list instance' do
|
|
291
|
-
actual = Lists.create_list(list)
|
|
283
|
+
actual = Lists.create_list(JSON.parse(list))
|
|
292
284
|
expect(actual).to be_a(Lists::List)
|
|
293
285
|
expect(actual.id).to eq(1)
|
|
294
286
|
expect(actual.name).to eq('listname')
|
|
@@ -296,7 +288,7 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
296
288
|
end
|
|
297
289
|
|
|
298
290
|
it 'creates lists instance' do
|
|
299
|
-
actual = Lists.create_lists(lists)
|
|
291
|
+
actual = Lists.create_lists(JSON.parse(lists))
|
|
300
292
|
expect(actual.lists).to be_a(Array)
|
|
301
293
|
actual.lists.each do |list|
|
|
302
294
|
expect(list).to be_a(Lists::List)
|
|
@@ -128,102 +128,92 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
let(:recipient) do
|
|
131
|
-
|
|
132
|
-
'
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
'}'
|
|
151
|
-
)
|
|
131
|
+
'{'\
|
|
132
|
+
'"created_at": 1422313607,'\
|
|
133
|
+
'"email": "jones@example.com",'\
|
|
134
|
+
'"first_name": null,'\
|
|
135
|
+
'"id": "YUBh",'\
|
|
136
|
+
'"last_clicked": null,'\
|
|
137
|
+
'"last_emailed": null,'\
|
|
138
|
+
'"last_name": "Jones",'\
|
|
139
|
+
'"last_opened": null,'\
|
|
140
|
+
'"updated_at": 1422313790,'\
|
|
141
|
+
'"custom_fields": ['\
|
|
142
|
+
'{'\
|
|
143
|
+
'"id": 23,'\
|
|
144
|
+
'"name": "pet",'\
|
|
145
|
+
'"value": "Fluffy",'\
|
|
146
|
+
'"type": "text"'\
|
|
147
|
+
'}'\
|
|
148
|
+
']'\
|
|
149
|
+
'}'
|
|
152
150
|
end
|
|
153
151
|
|
|
154
152
|
let(:recipients) do
|
|
155
|
-
|
|
156
|
-
'
|
|
157
|
-
'
|
|
158
|
-
'
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
'
|
|
169
|
-
'
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
'}'
|
|
179
|
-
)
|
|
153
|
+
'{'\
|
|
154
|
+
'"recipients": ['\
|
|
155
|
+
'{'\
|
|
156
|
+
'"created_at": 1422313607,'\
|
|
157
|
+
'"email": "jones@example.com",'\
|
|
158
|
+
'"first_name": null,'\
|
|
159
|
+
'"id": "YUBh",'\
|
|
160
|
+
'"last_clicked": null,'\
|
|
161
|
+
'"last_emailed": null,'\
|
|
162
|
+
'"last_name": "Jones",'\
|
|
163
|
+
'"last_opened": null,'\
|
|
164
|
+
'"updated_at": 1422313790,'\
|
|
165
|
+
'"custom_fields": ['\
|
|
166
|
+
'{'\
|
|
167
|
+
'"id": 23,'\
|
|
168
|
+
'"name": "pet",'\
|
|
169
|
+
'"value": "Fluffy",'\
|
|
170
|
+
'"type": "text"'\
|
|
171
|
+
'}'\
|
|
172
|
+
']'\
|
|
173
|
+
'}'\
|
|
174
|
+
']'\
|
|
175
|
+
'}'
|
|
180
176
|
end
|
|
181
177
|
|
|
182
178
|
let(:recipient_count) do
|
|
183
|
-
|
|
184
|
-
'
|
|
185
|
-
|
|
186
|
-
'}'
|
|
187
|
-
)
|
|
179
|
+
'{'\
|
|
180
|
+
'"recipient_count": 2'\
|
|
181
|
+
'}'
|
|
188
182
|
end
|
|
189
183
|
|
|
190
184
|
let(:lists) do
|
|
191
|
-
|
|
192
|
-
'
|
|
193
|
-
'
|
|
194
|
-
'
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
'}'
|
|
201
|
-
)
|
|
185
|
+
'{'\
|
|
186
|
+
'"lists": ['\
|
|
187
|
+
'{'\
|
|
188
|
+
'"id": 1,'\
|
|
189
|
+
'"name": "the jones",'\
|
|
190
|
+
'"recipient_count": 1'\
|
|
191
|
+
'}'\
|
|
192
|
+
']'\
|
|
193
|
+
'}'
|
|
202
194
|
end
|
|
203
195
|
|
|
204
196
|
let(:result) do
|
|
205
|
-
|
|
206
|
-
'
|
|
207
|
-
|
|
208
|
-
'
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
'"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
'
|
|
218
|
-
'
|
|
219
|
-
|
|
220
|
-
'
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
'}'
|
|
226
|
-
)
|
|
197
|
+
'{'\
|
|
198
|
+
'"error_count": 1,'\
|
|
199
|
+
'"error_indices": ['\
|
|
200
|
+
'2'\
|
|
201
|
+
'],'\
|
|
202
|
+
'"new_count": 2,'\
|
|
203
|
+
'"persisted_recipients": ['\
|
|
204
|
+
'"YUBh",'\
|
|
205
|
+
'"bWlsbGVyQG1pbGxlci50ZXN0"'\
|
|
206
|
+
'],'\
|
|
207
|
+
'"updated_count": 0,'\
|
|
208
|
+
'"errors": ['\
|
|
209
|
+
'{'\
|
|
210
|
+
'"message": "Invalid email.",'\
|
|
211
|
+
'"error_indices": ['\
|
|
212
|
+
'2'\
|
|
213
|
+
']'\
|
|
214
|
+
'}'\
|
|
215
|
+
']'\
|
|
216
|
+
'}'
|
|
227
217
|
end
|
|
228
218
|
|
|
229
219
|
it '#post_recipients' do
|
|
@@ -282,7 +272,7 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
282
272
|
|
|
283
273
|
it 'creates recipient instance' do
|
|
284
274
|
actual = Recipients.create_recipient(
|
|
285
|
-
recipient
|
|
275
|
+
JSON.parse(recipient)
|
|
286
276
|
)
|
|
287
277
|
expect(actual).to be_a(Recipients::Recipient)
|
|
288
278
|
expect(actual.created_at).to eq(Time.at(1422313607))
|
|
@@ -302,7 +292,7 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
302
292
|
end
|
|
303
293
|
|
|
304
294
|
it 'creates recipients instance' do
|
|
305
|
-
actual = Recipients.create_recipients(recipients)
|
|
295
|
+
actual = Recipients.create_recipients(JSON.parse(recipients))
|
|
306
296
|
expect(actual.recipients).to be_a(Array)
|
|
307
297
|
actual.recipients.each do |recipient|
|
|
308
298
|
expect(recipient).to be_a(Recipients::Recipient)
|
|
@@ -310,7 +300,7 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
310
300
|
end
|
|
311
301
|
|
|
312
302
|
it 'creates result instance' do
|
|
313
|
-
actual = Recipients.create_result(result)
|
|
303
|
+
actual = Recipients.create_result(JSON.parse(result))
|
|
314
304
|
expect(actual.error_count).to eq(1)
|
|
315
305
|
expect(actual.error_indices).to be_a(Array)
|
|
316
306
|
expect(actual.error_indices[0]).to eq(2)
|
|
@@ -41,57 +41,53 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
let(:field) do
|
|
44
|
-
|
|
45
|
-
'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'}'
|
|
49
|
-
)
|
|
44
|
+
'{'\
|
|
45
|
+
'"name": "first_name",'\
|
|
46
|
+
'"type": "text"'\
|
|
47
|
+
'}'
|
|
50
48
|
end
|
|
51
49
|
|
|
52
50
|
let(:fields) do
|
|
53
|
-
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
'
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
'}'
|
|
94
|
-
)
|
|
51
|
+
'{'\
|
|
52
|
+
'"reserved_fields": ['\
|
|
53
|
+
'{'\
|
|
54
|
+
'"name": "first_name",'\
|
|
55
|
+
'"type": "text"'\
|
|
56
|
+
'},'\
|
|
57
|
+
'{'\
|
|
58
|
+
'"name": "last_name",'\
|
|
59
|
+
'"type": "text"'\
|
|
60
|
+
'},'\
|
|
61
|
+
'{'\
|
|
62
|
+
'"name": "email",'\
|
|
63
|
+
'"type": "text"'\
|
|
64
|
+
'},'\
|
|
65
|
+
'{'\
|
|
66
|
+
'"name": "created_at",'\
|
|
67
|
+
'"type": "date"'\
|
|
68
|
+
'},'\
|
|
69
|
+
'{'\
|
|
70
|
+
'"name": "updated_at",'\
|
|
71
|
+
'"type": "date"'\
|
|
72
|
+
'},'\
|
|
73
|
+
'{'\
|
|
74
|
+
'"name": "last_emailed",'\
|
|
75
|
+
'"type": "date"'\
|
|
76
|
+
'},'\
|
|
77
|
+
'{'\
|
|
78
|
+
'"name": "last_clicked",'\
|
|
79
|
+
'"type": "date"'\
|
|
80
|
+
'},'\
|
|
81
|
+
'{'\
|
|
82
|
+
'"name": "last_opened",'\
|
|
83
|
+
'"type": "date"'\
|
|
84
|
+
'},'\
|
|
85
|
+
'{'\
|
|
86
|
+
'"name": "my_custom_field",'\
|
|
87
|
+
'"type": "text"'\
|
|
88
|
+
'}'\
|
|
89
|
+
']'\
|
|
90
|
+
'}'
|
|
95
91
|
end
|
|
96
92
|
|
|
97
93
|
it '#get_reserved_fields' do
|
|
@@ -101,13 +97,13 @@ module SendGrid4r::REST::MarketingCampaigns::Contacts
|
|
|
101
97
|
end
|
|
102
98
|
|
|
103
99
|
it 'creates field instance' do
|
|
104
|
-
actual = CustomFields.create_field(field)
|
|
100
|
+
actual = CustomFields.create_field(JSON.parse(field))
|
|
105
101
|
expect(actual.name).to eq('first_name')
|
|
106
102
|
expect(actual.type).to eq('text')
|
|
107
103
|
end
|
|
108
104
|
|
|
109
105
|
it 'creates fields instance' do
|
|
110
|
-
actual = ReservedFields.create_fields(fields)
|
|
106
|
+
actual = ReservedFields.create_fields(JSON.parse(fields))
|
|
111
107
|
expect(actual).to be_a(ReservedFields::Fields)
|
|
112
108
|
expect(actual.reserved_fields).to be_a(Array)
|
|
113
109
|
actual.reserved_fields.each do |field|
|