sendgrid4r 1.13.0 → 1.14.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/README.md +0 -1
- data/lib/sendgrid4r/version.rb +1 -1
- data/lib/sendgrid4r.rb +0 -58
- data/sendgrid4r.gemspec +0 -3
- data/spec/client_spec.rb +1 -1
- metadata +5 -183
- data/exe/sg +0 -5
- data/lib/sendgrid4r/cli/alert.rb +0 -51
- data/lib/sendgrid4r/cli/api_keys/api_key.rb +0 -53
- data/lib/sendgrid4r/cli/api_keys/permission.rb +0 -15
- data/lib/sendgrid4r/cli/campaign/campaign.rb +0 -134
- data/lib/sendgrid4r/cli/campaign/contact/contact.rb +0 -25
- data/lib/sendgrid4r/cli/campaign/contact/custom_field.rb +0 -42
- data/lib/sendgrid4r/cli/campaign/contact/list.rb +0 -71
- data/lib/sendgrid4r/cli/campaign/contact/recipient.rb +0 -78
- data/lib/sendgrid4r/cli/campaign/contact/reserved_field.rb +0 -17
- data/lib/sendgrid4r/cli/campaign/contact/segment.rb +0 -105
- data/lib/sendgrid4r/cli/campaign/sender.rb +0 -83
- data/lib/sendgrid4r/cli/cancel_schedules/batch_id.rb +0 -23
- data/lib/sendgrid4r/cli/cancel_schedules/cancel_schedule.rb +0 -55
- data/lib/sendgrid4r/cli/category.rb +0 -16
- data/lib/sendgrid4r/cli/ipam/activity.rb +0 -16
- data/lib/sendgrid4r/cli/ipam/ipam.rb +0 -14
- data/lib/sendgrid4r/cli/ipam/whitelist.rb +0 -39
- data/lib/sendgrid4r/cli/ips/address.rb +0 -48
- data/lib/sendgrid4r/cli/ips/ip.rb +0 -17
- data/lib/sendgrid4r/cli/ips/pool.rb +0 -48
- data/lib/sendgrid4r/cli/ips/warmup.rb +0 -39
- data/lib/sendgrid4r/cli/mail.rb +0 -34
- data/lib/sendgrid4r/cli/settings/enforced_tls.rb +0 -24
- data/lib/sendgrid4r/cli/settings/mail.rb +0 -195
- data/lib/sendgrid4r/cli/settings/partner.rb +0 -37
- data/lib/sendgrid4r/cli/settings/settings.rb +0 -20
- data/lib/sendgrid4r/cli/settings/tracking.rb +0 -101
- data/lib/sendgrid4r/cli/sg.rb +0 -61
- data/lib/sendgrid4r/cli/sg_thor.rb +0 -50
- data/lib/sendgrid4r/cli/stats/advanced.rb +0 -74
- data/lib/sendgrid4r/cli/stats/category.rb +0 -35
- data/lib/sendgrid4r/cli/stats/global.rb +0 -18
- data/lib/sendgrid4r/cli/stats/parse.rb +0 -18
- data/lib/sendgrid4r/cli/stats/stats.rb +0 -23
- data/lib/sendgrid4r/cli/stats/subuser.rb +0 -67
- data/lib/sendgrid4r/cli/subusers/monitor.rb +0 -44
- data/lib/sendgrid4r/cli/subusers/subuser.rb +0 -77
- data/lib/sendgrid4r/cli/suppressions/block.rb +0 -43
- data/lib/sendgrid4r/cli/suppressions/bounce.rb +0 -41
- data/lib/sendgrid4r/cli/suppressions/global_unsubscribe.rb +0 -43
- data/lib/sendgrid4r/cli/suppressions/group.rb +0 -61
- data/lib/sendgrid4r/cli/suppressions/group_unsubscribe.rb +0 -43
- data/lib/sendgrid4r/cli/suppressions/invalid_email.rb +0 -43
- data/lib/sendgrid4r/cli/suppressions/spam_report.rb +0 -43
- data/lib/sendgrid4r/cli/suppressions/suppression.rb +0 -36
- data/lib/sendgrid4r/cli/templates/template.rb +0 -51
- data/lib/sendgrid4r/cli/templates/version.rb +0 -78
- data/lib/sendgrid4r/cli/user.rb +0 -86
- data/lib/sendgrid4r/cli/webhooks/event.rb +0 -53
- data/lib/sendgrid4r/cli/webhooks/parse.rb +0 -55
- data/lib/sendgrid4r/cli/webhooks/webhook.rb +0 -14
- data/lib/sendgrid4r/cli/whitelabel/domain.rb +0 -117
- data/lib/sendgrid4r/cli/whitelabel/ip.rb +0 -52
- data/lib/sendgrid4r/cli/whitelabel/link.rb +0 -96
- data/lib/sendgrid4r/cli/whitelabel/whitelabel.rb +0 -17
- data/spec/cli/alert_spec.rb +0 -71
- data/spec/cli/api_keys/api_key_spec.rb +0 -77
- data/spec/cli/api_keys/permission_spec.rb +0 -29
- data/spec/cli/campaign/campaign_spec.rb +0 -136
- data/spec/cli/campaign/contact/custom_field_spec.rb +0 -48
- data/spec/cli/campaign/contact/list_spec.rb +0 -88
- data/spec/cli/campaign/contact/recipient_spec.rb +0 -93
- data/spec/cli/campaign/contact/reserved_field_spec.rb +0 -20
- data/spec/cli/campaign/contact/segment_spec.rb +0 -93
- data/spec/cli/campaign/sender_spec.rb +0 -83
- data/spec/cli/cancel_schedules/batch_id_spec.rb +0 -33
- data/spec/cli/cancel_schedules/cancel_schedule_spec.rb +0 -69
- data/spec/cli/category_spec.rb +0 -23
- data/spec/cli/ipam/activity_spec.rb +0 -21
- data/spec/cli/ipam/ipam_spec.rb +0 -26
- data/spec/cli/ipam/whitelist_spec.rb +0 -47
- data/spec/cli/ips/address_spec.rb +0 -57
- data/spec/cli/ips/ip_spec.rb +0 -33
- data/spec/cli/ips/pool_spec.rb +0 -57
- data/spec/cli/ips/warmup_spec.rb +0 -47
- data/spec/cli/mail_spec.rb +0 -37
- data/spec/cli/settings/enforced_tls_spec.rb +0 -30
- data/spec/cli/settings/mail_spec.rb +0 -255
- data/spec/cli/settings/partner_spec.rb +0 -47
- data/spec/cli/settings/settings_spec.rb +0 -40
- data/spec/cli/settings/tracking_spec.rb +0 -128
- data/spec/cli/sg_spec.rb +0 -87
- data/spec/cli/stats/advanced_spec.rb +0 -137
- data/spec/cli/stats/category_spec.rb +0 -57
- data/spec/cli/stats/global_spec.rb +0 -32
- data/spec/cli/stats/parse_spec.rb +0 -32
- data/spec/cli/stats/stats_spec.rb +0 -40
- data/spec/cli/stats/subuser_spec.rb +0 -104
- data/spec/cli/subusers/monitor_spec.rb +0 -52
- data/spec/cli/subusers/subuser_spec.rb +0 -88
- data/spec/cli/suppressions/block_spec.rb +0 -60
- data/spec/cli/suppressions/bounce_spec.rb +0 -58
- data/spec/cli/suppressions/global_unsubscribe_spec.rb +0 -59
- data/spec/cli/suppressions/group_spec.rb +0 -78
- data/spec/cli/suppressions/group_unsubscribe_spec.rb +0 -51
- data/spec/cli/suppressions/invalid_email_spec.rb +0 -60
- data/spec/cli/suppressions/spam_report_spec.rb +0 -60
- data/spec/cli/suppressions/suppression_spec.rb +0 -68
- data/spec/cli/templates/template_spec.rb +0 -65
- data/spec/cli/templates/version_spec.rb +0 -71
- data/spec/cli/user_spec.rb +0 -82
- data/spec/cli/webhooks/event_spec.rb +0 -67
- data/spec/cli/webhooks/parse_spec.rb +0 -72
- data/spec/cli/webhooks/webhook_spec.rb +0 -28
- data/spec/cli/whitelabel/domain_spec.rb +0 -112
- data/spec/cli/whitelabel/ip_spec.rb +0 -61
- data/spec/cli/whitelabel/link_spec.rb +0 -110
- data/spec/cli/whitelabel/whitelabel_spec.rb +0 -27
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Stats
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Stats Parse
|
|
5
|
-
#
|
|
6
|
-
class Parse < SgThor
|
|
7
|
-
desc 'get', 'Gets statistics for Parse Webhook usage'
|
|
8
|
-
option :start_date, banner: SgThor::ISO, require: true
|
|
9
|
-
option :end_date, banner: SgThor::ISO
|
|
10
|
-
option :aggregated_by, banner: SgThor::AGG
|
|
11
|
-
def get
|
|
12
|
-
puts @client.get_parse_stats(parameterise(options))
|
|
13
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
14
|
-
puts e.inspect
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Stats
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Stats
|
|
5
|
-
#
|
|
6
|
-
class Stats < SgThor
|
|
7
|
-
desc('advanced SUBCOMMAND ...ARGS', 'Get advanced stats')
|
|
8
|
-
subcommand('advanced', Advanced)
|
|
9
|
-
|
|
10
|
-
desc('category SUBCOMMAND ...ARGS', 'Get category stats')
|
|
11
|
-
subcommand('category', Category)
|
|
12
|
-
|
|
13
|
-
desc('global SUBCOMMAND ...ARGS', 'Get global stats')
|
|
14
|
-
subcommand('global', Global)
|
|
15
|
-
|
|
16
|
-
desc('parse SUBCOMMAND ...ARGS', 'Get parse stats')
|
|
17
|
-
subcommand('parse', Parse)
|
|
18
|
-
|
|
19
|
-
desc('subuser SUBCOMMAND ...ARGS', 'Get subuser stats')
|
|
20
|
-
subcommand('subuser', Subuser)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Stats
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Stats Subuser
|
|
5
|
-
#
|
|
6
|
-
class Subuser < SgThor
|
|
7
|
-
desc 'get', 'Gets email statistics for the given subusers'
|
|
8
|
-
option :start_date, banner: SgThor::ISO, require: true
|
|
9
|
-
option :end_date, banner: SgThor::ISO
|
|
10
|
-
option :aggregated_by, banner: SgThor::AGG
|
|
11
|
-
option :subusers, type: :array, require: true
|
|
12
|
-
def get
|
|
13
|
-
puts @client.get_subusers_stats(parameterise(options))
|
|
14
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
15
|
-
puts e.inspect
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc(
|
|
19
|
-
'sums',
|
|
20
|
-
'Gets the total sums of each email statistic metric for all subusers'
|
|
21
|
-
)
|
|
22
|
-
option :start_date, banner: SgThor::ISO, require: true
|
|
23
|
-
option :end_date, banner: SgThor::ISO
|
|
24
|
-
option :sort_by_metric
|
|
25
|
-
option :sort_by_direction, banner: SgThor::DIR
|
|
26
|
-
option :limit, type: :numeric
|
|
27
|
-
option :offset, type: :numeric
|
|
28
|
-
def sums
|
|
29
|
-
puts @client.get_subusers_stats_sums(parameterise(options))
|
|
30
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
31
|
-
puts e.inspect
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc(
|
|
35
|
-
'list_monthly',
|
|
36
|
-
'Retrieve the monthly email statistics for all subusers'
|
|
37
|
-
)
|
|
38
|
-
option :date, banner: SgThor::ISO, require: true
|
|
39
|
-
option :subuser
|
|
40
|
-
option :sort_by_metric
|
|
41
|
-
option :sort_by_direction, banner: SgThor::DIR
|
|
42
|
-
option :limit, type: :numeric
|
|
43
|
-
option :offset, type: :numeric
|
|
44
|
-
def list_monthly
|
|
45
|
-
puts @client.get_subusers_stats_monthly(parameterise(options))
|
|
46
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
47
|
-
puts e.inspect
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
desc(
|
|
51
|
-
'get_monthly',
|
|
52
|
-
'Retrieve the monthly email statistics for a single subuser'
|
|
53
|
-
)
|
|
54
|
-
option :subuser_name, require: true
|
|
55
|
-
option :date, banner: SgThor::ISO, require: true
|
|
56
|
-
option :sort_by_metric
|
|
57
|
-
option :sort_by_direction, banner: SgThor::DIR
|
|
58
|
-
option :limit, type: :numeric
|
|
59
|
-
option :offset, type: :numeric
|
|
60
|
-
def get_monthly
|
|
61
|
-
puts @client.get_subuser_stats_monthly(parameterise(options))
|
|
62
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
63
|
-
puts e.inspect
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Subusers
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Subusers Monitor
|
|
5
|
-
#
|
|
6
|
-
class Monitor < SgThor
|
|
7
|
-
desc 'list', 'Retrieve monitor settings'
|
|
8
|
-
option :username, require: true
|
|
9
|
-
def list
|
|
10
|
-
puts @client.get_subuser_monitor(parameterise(options))
|
|
11
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
12
|
-
puts e.inspect
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
desc 'create', 'Create monitor settings'
|
|
16
|
-
option :username, require: true
|
|
17
|
-
option :email, require: true
|
|
18
|
-
option :frequency, type: :numeric, require: true
|
|
19
|
-
def create
|
|
20
|
-
puts @client.post_subuser_monitor(parameterise(options))
|
|
21
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
22
|
-
puts e.inspect
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
desc 'update', 'Update monitor settings'
|
|
26
|
-
option :username, require: true
|
|
27
|
-
option :email, require: true
|
|
28
|
-
option :frequency, type: :numeric, require: true
|
|
29
|
-
def update
|
|
30
|
-
puts @client.put_subuser_monitor(parameterise(options))
|
|
31
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
32
|
-
puts e.inspect
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
desc 'delete', 'Delete monitor settings'
|
|
36
|
-
option :username, require: true
|
|
37
|
-
def delete
|
|
38
|
-
puts @client.delete_subuser_monitor(parameterise(options))
|
|
39
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
40
|
-
puts e.inspect
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Subusers
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Subusers Subuser
|
|
5
|
-
#
|
|
6
|
-
class Subuser < SgThor
|
|
7
|
-
desc 'list', 'List subusers for a parent'
|
|
8
|
-
option :limit, type: :numeric
|
|
9
|
-
option :offset, type: :numeric
|
|
10
|
-
option :username
|
|
11
|
-
def list
|
|
12
|
-
puts @client.get_subusers(parameterise(options))
|
|
13
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
14
|
-
puts e.inspect
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
desc 'create', 'Create a subuser'
|
|
18
|
-
option :username, require: true
|
|
19
|
-
option :email, require: true
|
|
20
|
-
option :password, require: true
|
|
21
|
-
option :ips, type: :array, require: true
|
|
22
|
-
def create
|
|
23
|
-
puts @client.post_subuser(parameterise(options))
|
|
24
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
25
|
-
puts e.inspect
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc 'enable', 'Enable a subuser'
|
|
29
|
-
option :username, require: true
|
|
30
|
-
def enable
|
|
31
|
-
params = parameterise(options)
|
|
32
|
-
params[:disabled] = false
|
|
33
|
-
puts @client.patch_subuser(params)
|
|
34
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
35
|
-
puts e.inspect
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
desc 'disable', 'Disable a subuser'
|
|
39
|
-
option :username, require: true
|
|
40
|
-
def disable
|
|
41
|
-
params = parameterise(options)
|
|
42
|
-
params[:disabled] = false
|
|
43
|
-
puts @client.patch_subuser(params)
|
|
44
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
45
|
-
puts e.inspect
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
desc 'delete', 'Delete a subuser'
|
|
49
|
-
option :username, require: true
|
|
50
|
-
def delete
|
|
51
|
-
puts @client.delete_subuser(parameterise(options))
|
|
52
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
53
|
-
puts e.inspect
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
desc 'reputation', 'Retrieve subusers reputation'
|
|
57
|
-
option :usernames, type: :array, require: true
|
|
58
|
-
def reputation
|
|
59
|
-
puts @client.get_subuser_reputation(parameterise(options))
|
|
60
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
61
|
-
puts e.inspect
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
desc 'assign_ips', 'Update IPs assigned to a subuser'
|
|
65
|
-
option :username, require: true
|
|
66
|
-
option :ips, type: :array, require: true
|
|
67
|
-
def assign_ips
|
|
68
|
-
puts @client.put_subuser_assigned_ips(parameterise(options))
|
|
69
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
70
|
-
puts e.inspect
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
desc('monitor SUBCOMMAND ...ARGS', 'Manage monitor records for subuser')
|
|
74
|
-
subcommand('monitor', Monitor)
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions Block
|
|
5
|
-
#
|
|
6
|
-
class Block < SgThor
|
|
7
|
-
desc 'list', 'List blocks'
|
|
8
|
-
option :start_time, banner: SgThor::UTS, type: :numeric
|
|
9
|
-
option :end_time, banner: SgThor::UTS, type: :numeric
|
|
10
|
-
option :limit, type: :numeric
|
|
11
|
-
option :offset, type: :numeric
|
|
12
|
-
def list
|
|
13
|
-
puts @client.get_blocks(parameterise(options))
|
|
14
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
15
|
-
puts e.inspect
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc 'delete', 'Delete blocks'
|
|
19
|
-
option :delete_all, type: :boolean
|
|
20
|
-
option :email
|
|
21
|
-
option :emails, type: :array
|
|
22
|
-
def delete
|
|
23
|
-
if options[:email]
|
|
24
|
-
puts @client.delete_block(email: options[:email])
|
|
25
|
-
else
|
|
26
|
-
puts @client.delete_blocks(
|
|
27
|
-
delete_all: options[:delete_all], emails: options[:emails]
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
31
|
-
puts e.inspect
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc 'get', 'Get a block'
|
|
35
|
-
option :email, require: true
|
|
36
|
-
def get
|
|
37
|
-
puts @client.get_block(parameterise(options))
|
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
39
|
-
puts e.inspect
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions Bounce
|
|
5
|
-
#
|
|
6
|
-
class Bounce < SgThor
|
|
7
|
-
desc 'list', 'List bounces'
|
|
8
|
-
option :start_time, banner: SgThor::UTS, type: :numeric
|
|
9
|
-
option :end_time, banner: SgThor::UTS, type: :numeric
|
|
10
|
-
def list
|
|
11
|
-
puts @client.get_bounces(parameterise(options))
|
|
12
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
13
|
-
puts e.inspect
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
desc 'delete', 'Delete bounces'
|
|
17
|
-
option :delete_all, type: :boolean
|
|
18
|
-
option :email
|
|
19
|
-
option :emails, type: :array
|
|
20
|
-
def delete
|
|
21
|
-
if options[:email]
|
|
22
|
-
puts @client.delete_bounce(email: options[:email])
|
|
23
|
-
else
|
|
24
|
-
puts @client.delete_bounces(
|
|
25
|
-
delete_all: options[:delete_all], emails: options[:emails]
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
29
|
-
puts e.inspect
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
desc 'get', 'Get a bounce'
|
|
33
|
-
option :email, require: true
|
|
34
|
-
def get
|
|
35
|
-
puts @client.get_bounce(parameterise(options))
|
|
36
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
37
|
-
puts e.inspect
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions GlobalUnsubscribe
|
|
5
|
-
#
|
|
6
|
-
class GlobalUnsubscribe < SgThor
|
|
7
|
-
desc 'list', 'List global unsubscribes'
|
|
8
|
-
option :start_time, banner: SgThor::UTS, type: :numeric
|
|
9
|
-
option :end_time, banner: SgThor::UTS, type: :numeric
|
|
10
|
-
option :limit, type: :numeric
|
|
11
|
-
option :offset, type: :numeric
|
|
12
|
-
def list
|
|
13
|
-
puts @client.get_global_unsubscribes(parameterise(options))
|
|
14
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
15
|
-
puts e.inspect
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc 'add', 'Add email addresses to the Global Unsubscribes'
|
|
19
|
-
option :recipient_emails, type: :array, require: true
|
|
20
|
-
def add
|
|
21
|
-
puts @client.post_global_unsubscribes(parameterise(options))
|
|
22
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
23
|
-
puts e.inspect
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
desc 'delete', 'Delete global unsubscribes'
|
|
27
|
-
option :email_address, require: true
|
|
28
|
-
def delete
|
|
29
|
-
puts @client.delete_global_unsubscribe(parameterise(options))
|
|
30
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
31
|
-
puts e.inspect
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc 'get', 'Get a global unsubscribe'
|
|
35
|
-
option :email_address, require: true
|
|
36
|
-
def get
|
|
37
|
-
puts @client.get_global_unsubscribe(parameterise(options))
|
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
39
|
-
puts e.inspect
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions Group
|
|
5
|
-
#
|
|
6
|
-
class Group < SgThor
|
|
7
|
-
desc 'create', 'Create a new supression group'
|
|
8
|
-
option :name, require: true
|
|
9
|
-
option :description, require: true
|
|
10
|
-
option :is_default, type: :boolean
|
|
11
|
-
def create
|
|
12
|
-
puts @client.post_group(parameterise(options))
|
|
13
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
14
|
-
puts e.inspect
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
desc 'list', 'List supression groups'
|
|
18
|
-
option :email_address
|
|
19
|
-
def list
|
|
20
|
-
if options[:email_address].nil?
|
|
21
|
-
puts @client.get_groups
|
|
22
|
-
else
|
|
23
|
-
puts @client.get_groups_by_email(parameterise(options))
|
|
24
|
-
end
|
|
25
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
26
|
-
puts e.inspect
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
desc 'get', 'Get a supression group'
|
|
30
|
-
option :group_id, require: true
|
|
31
|
-
def get
|
|
32
|
-
puts @client.get_group(parameterise(options))
|
|
33
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
34
|
-
puts e.inspect
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
desc 'update', 'Update a supression group'
|
|
38
|
-
option :group_id, require: true
|
|
39
|
-
option :name
|
|
40
|
-
option :description
|
|
41
|
-
def update
|
|
42
|
-
group = parameterise(options)
|
|
43
|
-
group.delete(:group_id)
|
|
44
|
-
puts @client.patch_group(
|
|
45
|
-
group_id: options[:group_id],
|
|
46
|
-
group: group
|
|
47
|
-
)
|
|
48
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
49
|
-
puts e.inspect
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
desc 'delete', 'Delete a supression group'
|
|
53
|
-
option :group_id, require: true
|
|
54
|
-
def delete
|
|
55
|
-
puts @client.delete_group(parameterise(options))
|
|
56
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
57
|
-
puts e.inspect
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions GroupUnsubscribe
|
|
5
|
-
#
|
|
6
|
-
class GroupUnsubscribe < SgThor
|
|
7
|
-
desc 'add', 'Add email addresses to the group supressions'
|
|
8
|
-
option :group_id, require: true
|
|
9
|
-
option :recipient_emails, type: :array, require: true
|
|
10
|
-
def add
|
|
11
|
-
puts @client.post_suppressed_emails(parameterise(options))
|
|
12
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
13
|
-
puts e.inspect
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
desc 'list', 'List suppressed addresses for a given group'
|
|
17
|
-
option :group_id, require: true
|
|
18
|
-
def list
|
|
19
|
-
puts @client.get_suppressed_emails(parameterise(options))
|
|
20
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
21
|
-
puts e.inspect
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
desc 'search', 'Search suppressed addresses for a given group'
|
|
25
|
-
option :group_id, require: true
|
|
26
|
-
option :recipient_emails, type: :array, require: true
|
|
27
|
-
def search
|
|
28
|
-
puts @client.search_suppressed_emails(parameterise(options))
|
|
29
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
30
|
-
puts e.inspect
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
desc 'remove', 'Remove an email address from the given group'
|
|
34
|
-
option :group_id, require: true
|
|
35
|
-
option :email_address, require: true
|
|
36
|
-
def remove
|
|
37
|
-
@client.delete_suppressed_email(parameterise(options))
|
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
39
|
-
puts e.inspect
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions InvalidEmail
|
|
5
|
-
#
|
|
6
|
-
class InvalidEmail < SgThor
|
|
7
|
-
desc 'list', 'List blocks'
|
|
8
|
-
option :start_time, banner: SgThor::UTS, type: :numeric
|
|
9
|
-
option :end_time, banner: SgThor::UTS, type: :numeric
|
|
10
|
-
option :limit, type: :numeric
|
|
11
|
-
option :offset, type: :numeric
|
|
12
|
-
def list
|
|
13
|
-
puts @client.get_invalid_emails(parameterise(options))
|
|
14
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
15
|
-
puts e.inspect
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc 'delete', 'Delete invalid emails'
|
|
19
|
-
option :delete_all, type: :boolean
|
|
20
|
-
option :email
|
|
21
|
-
option :emails, type: :array
|
|
22
|
-
def delete
|
|
23
|
-
if options[:email]
|
|
24
|
-
@client.delete_invalid_email(email: options[:email])
|
|
25
|
-
else
|
|
26
|
-
@client.delete_invalid_emails(
|
|
27
|
-
delete_all: options[:delete_all], emails: options[:emails]
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
31
|
-
puts e.inspect
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc 'get', 'Get a invalid email'
|
|
35
|
-
option :email, require: true
|
|
36
|
-
def get
|
|
37
|
-
puts @client.get_invalid_email(parameterise(options))
|
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
39
|
-
puts e.inspect
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions SpamReport
|
|
5
|
-
#
|
|
6
|
-
class SpamReport < SgThor
|
|
7
|
-
desc 'list', 'List spam reports'
|
|
8
|
-
option :start_time, banner: SgThor::UTS, type: :numeric
|
|
9
|
-
option :end_time, banner: SgThor::UTS, type: :numeric
|
|
10
|
-
option :limit, type: :numeric
|
|
11
|
-
option :offset, type: :numeric
|
|
12
|
-
def list
|
|
13
|
-
puts @client.get_spam_reports(parameterise(options))
|
|
14
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
15
|
-
puts e.inspect
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc 'delete', 'Delete spam reports'
|
|
19
|
-
option :delete_all, type: :boolean
|
|
20
|
-
option :email
|
|
21
|
-
option :emails, type: :array
|
|
22
|
-
def delete
|
|
23
|
-
if options[:email]
|
|
24
|
-
@client.delete_spam_report(email: options[:email])
|
|
25
|
-
else
|
|
26
|
-
@client.delete_spam_reports(
|
|
27
|
-
delete_all: options[:delete_all], emails: options[:emails]
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
31
|
-
puts e.inspect
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc 'get', 'Get a spam report'
|
|
35
|
-
option :email, require: true
|
|
36
|
-
def get
|
|
37
|
-
puts @client.get_spam_report(parameterise(options))
|
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
39
|
-
puts e.inspect
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Suppressions
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Suppressions Suppression
|
|
5
|
-
#
|
|
6
|
-
class Suppression < SgThor
|
|
7
|
-
desc('block SUBCOMMAND ...ARGS', 'Manage blocks list')
|
|
8
|
-
subcommand('block', Block)
|
|
9
|
-
|
|
10
|
-
desc('bounce SUBCOMMAND ...ARGS', 'Manage bounces list')
|
|
11
|
-
subcommand('bounce', Bounce)
|
|
12
|
-
|
|
13
|
-
desc('invalid_email SUBCOMMAND ...ARGS', 'Manage invalid emails list')
|
|
14
|
-
subcommand('invalid_email', InvalidEmail)
|
|
15
|
-
|
|
16
|
-
desc('spam_report SUBCOMMAND ...ARGS', 'Manage spam reports list')
|
|
17
|
-
subcommand('spam_report', SpamReport)
|
|
18
|
-
|
|
19
|
-
desc(
|
|
20
|
-
'global_unsubscribe SUBCOMMAND ...ARGS',
|
|
21
|
-
'Manage global unsubscribe list'
|
|
22
|
-
)
|
|
23
|
-
subcommand('global_unsubscribe', GlobalUnsubscribe)
|
|
24
|
-
|
|
25
|
-
desc(
|
|
26
|
-
'group SUBCOMMAND ...ARGS', 'Manage suppression groups'
|
|
27
|
-
)
|
|
28
|
-
subcommand('group', Group)
|
|
29
|
-
|
|
30
|
-
desc(
|
|
31
|
-
'group_unsubscribe SUBCOMMAND ...ARGS', 'Manage group unsubscribes'
|
|
32
|
-
)
|
|
33
|
-
subcommand('group_unsubscribe', GroupUnsubscribe)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
module SendGrid4r::CLI
|
|
2
|
-
module Templates
|
|
3
|
-
#
|
|
4
|
-
# SendGrid Web API v3 Templates
|
|
5
|
-
#
|
|
6
|
-
class Template < SgThor
|
|
7
|
-
desc 'create', 'Create a template'
|
|
8
|
-
option :name, require: true
|
|
9
|
-
def create
|
|
10
|
-
puts @client.post_template(parameterise(options))
|
|
11
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
12
|
-
puts e.inspect
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
desc 'list', 'Retrieve all templates'
|
|
16
|
-
def list
|
|
17
|
-
puts @client.get_templates
|
|
18
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
19
|
-
puts e.inspect
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
desc 'get', 'Get a template'
|
|
23
|
-
option :template_id, require: true
|
|
24
|
-
def get
|
|
25
|
-
puts @client.get_template(parameterise(options))
|
|
26
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
27
|
-
puts e.inspect
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
desc 'update', 'Edit a template'
|
|
31
|
-
option :template_id, require: true
|
|
32
|
-
option :name, require: true
|
|
33
|
-
def update
|
|
34
|
-
puts @client.patch_template(parameterise(options))
|
|
35
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
36
|
-
puts e.inspect
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
desc 'delete', 'Delete a template'
|
|
40
|
-
option :template_id, require: true
|
|
41
|
-
def delete
|
|
42
|
-
puts @client.delete_template(parameterise(options))
|
|
43
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
44
|
-
puts e.inspect
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
desc('version SUBCOMMAND ...ARGS', 'Manage template versions')
|
|
48
|
-
subcommand('version', Version)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|