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
|
@@ -91,40 +91,36 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
let(:template) do
|
|
94
|
-
|
|
95
|
-
'
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
'}'
|
|
100
|
-
)
|
|
94
|
+
'{'\
|
|
95
|
+
'"id": "733ba07f-ead1-41fc-933a-3976baa23716",'\
|
|
96
|
+
'"name": "example_name",'\
|
|
97
|
+
'"versions": []'\
|
|
98
|
+
'}'
|
|
101
99
|
end
|
|
102
100
|
|
|
103
101
|
let(:templates) do
|
|
104
|
-
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
'}'
|
|
127
|
-
)
|
|
102
|
+
'{'\
|
|
103
|
+
'"templates": ['\
|
|
104
|
+
'{'\
|
|
105
|
+
'"id": "e8ac01d5-a07a-4a71-b14c-4721136fe6aa",'\
|
|
106
|
+
'"name": "example template name",'\
|
|
107
|
+
'"versions": ['\
|
|
108
|
+
'{'\
|
|
109
|
+
'"id": "de37d11b-082a-42c0-9884-c0c143015a47",'\
|
|
110
|
+
'"user_id": 1234,'\
|
|
111
|
+
'"template_id": "d51480ba-ca3f-465c-bc3e-ceb71d73c38d",'\
|
|
112
|
+
'"active": 1,'\
|
|
113
|
+
'"name": "example version",'\
|
|
114
|
+
'"html_content": "<%body%><strong>Click '\
|
|
115
|
+
'to Reset</strong>",'\
|
|
116
|
+
'"plain_content": "Click to Reset<%body%>",'\
|
|
117
|
+
'"subject": "<%subject%>",'\
|
|
118
|
+
'"updated_at": "2014-05-22 20:05:21"'\
|
|
119
|
+
'}'\
|
|
120
|
+
']'\
|
|
121
|
+
'}'\
|
|
122
|
+
']'\
|
|
123
|
+
'}'
|
|
128
124
|
end
|
|
129
125
|
|
|
130
126
|
it '#post_template' do
|
|
@@ -159,7 +155,7 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
159
155
|
|
|
160
156
|
it 'creates template instance' do
|
|
161
157
|
actual = SendGrid4r::REST::TransactionalTemplates.create_template(
|
|
162
|
-
template
|
|
158
|
+
JSON.parse(template)
|
|
163
159
|
)
|
|
164
160
|
expect(actual).to be_a(Template)
|
|
165
161
|
expect(actual.id).to eq('733ba07f-ead1-41fc-933a-3976baa23716')
|
|
@@ -169,7 +165,7 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
169
165
|
|
|
170
166
|
it 'creates templates instance' do
|
|
171
167
|
actual = SendGrid4r::REST::TransactionalTemplates.create_templates(
|
|
172
|
-
templates
|
|
168
|
+
JSON.parse(templates)
|
|
173
169
|
)
|
|
174
170
|
expect(actual).to be_a(Templates)
|
|
175
171
|
expect(actual.templates).to be_a(Array)
|
|
@@ -77,86 +77,6 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
|
-
|
|
81
|
-
context 'with block call' do
|
|
82
|
-
it '#post_version' do
|
|
83
|
-
ver2 = @factory.create(name: @version2_name)
|
|
84
|
-
@client.post_version(
|
|
85
|
-
template_id: @template.id, version: ver2
|
|
86
|
-
) do |resp, req, res|
|
|
87
|
-
resp = Versions.create_version(JSON.parse(resp))
|
|
88
|
-
expect(resp).to be_a(Versions::Version)
|
|
89
|
-
expect(req).to be_a(RestClient::Request)
|
|
90
|
-
expect(res).to be_a(Net::HTTPCreated)
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it '#post_version without body and subject tag' do
|
|
95
|
-
ver2 = @factory.create(
|
|
96
|
-
name: @version2_name, subject: 'Hello',
|
|
97
|
-
html_content: 'This is the body.',
|
|
98
|
-
plain_content: 'This is the body.'
|
|
99
|
-
)
|
|
100
|
-
@client.post_version(
|
|
101
|
-
template_id: @template.id, version: ver2
|
|
102
|
-
) do |resp, req, res|
|
|
103
|
-
resp = Versions.create_version(JSON.parse(resp))
|
|
104
|
-
expect(resp).to be_a(Versions::Version)
|
|
105
|
-
expect(req).to be_a(RestClient::Request)
|
|
106
|
-
expect(res).to be_a(Net::HTTPCreated)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it '#activate_version' do
|
|
111
|
-
@client.activate_version(
|
|
112
|
-
template_id: @template.id, version_id: @version1.id
|
|
113
|
-
) do |resp, req, res|
|
|
114
|
-
resp = Versions.create_version(JSON.parse(resp))
|
|
115
|
-
expect(resp).to be_a(Versions::Version)
|
|
116
|
-
expect(req).to be_a(RestClient::Request)
|
|
117
|
-
expect(res).to be_a(Net::HTTPOK)
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
it '#get_version' do
|
|
122
|
-
@client.get_version(
|
|
123
|
-
template_id: @template.id, version_id: @version1.id
|
|
124
|
-
) do |resp, req, res|
|
|
125
|
-
resp = Versions.create_version(JSON.parse(resp))
|
|
126
|
-
expect(resp).to be_a(Versions::Version)
|
|
127
|
-
expect(req).to be_a(RestClient::Request)
|
|
128
|
-
expect(res).to be_a(Net::HTTPOK)
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
it '#patch_version' do
|
|
133
|
-
edit_ver1 = @version1.dup
|
|
134
|
-
edit_ver1.name = 'edit_version'
|
|
135
|
-
edit_ver1.subject = 'edit<%subject%>edit'
|
|
136
|
-
edit_ver1.html_content = 'edit<%body%>edit'
|
|
137
|
-
edit_ver1.plain_content = 'edit<%body%>edit'
|
|
138
|
-
edit_ver1.active = 0
|
|
139
|
-
@client.patch_version(
|
|
140
|
-
template_id: @template.id, version_id: @version1.id,
|
|
141
|
-
version: edit_ver1
|
|
142
|
-
) do |resp, req, res|
|
|
143
|
-
resp = Versions.create_version(JSON.parse(resp))
|
|
144
|
-
expect(resp).to be_a(Versions::Version)
|
|
145
|
-
expect(req).to be_a(RestClient::Request)
|
|
146
|
-
expect(res).to be_a(Net::HTTPOK)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
it '#delete_version' do
|
|
151
|
-
@client.delete_version(
|
|
152
|
-
template_id: @template.id, version_id: @version1.id
|
|
153
|
-
) do |resp, req, res|
|
|
154
|
-
expect(resp).to eq('')
|
|
155
|
-
expect(req).to be_a(RestClient::Request)
|
|
156
|
-
expect(res).to be_a(Net::HTTPNoContent)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
80
|
end
|
|
161
81
|
|
|
162
82
|
describe 'unit test', :ut do
|
|
@@ -165,18 +85,16 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
165
85
|
end
|
|
166
86
|
|
|
167
87
|
let(:version) do
|
|
168
|
-
|
|
169
|
-
'
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
'}'
|
|
179
|
-
)
|
|
88
|
+
'{'\
|
|
89
|
+
'"id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3",'\
|
|
90
|
+
'"template_id": "ddb96bbc-9b92-425e-8979-99464621b543",'\
|
|
91
|
+
'"active": 1,'\
|
|
92
|
+
'"name": "example_version_name",'\
|
|
93
|
+
'"html_content": "<%body%>",'\
|
|
94
|
+
'"plain_content": "<%body%>",'\
|
|
95
|
+
'"subject": "<%subject%>",'\
|
|
96
|
+
'"updated_at": "2014-03-19 18:56:33"'\
|
|
97
|
+
'}'
|
|
180
98
|
end
|
|
181
99
|
|
|
182
100
|
it '#post_version' do
|
|
@@ -212,7 +130,7 @@ module SendGrid4r::REST::TransactionalTemplates
|
|
|
212
130
|
end
|
|
213
131
|
|
|
214
132
|
it 'creates version instance' do
|
|
215
|
-
actual = Versions.create_version(version)
|
|
133
|
+
actual = Versions.create_version(JSON.parse(version))
|
|
216
134
|
expect(actual).to be_a(Versions::Version)
|
|
217
135
|
expect(actual.id).to eq('8aefe0ee-f12b-4575-b5b7-c97e21cb36f3')
|
|
218
136
|
expect(actual.template_id).to eq('ddb96bbc-9b92-425e-8979-99464621b543')
|
data/spec/rest/users_spec.rb
CHANGED
|
@@ -70,69 +70,57 @@ module SendGrid4r::REST
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
let(:profile) do
|
|
73
|
-
|
|
74
|
-
'
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'}'
|
|
86
|
-
)
|
|
73
|
+
'{'\
|
|
74
|
+
'"address":"814 West Chapman Avenue",'\
|
|
75
|
+
'"city":"Orange",'\
|
|
76
|
+
'"company":"SendGrid",'\
|
|
77
|
+
'"country":"US",'\
|
|
78
|
+
'"first_name":"Test",'\
|
|
79
|
+
'"last_name":"User",'\
|
|
80
|
+
'"phone":"555-555-5555",'\
|
|
81
|
+
'"state":"CA",'\
|
|
82
|
+
'"website":"http://www.sendgrid.com",'\
|
|
83
|
+
'"zip":"92868"'\
|
|
84
|
+
'}'
|
|
87
85
|
end
|
|
88
86
|
|
|
89
87
|
let(:account) do
|
|
90
|
-
|
|
91
|
-
'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
'}'
|
|
95
|
-
)
|
|
88
|
+
'{'\
|
|
89
|
+
'"type": "free",'\
|
|
90
|
+
'"reputation": 99.7'\
|
|
91
|
+
'}'
|
|
96
92
|
end
|
|
97
93
|
|
|
98
94
|
let(:email) do
|
|
99
|
-
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
'}'
|
|
103
|
-
)
|
|
95
|
+
'{'\
|
|
96
|
+
'"email": "test@example.com"'\
|
|
97
|
+
'}'
|
|
104
98
|
end
|
|
105
99
|
|
|
106
100
|
let(:username) do
|
|
107
|
-
|
|
108
|
-
'
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'}'
|
|
112
|
-
)
|
|
101
|
+
'{'\
|
|
102
|
+
'"username": "test_username",'\
|
|
103
|
+
'"user_id": 1'\
|
|
104
|
+
'}'
|
|
113
105
|
end
|
|
114
106
|
|
|
115
107
|
let(:credits) do
|
|
116
|
-
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
'}'
|
|
126
|
-
)
|
|
108
|
+
'{'\
|
|
109
|
+
'"remain": 200,'\
|
|
110
|
+
'"total": 200,'\
|
|
111
|
+
'"overage": 0,'\
|
|
112
|
+
'"used": 0,'\
|
|
113
|
+
'"last_reset": "2013-01-01",'\
|
|
114
|
+
'"next_reset": "2013-02-01",'\
|
|
115
|
+
'"reset_frequency": "monthly"'\
|
|
116
|
+
'}'
|
|
127
117
|
end
|
|
128
118
|
|
|
129
119
|
let(:password) do
|
|
130
|
-
|
|
131
|
-
'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
'}'
|
|
135
|
-
)
|
|
120
|
+
'{'\
|
|
121
|
+
'"new_password": "new_password",'\
|
|
122
|
+
'"old_password": "old_password"'\
|
|
123
|
+
'}'
|
|
136
124
|
end
|
|
137
125
|
|
|
138
126
|
it '#get_user_profile' do
|
|
@@ -156,7 +144,7 @@ module SendGrid4r::REST
|
|
|
156
144
|
end
|
|
157
145
|
|
|
158
146
|
it 'creates profile instance' do
|
|
159
|
-
actual = Users.create_profile(profile)
|
|
147
|
+
actual = Users.create_profile(JSON.parse(profile))
|
|
160
148
|
expect(actual.address).to eq('814 West Chapman Avenue')
|
|
161
149
|
expect(actual.city).to eq('Orange')
|
|
162
150
|
expect(actual.company).to eq('SendGrid')
|
|
@@ -169,24 +157,24 @@ module SendGrid4r::REST
|
|
|
169
157
|
end
|
|
170
158
|
|
|
171
159
|
it 'creates account instance' do
|
|
172
|
-
actual = Users.create_account(account)
|
|
160
|
+
actual = Users.create_account(JSON.parse(account))
|
|
173
161
|
expect(actual.type).to eq('free')
|
|
174
162
|
expect(actual.reputation).to eq(99.7)
|
|
175
163
|
end
|
|
176
164
|
|
|
177
165
|
it 'creates email instance' do
|
|
178
|
-
actual = Users.create_email(email)
|
|
166
|
+
actual = Users.create_email(JSON.parse(email))
|
|
179
167
|
expect(actual.email).to eq('test@example.com')
|
|
180
168
|
end
|
|
181
169
|
|
|
182
170
|
it 'creates username instance' do
|
|
183
|
-
actual = Users.create_username(username)
|
|
171
|
+
actual = Users.create_username(JSON.parse(username))
|
|
184
172
|
expect(actual.username).to eq('test_username')
|
|
185
173
|
expect(actual.user_id).to eq(1)
|
|
186
174
|
end
|
|
187
175
|
|
|
188
176
|
it 'creates credits instance' do
|
|
189
|
-
actual = Users.create_credits(credits)
|
|
177
|
+
actual = Users.create_credits(JSON.parse(credits))
|
|
190
178
|
expect(actual.remain).to eq(200)
|
|
191
179
|
expect(actual.total).to eq(200)
|
|
192
180
|
expect(actual.overage).to eq(0)
|
|
@@ -197,7 +185,7 @@ module SendGrid4r::REST
|
|
|
197
185
|
end
|
|
198
186
|
|
|
199
187
|
it 'creates password instance' do
|
|
200
|
-
actual = Users.create_password(password)
|
|
188
|
+
actual = Users.create_password(JSON.parse(password))
|
|
201
189
|
expect(actual.new_password).to eq('new_password')
|
|
202
190
|
expect(actual.old_password).to eq('old_password')
|
|
203
191
|
end
|
|
@@ -60,23 +60,21 @@ module SendGrid4r::REST::Webhooks
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
let(:event_notification) do
|
|
63
|
-
|
|
64
|
-
'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'}'
|
|
79
|
-
)
|
|
63
|
+
'{'\
|
|
64
|
+
'"enabled": true,'\
|
|
65
|
+
'"url": "url",'\
|
|
66
|
+
'"group_resubscribe": true,'\
|
|
67
|
+
'"delivered": true,'\
|
|
68
|
+
'"group_unsubscribe": true,'\
|
|
69
|
+
'"spam_report": true,'\
|
|
70
|
+
'"bounce": true,'\
|
|
71
|
+
'"deferred": true,'\
|
|
72
|
+
'"unsubscribe": true,'\
|
|
73
|
+
'"processed": true,'\
|
|
74
|
+
'"open": true,'\
|
|
75
|
+
'"click": true,'\
|
|
76
|
+
'"dropped": true'\
|
|
77
|
+
'}'
|
|
80
78
|
end
|
|
81
79
|
|
|
82
80
|
it '#get_settings_event_notification' do
|
|
@@ -92,7 +90,7 @@ module SendGrid4r::REST::Webhooks
|
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
it 'creates event_notification instance' do
|
|
95
|
-
actual = Event.create_event_notification(event_notification)
|
|
93
|
+
actual = Event.create_event_notification(JSON.parse(event_notification))
|
|
96
94
|
expect(actual.enabled).to eq(true)
|
|
97
95
|
expect(actual.url).to eq('url')
|
|
98
96
|
expect(actual.group_resubscribe).to eq(true)
|
|
@@ -24,27 +24,23 @@ module SendGrid4r::REST::Webhooks
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
let(:parse_settings) do
|
|
27
|
-
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'}'
|
|
37
|
-
)
|
|
27
|
+
'{'\
|
|
28
|
+
'"result": ['\
|
|
29
|
+
'{'\
|
|
30
|
+
'"url": "http://mydomain.com/parse",'\
|
|
31
|
+
'"hostname": "mail.mydomain.com",'\
|
|
32
|
+
'"spam_check_outgoing": true'\
|
|
33
|
+
'}'\
|
|
34
|
+
']'\
|
|
35
|
+
'}'
|
|
38
36
|
end
|
|
39
37
|
|
|
40
38
|
let(:parse_setting) do
|
|
41
|
-
|
|
42
|
-
'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'}'\
|
|
47
|
-
)
|
|
39
|
+
'{'\
|
|
40
|
+
'"url": "http://mydomain.com/parse",'\
|
|
41
|
+
'"hostname": "mail.mydomain.com",'\
|
|
42
|
+
'"spam_check_outgoing": true'\
|
|
43
|
+
'}'\
|
|
48
44
|
end
|
|
49
45
|
|
|
50
46
|
it '#get_parse_settings' do
|
|
@@ -54,7 +50,7 @@ module SendGrid4r::REST::Webhooks
|
|
|
54
50
|
end
|
|
55
51
|
|
|
56
52
|
it 'creates parse_setting instance' do
|
|
57
|
-
actual = Parse.create_parse_setting(parse_setting)
|
|
53
|
+
actual = Parse.create_parse_setting(JSON.parse(parse_setting))
|
|
58
54
|
expect(actual).to be_a(Parse::ParseSetting)
|
|
59
55
|
expect(actual.url).to eq('http://mydomain.com/parse')
|
|
60
56
|
expect(actual.hostname).to eq('mail.mydomain.com')
|
|
@@ -62,7 +58,7 @@ module SendGrid4r::REST::Webhooks
|
|
|
62
58
|
end
|
|
63
59
|
|
|
64
60
|
it 'creates parse_settings instance' do
|
|
65
|
-
actual = Parse.create_parse_settings(parse_settings)
|
|
61
|
+
actual = Parse.create_parse_settings(JSON.parse(parse_settings))
|
|
66
62
|
expect(actual).to be_a(Parse::ParseSettings)
|
|
67
63
|
expect(actual.result).to be_a(Array)
|
|
68
64
|
end
|