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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/lib/sendgrid4r/version.rb +1 -1
  4. data/lib/sendgrid4r.rb +0 -58
  5. data/sendgrid4r.gemspec +0 -3
  6. data/spec/client_spec.rb +1 -1
  7. metadata +5 -183
  8. data/exe/sg +0 -5
  9. data/lib/sendgrid4r/cli/alert.rb +0 -51
  10. data/lib/sendgrid4r/cli/api_keys/api_key.rb +0 -53
  11. data/lib/sendgrid4r/cli/api_keys/permission.rb +0 -15
  12. data/lib/sendgrid4r/cli/campaign/campaign.rb +0 -134
  13. data/lib/sendgrid4r/cli/campaign/contact/contact.rb +0 -25
  14. data/lib/sendgrid4r/cli/campaign/contact/custom_field.rb +0 -42
  15. data/lib/sendgrid4r/cli/campaign/contact/list.rb +0 -71
  16. data/lib/sendgrid4r/cli/campaign/contact/recipient.rb +0 -78
  17. data/lib/sendgrid4r/cli/campaign/contact/reserved_field.rb +0 -17
  18. data/lib/sendgrid4r/cli/campaign/contact/segment.rb +0 -105
  19. data/lib/sendgrid4r/cli/campaign/sender.rb +0 -83
  20. data/lib/sendgrid4r/cli/cancel_schedules/batch_id.rb +0 -23
  21. data/lib/sendgrid4r/cli/cancel_schedules/cancel_schedule.rb +0 -55
  22. data/lib/sendgrid4r/cli/category.rb +0 -16
  23. data/lib/sendgrid4r/cli/ipam/activity.rb +0 -16
  24. data/lib/sendgrid4r/cli/ipam/ipam.rb +0 -14
  25. data/lib/sendgrid4r/cli/ipam/whitelist.rb +0 -39
  26. data/lib/sendgrid4r/cli/ips/address.rb +0 -48
  27. data/lib/sendgrid4r/cli/ips/ip.rb +0 -17
  28. data/lib/sendgrid4r/cli/ips/pool.rb +0 -48
  29. data/lib/sendgrid4r/cli/ips/warmup.rb +0 -39
  30. data/lib/sendgrid4r/cli/mail.rb +0 -34
  31. data/lib/sendgrid4r/cli/settings/enforced_tls.rb +0 -24
  32. data/lib/sendgrid4r/cli/settings/mail.rb +0 -195
  33. data/lib/sendgrid4r/cli/settings/partner.rb +0 -37
  34. data/lib/sendgrid4r/cli/settings/settings.rb +0 -20
  35. data/lib/sendgrid4r/cli/settings/tracking.rb +0 -101
  36. data/lib/sendgrid4r/cli/sg.rb +0 -61
  37. data/lib/sendgrid4r/cli/sg_thor.rb +0 -50
  38. data/lib/sendgrid4r/cli/stats/advanced.rb +0 -74
  39. data/lib/sendgrid4r/cli/stats/category.rb +0 -35
  40. data/lib/sendgrid4r/cli/stats/global.rb +0 -18
  41. data/lib/sendgrid4r/cli/stats/parse.rb +0 -18
  42. data/lib/sendgrid4r/cli/stats/stats.rb +0 -23
  43. data/lib/sendgrid4r/cli/stats/subuser.rb +0 -67
  44. data/lib/sendgrid4r/cli/subusers/monitor.rb +0 -44
  45. data/lib/sendgrid4r/cli/subusers/subuser.rb +0 -77
  46. data/lib/sendgrid4r/cli/suppressions/block.rb +0 -43
  47. data/lib/sendgrid4r/cli/suppressions/bounce.rb +0 -41
  48. data/lib/sendgrid4r/cli/suppressions/global_unsubscribe.rb +0 -43
  49. data/lib/sendgrid4r/cli/suppressions/group.rb +0 -61
  50. data/lib/sendgrid4r/cli/suppressions/group_unsubscribe.rb +0 -43
  51. data/lib/sendgrid4r/cli/suppressions/invalid_email.rb +0 -43
  52. data/lib/sendgrid4r/cli/suppressions/spam_report.rb +0 -43
  53. data/lib/sendgrid4r/cli/suppressions/suppression.rb +0 -36
  54. data/lib/sendgrid4r/cli/templates/template.rb +0 -51
  55. data/lib/sendgrid4r/cli/templates/version.rb +0 -78
  56. data/lib/sendgrid4r/cli/user.rb +0 -86
  57. data/lib/sendgrid4r/cli/webhooks/event.rb +0 -53
  58. data/lib/sendgrid4r/cli/webhooks/parse.rb +0 -55
  59. data/lib/sendgrid4r/cli/webhooks/webhook.rb +0 -14
  60. data/lib/sendgrid4r/cli/whitelabel/domain.rb +0 -117
  61. data/lib/sendgrid4r/cli/whitelabel/ip.rb +0 -52
  62. data/lib/sendgrid4r/cli/whitelabel/link.rb +0 -96
  63. data/lib/sendgrid4r/cli/whitelabel/whitelabel.rb +0 -17
  64. data/spec/cli/alert_spec.rb +0 -71
  65. data/spec/cli/api_keys/api_key_spec.rb +0 -77
  66. data/spec/cli/api_keys/permission_spec.rb +0 -29
  67. data/spec/cli/campaign/campaign_spec.rb +0 -136
  68. data/spec/cli/campaign/contact/custom_field_spec.rb +0 -48
  69. data/spec/cli/campaign/contact/list_spec.rb +0 -88
  70. data/spec/cli/campaign/contact/recipient_spec.rb +0 -93
  71. data/spec/cli/campaign/contact/reserved_field_spec.rb +0 -20
  72. data/spec/cli/campaign/contact/segment_spec.rb +0 -93
  73. data/spec/cli/campaign/sender_spec.rb +0 -83
  74. data/spec/cli/cancel_schedules/batch_id_spec.rb +0 -33
  75. data/spec/cli/cancel_schedules/cancel_schedule_spec.rb +0 -69
  76. data/spec/cli/category_spec.rb +0 -23
  77. data/spec/cli/ipam/activity_spec.rb +0 -21
  78. data/spec/cli/ipam/ipam_spec.rb +0 -26
  79. data/spec/cli/ipam/whitelist_spec.rb +0 -47
  80. data/spec/cli/ips/address_spec.rb +0 -57
  81. data/spec/cli/ips/ip_spec.rb +0 -33
  82. data/spec/cli/ips/pool_spec.rb +0 -57
  83. data/spec/cli/ips/warmup_spec.rb +0 -47
  84. data/spec/cli/mail_spec.rb +0 -37
  85. data/spec/cli/settings/enforced_tls_spec.rb +0 -30
  86. data/spec/cli/settings/mail_spec.rb +0 -255
  87. data/spec/cli/settings/partner_spec.rb +0 -47
  88. data/spec/cli/settings/settings_spec.rb +0 -40
  89. data/spec/cli/settings/tracking_spec.rb +0 -128
  90. data/spec/cli/sg_spec.rb +0 -87
  91. data/spec/cli/stats/advanced_spec.rb +0 -137
  92. data/spec/cli/stats/category_spec.rb +0 -57
  93. data/spec/cli/stats/global_spec.rb +0 -32
  94. data/spec/cli/stats/parse_spec.rb +0 -32
  95. data/spec/cli/stats/stats_spec.rb +0 -40
  96. data/spec/cli/stats/subuser_spec.rb +0 -104
  97. data/spec/cli/subusers/monitor_spec.rb +0 -52
  98. data/spec/cli/subusers/subuser_spec.rb +0 -88
  99. data/spec/cli/suppressions/block_spec.rb +0 -60
  100. data/spec/cli/suppressions/bounce_spec.rb +0 -58
  101. data/spec/cli/suppressions/global_unsubscribe_spec.rb +0 -59
  102. data/spec/cli/suppressions/group_spec.rb +0 -78
  103. data/spec/cli/suppressions/group_unsubscribe_spec.rb +0 -51
  104. data/spec/cli/suppressions/invalid_email_spec.rb +0 -60
  105. data/spec/cli/suppressions/spam_report_spec.rb +0 -60
  106. data/spec/cli/suppressions/suppression_spec.rb +0 -68
  107. data/spec/cli/templates/template_spec.rb +0 -65
  108. data/spec/cli/templates/version_spec.rb +0 -71
  109. data/spec/cli/user_spec.rb +0 -82
  110. data/spec/cli/webhooks/event_spec.rb +0 -67
  111. data/spec/cli/webhooks/parse_spec.rb +0 -72
  112. data/spec/cli/webhooks/webhook_spec.rb +0 -28
  113. data/spec/cli/whitelabel/domain_spec.rb +0 -112
  114. data/spec/cli/whitelabel/ip_spec.rb +0 -61
  115. data/spec/cli/whitelabel/link_spec.rb +0 -110
  116. data/spec/cli/whitelabel/whitelabel_spec.rb +0 -27
@@ -1,78 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Templates
3
- #
4
- # SendGrid Web API v3 Templates Version
5
- #
6
- class Version < SgThor
7
- desc 'create', 'Create a version'
8
- option :template_id, require: true
9
- option :name, require: true
10
- option :subject, require: true
11
- option :html_content, require: true
12
- option :plain_content, require: true
13
- option :active, type: :numeric, banner: '[0|1]'
14
- def create
15
- factory = SendGrid4r::Factory::VersionFactory.new
16
- params = parameterise(options)
17
- params.delete(:template_id)
18
- version = factory.create(params)
19
- puts @client.post_version(
20
- template_id: options[:template_id],
21
- version: version
22
- )
23
- rescue RestClient::ExceptionWithResponse => e
24
- puts e.inspect
25
- end
26
-
27
- desc 'activate', 'Activate a version'
28
- option :template_id, require: true
29
- option :version_id, require: true
30
- def activate
31
- puts @client.activate_version(parameterise(options))
32
- rescue RestClient::ExceptionWithResponse => e
33
- puts e.inspect
34
- end
35
-
36
- desc 'get', 'Get a version'
37
- option :template_id, require: true
38
- option :version_id, require: true
39
- def get
40
- puts @client.get_version(parameterise(options))
41
- rescue RestClient::ExceptionWithResponse => e
42
- puts e.inspect
43
- end
44
-
45
- desc 'update', 'Edit a version'
46
- option :template_id, require: true
47
- option :version_id, require: true
48
- option :name
49
- option :subject
50
- option :html_content
51
- option :plain_content
52
- option :active, type: :numeric, banner: '[0|1]'
53
- def update
54
- factory = SendGrid4r::Factory::VersionFactory.new
55
- params = parameterise(options)
56
- params.delete(:template_id)
57
- params.delete(:version_id)
58
- version = factory.create(params)
59
- puts @client.patch_version(
60
- template_id: options[:template_id],
61
- version_id: options[:version_id],
62
- version: version
63
- )
64
- rescue RestClient::ExceptionWithResponse => e
65
- puts e.inspect
66
- end
67
-
68
- desc 'delete', 'Delete a version'
69
- option :template_id, require: true
70
- option :version_id, require: true
71
- def delete
72
- puts @client.delete_version(parameterise(options))
73
- rescue RestClient::ExceptionWithResponse => e
74
- puts e.inspect
75
- end
76
- end
77
- end
78
- end
@@ -1,86 +0,0 @@
1
- module SendGrid4r::CLI
2
- #
3
- # SendGrid Web API v3 User
4
- #
5
- class User < SgThor
6
- desc 'profile [get|update]', 'Get or Update user Profile'
7
- option :address
8
- option :city
9
- option :company
10
- option :country
11
- option :first_name
12
- option :last_name
13
- option :phone
14
- option :state
15
- option :website
16
- option :zip
17
- def profile(action)
18
- case action
19
- when 'get'
20
- puts @client.get_user_profile
21
- when 'update'
22
- puts @client.patch_user_profile(params: parameterise(options))
23
- else
24
- puts "error: #{action} is not supported in action parameter"
25
- end
26
- rescue RestClient::ExceptionWithResponse => e
27
- puts e.inspect
28
- end
29
-
30
- desc 'account [get]', 'Get user account'
31
- def account(action)
32
- case action
33
- when 'get'
34
- puts @client.get_user_account
35
- else
36
- puts "error: #{action} is not supported in action parameter"
37
- end
38
- rescue RestClient::ExceptionWithResponse => e
39
- puts e.inspect
40
- end
41
-
42
- desc 'email [get|update]', 'Get or update user email'
43
- option :email
44
- def email(action)
45
- case action
46
- when 'get'
47
- puts @client.get_user_email
48
- when 'update'
49
- puts @client.put_user_email(parameterise(options))
50
- else
51
- puts "error: #{action} is not supported in action parameter"
52
- end
53
- rescue RestClient::ExceptionWithResponse => e
54
- puts e.inspect
55
- end
56
-
57
- desc 'username [get|update]', 'Get or update username'
58
- option :username
59
- def username(action)
60
- case action
61
- when 'get'
62
- puts @client.get_user_username
63
- when 'update'
64
- puts @client.put_user_username(parameterise(options))
65
- else
66
- puts "error: #{action} is not supported in action parameter"
67
- end
68
- rescue RestClient::ExceptionWithResponse => e
69
- puts e.inspect
70
- end
71
-
72
- desc('password [update]', 'Update password')
73
- option :new_password, require: true
74
- option :old_password, require: true
75
- def password(action)
76
- case action
77
- when 'update'
78
- puts @client.put_user_password(parameterise(options))
79
- else
80
- puts "error: #{action} is not supported in action parameter"
81
- end
82
- rescue RestClient::ExceptionWithResponse => e
83
- puts e.inspect
84
- end
85
- end
86
- end
@@ -1,53 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Webhooks
3
- #
4
- # SendGrid Web API v3 Webhooks Event
5
- #
6
- class Event < SgThor
7
- desc 'get', 'Get Event Webhook Settings'
8
- def get
9
- puts @client.get_settings_event_notification
10
- rescue RestClient::ExceptionWithResponse => e
11
- puts e.inspect
12
- end
13
-
14
- desc 'enable', 'Enable Event Webhook Settings'
15
- option :url
16
- option :group_resubscribe, type: :boolean
17
- option :delivered, type: :boolean
18
- option :group_unsubscribe, type: :boolean
19
- option :spam_report, type: :boolean
20
- option :bounce, type: :boolean
21
- option :deferred, type: :boolean
22
- option :unsubscribe, type: :boolean
23
- option :processed, type: :boolean
24
- option :open, type: :boolean
25
- option :click, type: :boolean
26
- option :dropped, type: :boolean
27
- def enable
28
- params = parameterise(options)
29
- params[:enabled] = true
30
- event = SendGrid4r::Factory::EventFactory.create(params)
31
- puts @client.patch_settings_event_notification(params: event)
32
- rescue RestClient::ExceptionWithResponse => e
33
- puts e.inspect
34
- end
35
-
36
- desc 'disable', 'Disable Event Webhook Settings'
37
- def disable
38
- params = { enabled: false }
39
- puts @client.patch_settings_event_notification(params: params)
40
- rescue RestClient::ExceptionWithResponse => e
41
- puts e.inspect
42
- end
43
-
44
- desc 'test', 'Sends a fake event notification post to the provided URL'
45
- option :url
46
- def test
47
- puts @client.test_settings_event_notification(parameterise(options))
48
- rescue RestClient::ExceptionWithResponse => e
49
- puts e.inspect
50
- end
51
- end
52
- end
53
- end
@@ -1,55 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Webhooks
3
- #
4
- # SendGrid Web API v3 Webhook Parse
5
- #
6
- class Parse < SgThor
7
- desc 'list', 'List parse webhook settings'
8
- option :limit, type: :numeric
9
- option :offset, type: :numeric
10
- def list
11
- puts @client.get_parse_settings(parameterise(options))
12
- rescue RestClient::ExceptionWithResponse => e
13
- puts e.inspect
14
- end
15
-
16
- desc 'create', 'Create a parse webhook setting'
17
- option :hostname, require: true
18
- option :url, require: true
19
- option :spam_check, type: :boolean, require: true
20
- option :send_raw, type: :boolean, require: true
21
- def create
22
- puts @client.post_parse_setting(parameterise(options))
23
- rescue RestClient::ExceptionWithResponse => e
24
- puts e.inspect
25
- end
26
-
27
- desc 'get', 'Get a parse webhook setting'
28
- option :hostname
29
- def get
30
- puts @client.get_parse_setting(parameterise(options))
31
- rescue RestClient::ExceptionWithResponse => e
32
- puts e.inspect
33
- end
34
-
35
- desc 'update', 'Update a parse webhook setting'
36
- option :hostname, require: true
37
- option :url
38
- option :spam_check, type: :boolean
39
- option :send_raw, type: :boolean
40
- def update
41
- puts @client.patch_parse_setting(parameterise(options))
42
- rescue RestClient::ExceptionWithResponse => e
43
- puts e.inspect
44
- end
45
-
46
- desc 'delete', 'Delete a parse webhook setting'
47
- option :hostname, require: true
48
- def delete
49
- puts @client.delete_parse_setting(parameterise(options))
50
- rescue RestClient::ExceptionWithResponse => e
51
- puts e.inspect
52
- end
53
- end
54
- end
55
- end
@@ -1,14 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Webhooks
3
- #
4
- # SendGrid Web API v3 Webhooks Webhook
5
- #
6
- class Webhook < SgThor
7
- desc('event SUBCOMMAND ...ARGS', 'Manage event webhook settings')
8
- subcommand('event', Event)
9
-
10
- desc('parse SUBCOMMAND ...ARGS', 'Manage parse webhook settings')
11
- subcommand('parse', Parse)
12
- end
13
- end
14
- end
@@ -1,117 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Whitelabel
3
- #
4
- # SendGrid Web API v3 Whitelabel Domain
5
- #
6
- class Domain < SgThor
7
- desc 'list', 'List all Domain whitelabels'
8
- option :limit, type: :numeric
9
- option :offset, type: :numeric
10
- option :exclude_subusers, type: :boolean
11
- option :username
12
- option :domain
13
- def list
14
- puts @client.get_wl_domains(parameterise(options))
15
- rescue RestClient::ExceptionWithResponse => e
16
- puts e.inspect
17
- end
18
-
19
- desc 'create', 'Create a domain whitelabel'
20
- option :domain, require: true
21
- option :subdomain, require: true
22
- option :automatic_security, type: :boolean
23
- option :custom_spf, type: :boolean
24
- option :default, type: :boolean
25
- def create
26
- puts @client.post_wl_domain(parameterise(options))
27
- rescue RestClient::ExceptionWithResponse => e
28
- puts e.inspect
29
- end
30
-
31
- desc 'get', 'Retrieve a domain whitelabel'
32
- option :id, require: true
33
- def get
34
- puts @client.get_wl_domain(parameterise(options))
35
- rescue RestClient::ExceptionWithResponse => e
36
- puts e.inspect
37
- end
38
-
39
- desc 'update', 'Update a domain whitelabel'
40
- option :id, require: true
41
- option :custom_spf, type: :boolean
42
- option :default, type: :boolean
43
- def update
44
- puts @client.patch_wl_domain(parameterise(options))
45
- rescue RestClient::ExceptionWithResponse => e
46
- puts e.inspect
47
- end
48
-
49
- desc 'delete', 'Delete a domain whitelabel'
50
- option :id, require: true
51
- def delete
52
- puts @client.delete_wl_domain(parameterise(options))
53
- rescue RestClient::ExceptionWithResponse => e
54
- puts e.inspect
55
- end
56
-
57
- desc 'default', 'Default a domain'
58
- option :domain
59
- def default
60
- puts @client.get_default_wl_domain(parameterise(options))
61
- rescue RestClient::ExceptionWithResponse => e
62
- puts e.inspect
63
- end
64
-
65
- desc 'add_ip', 'Add an IP to a Domain'
66
- option :id, require: true
67
- option :ip, require: true
68
- def add_ip
69
- puts @client.add_ip_to_wl_domain(parameterise(options))
70
- rescue RestClient::ExceptionWithResponse => e
71
- puts e.inspect
72
- end
73
-
74
- desc 'remove_ip', 'Remove an IP from a Domain'
75
- option :id, require: true
76
- option :ip, require: true
77
- def remove_ip
78
- puts @client.remove_ip_from_wl_domain(parameterise(options))
79
- rescue RestClient::ExceptionWithResponse => e
80
- puts e.inspect
81
- end
82
-
83
- desc 'validate', 'Validate a Domain'
84
- option :id, require: true
85
- def validate
86
- puts @client.validate_wl_domain(parameterise(options))
87
- rescue RestClient::ExceptionWithResponse => e
88
- puts e.inspect
89
- end
90
-
91
- desc 'list_associated', 'List Associated Domain'
92
- option :username, require: true
93
- def list_associated
94
- puts @client.get_associated_wl_domain(parameterise(options))
95
- rescue RestClient::ExceptionWithResponse => e
96
- puts e.inspect
97
- end
98
-
99
- desc 'disassociate', 'Disassociate Domain'
100
- option :username, require: true
101
- def disassociate
102
- puts @client.disassociate_wl_domain(parameterise(options))
103
- rescue RestClient::ExceptionWithResponse => e
104
- puts e.inspect
105
- end
106
-
107
- desc 'associate', 'Associate Domain'
108
- option :id, require: true
109
- option :username, require: true
110
- def associate
111
- puts @client.associate_wl_domain(parameterise(options))
112
- rescue RestClient::ExceptionWithResponse => e
113
- puts e.inspect
114
- end
115
- end
116
- end
117
- end
@@ -1,52 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Whitelabel
3
- #
4
- # SendGrid Web API v3 Whitelabel Ip
5
- #
6
- class Ip < SgThor
7
- desc 'list', 'List all IP whitelabels'
8
- option :ip
9
- option :limit, type: :numeric
10
- option :offset, type: :numeric
11
- def list
12
- puts @client.get_wl_ips(parameterise(options))
13
- rescue RestClient::ExceptionWithResponse => e
14
- puts e.inspect
15
- end
16
-
17
- desc 'create', 'Create an IP whitelabel'
18
- option :ip, require: true
19
- option :domain, require: true
20
- option :subdomain, require: true
21
- def create
22
- puts @client.post_wl_ip(parameterise(options))
23
- rescue RestClient::ExceptionWithResponse => e
24
- puts e.inspect
25
- end
26
-
27
- desc 'get', 'Retrieve an IP whitelabel'
28
- option :id, require: true
29
- def get
30
- puts @client.get_wl_ip(parameterise(options))
31
- rescue RestClient::ExceptionWithResponse => e
32
- puts e.inspect
33
- end
34
-
35
- desc 'delete', 'Delete an IP whitelabel'
36
- option :id, require: true
37
- def delete
38
- puts @client.delete_wl_ip(parameterise(options))
39
- rescue RestClient::ExceptionWithResponse => e
40
- puts e.inspect
41
- end
42
-
43
- desc 'validate', 'Validate IP whitelabel'
44
- option :id, require: true
45
- def validate
46
- puts @client.validate_wl_ip(parameterise(options))
47
- rescue RestClient::ExceptionWithResponse => e
48
- puts e.inspect
49
- end
50
- end
51
- end
52
- end
@@ -1,96 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Whitelabel
3
- #
4
- # SendGrid Web API v3 Whitelabel Link
5
- #
6
- class Link < SgThor
7
- desc 'list', 'List all Link whitelabels'
8
- option :limit, type: :numeric
9
- option :offset, type: :numeric
10
- option :exclude_subusers
11
- option :username
12
- option :domain
13
- def list
14
- puts @client.get_wl_links(parameterise(options))
15
- rescue RestClient::ExceptionWithResponse => e
16
- puts e.inspect
17
- end
18
-
19
- desc 'create', 'Create a link whitelabel'
20
- option :domain, require: true
21
- option :subdomain, require: true
22
- option :default, type: :boolean
23
- def create
24
- puts @client.post_wl_link(parameterise(options))
25
- rescue RestClient::ExceptionWithResponse => e
26
- puts e.inspect
27
- end
28
-
29
- desc 'get', 'Retrieve a link whitelabel'
30
- option :id, require: true
31
- def get
32
- puts @client.get_wl_link(parameterise(options))
33
- rescue RestClient::ExceptionWithResponse => e
34
- puts e.inspect
35
- end
36
-
37
- desc 'update', 'Update a link whitelabel'
38
- option :id, require: true
39
- option :default, type: :boolean, require: true
40
- def update
41
- puts @client.patch_wl_link(parameterise(options))
42
- rescue RestClient::ExceptionWithResponse => e
43
- puts e.inspect
44
- end
45
-
46
- desc 'delete', 'Delete a link whitelabel'
47
- option :id, require: true
48
- def delete
49
- puts @client.delete_wl_link(parameterise(options))
50
- rescue RestClient::ExceptionWithResponse => e
51
- puts e.inspect
52
- end
53
-
54
- desc 'default', 'Default a link whitelabel'
55
- option :domain
56
- def default
57
- puts @client.get_default_wl_link(parameterise(options))
58
- rescue RestClient::ExceptionWithResponse => e
59
- puts e.inspect
60
- end
61
-
62
- desc 'validate', 'Validate a link whitelabel'
63
- option :id, require: true
64
- def validate
65
- puts @client.validate_wl_link(parameterise(options))
66
- rescue RestClient::ExceptionWithResponse => e
67
- puts e.inspect
68
- end
69
-
70
- desc 'list_associated', 'List Associated link'
71
- option :username, require: true
72
- def list_associated
73
- puts @client.get_associated_wl_link(parameterise(options))
74
- rescue RestClient::ExceptionWithResponse => e
75
- puts e.inspect
76
- end
77
-
78
- desc 'disassociate', 'Disassociate link'
79
- option :username, require: true
80
- def disassociate
81
- puts @client.disassociate_wl_link(parameterise(options))
82
- rescue RestClient::ExceptionWithResponse => e
83
- puts e.inspect
84
- end
85
-
86
- desc 'associate', 'Associate link'
87
- option :id, require: true
88
- option :username, require: true
89
- def associate
90
- puts @client.associate_wl_link(parameterise(options))
91
- rescue RestClient::ExceptionWithResponse => e
92
- puts e.inspect
93
- end
94
- end
95
- end
96
- end
@@ -1,17 +0,0 @@
1
- module SendGrid4r::CLI
2
- module Whitelabel
3
- #
4
- # SendGrid Web API v3 Whitelabel
5
- #
6
- class Whitelabel < SgThor
7
- desc('domain SUBCOMMAND ...ARGS', 'Manage domain whitelabel settings')
8
- subcommand('domain', Domain)
9
-
10
- desc('link SUBCOMMAND ...ARGS', 'Manage link whitelabel settings')
11
- subcommand('link', Link)
12
-
13
- desc('ip SUBCOMMAND ...ARGS', 'Manage IP whitelabel settings')
14
- subcommand('ip', Ip)
15
- end
16
- end
17
- end
@@ -1,71 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/../spec_helper'
3
-
4
- module SendGrid4r::CLI
5
- describe Alert do
6
- describe 'integration test', :it do
7
- before do
8
- Dotenv.load
9
- end
10
-
11
- it '#list' do
12
- args = [
13
- 'list',
14
- '--api-key', ENV['SILVER_API_KEY']
15
- ]
16
- Alert.start(args)
17
- end
18
-
19
- it '#create stats_notification alert' do
20
- args = [
21
- 'create',
22
- '--api-key', ENV['SILVER_API_KEY'],
23
- '--type', 'stats_notification',
24
- '--email_to', ENV['MAIL'],
25
- '--frequency', 'daily'
26
- ]
27
- Alert.start(args)
28
- end
29
-
30
- it '#create usage_limit alert' do
31
- args = [
32
- 'create',
33
- '--api-key', ENV['SILVER_API_KEY'],
34
- '--type', 'usage_limit',
35
- '--email_to', ENV['MAIL'],
36
- '--percentage', 50
37
- ]
38
- Alert.start(args)
39
- end
40
-
41
- it '#get' do
42
- args = [
43
- 'get',
44
- '--api-key', ENV['SILVER_API_KEY'],
45
- '--alert-id', 322729
46
- ]
47
- Alert.start(args)
48
- end
49
-
50
- it '#delete' do
51
- args = [
52
- 'delete',
53
- '--api-key', ENV['SILVER_API_KEY'],
54
- '--alert-id', 322729
55
- ]
56
- Alert.start(args)
57
- end
58
-
59
- it '#update' do
60
- args = [
61
- 'update',
62
- '--api-key', ENV['SILVER_API_KEY'],
63
- '--alert-id', 322729,
64
- '--email_to', ENV['MAIL'],
65
- '--percentage', 88
66
- ]
67
- Alert.start(args)
68
- end
69
- end
70
- end
71
- end