sendly 3.39.0 → 4.0.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.
@@ -22,13 +22,13 @@ module Sendly
22
22
  def get(workspace_id)
23
23
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
24
24
 
25
- @client.get("/enterprise/workspaces/#{workspace_id}")
25
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}")
26
26
  end
27
27
 
28
28
  def delete(workspace_id)
29
29
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
30
30
 
31
- @client.delete("/enterprise/workspaces/#{workspace_id}")
31
+ @client.delete("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}")
32
32
  end
33
33
 
34
34
  # Submit (or resubmit) a verification for an enterprise workspace.
@@ -89,7 +89,7 @@ module Sendly
89
89
  body[:privacyUrl] = privacy_url unless privacy_url.nil?
90
90
  body[:termsUrl] = terms_url unless terms_url.nil?
91
91
 
92
- @client.post("/enterprise/workspaces/#{workspace_id}/verification/submit", body)
92
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/verification/submit", body)
93
93
  end
94
94
 
95
95
  # Convenience alias for resubmits. Identical to +submit_verification+
@@ -106,7 +106,7 @@ module Sendly
106
106
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
107
107
  raise ArgumentError, "Source workspace ID is required" if source_workspace_id.nil? || source_workspace_id.empty?
108
108
 
109
- @client.post("/enterprise/workspaces/#{workspace_id}/verification/inherit", {
109
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/verification/inherit", {
110
110
  source_workspace_id: source_workspace_id
111
111
  })
112
112
  end
@@ -114,7 +114,7 @@ module Sendly
114
114
  def get_verification(workspace_id)
115
115
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
116
116
 
117
- @client.get("/enterprise/workspaces/#{workspace_id}/verification")
117
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/verification")
118
118
  end
119
119
 
120
120
  def transfer_credits(workspace_id, source_workspace_id:, amount:)
@@ -122,7 +122,7 @@ module Sendly
122
122
  raise ArgumentError, "Source workspace ID is required" if source_workspace_id.nil? || source_workspace_id.empty?
123
123
  raise ArgumentError, "Amount must be a positive number" if !amount.is_a?(Integer) || amount <= 0
124
124
 
125
- @client.post("/enterprise/workspaces/#{workspace_id}/transfer-credits", {
125
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/transfer-credits", {
126
126
  source_workspace_id: source_workspace_id,
127
127
  amount: amount
128
128
  })
@@ -131,7 +131,7 @@ module Sendly
131
131
  def get_credits(workspace_id)
132
132
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
133
133
 
134
- @client.get("/enterprise/workspaces/#{workspace_id}/credits")
134
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/credits")
135
135
  end
136
136
 
137
137
  def create_key(workspace_id, name: nil, type: nil)
@@ -141,26 +141,26 @@ module Sendly
141
141
  body[:name] = name if name
142
142
  body[:type] = type if type
143
143
 
144
- @client.post("/enterprise/workspaces/#{workspace_id}/keys", body)
144
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/keys", body)
145
145
  end
146
146
 
147
147
  def list_keys(workspace_id)
148
148
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
149
149
 
150
- @client.get("/enterprise/workspaces/#{workspace_id}/keys")
150
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/keys")
151
151
  end
152
152
 
153
153
  def revoke_key(workspace_id, key_id)
154
154
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
155
155
  raise ArgumentError, "Key ID is required" if key_id.nil? || key_id.empty?
156
156
 
157
- @client.delete("/enterprise/workspaces/#{workspace_id}/keys/#{key_id}")
157
+ @client.delete("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/keys/#{URI.encode_www_form_component(key_id)}")
158
158
  end
159
159
 
160
160
  def list_opt_in_pages(workspace_id)
161
161
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
162
162
 
163
- @client.get("/enterprise/workspaces/#{workspace_id}/opt-in-pages")
163
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/opt-in-pages")
164
164
  end
165
165
 
166
166
  def create_opt_in_page(workspace_id, business_name:, use_case: nil, use_case_summary: nil, sample_messages: nil)
@@ -172,7 +172,7 @@ module Sendly
172
172
  body[:useCaseSummary] = use_case_summary if use_case_summary
173
173
  body[:sampleMessages] = sample_messages if sample_messages
174
174
 
175
- @client.post("/enterprise/workspaces/#{workspace_id}/opt-in-pages", body)
175
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/opt-in-pages", body)
176
176
  end
177
177
 
178
178
  def update_opt_in_page(workspace_id, page_id, logo_url: nil, header_color: nil, button_color: nil, custom_headline: nil, custom_benefits: nil)
@@ -186,14 +186,14 @@ module Sendly
186
186
  body[:customHeadline] = custom_headline unless custom_headline.nil?
187
187
  body[:customBenefits] = custom_benefits unless custom_benefits.nil?
188
188
 
189
- @client.patch("/enterprise/workspaces/#{workspace_id}/opt-in-pages/#{page_id}", body)
189
+ @client.patch("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/opt-in-pages/#{URI.encode_www_form_component(page_id)}", body)
190
190
  end
191
191
 
192
192
  def delete_opt_in_page(workspace_id, page_id)
193
193
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
194
194
  raise ArgumentError, "Page ID is required" if page_id.nil? || page_id.empty?
195
195
 
196
- @client.delete("/enterprise/workspaces/#{workspace_id}/opt-in-pages/#{page_id}")
196
+ @client.delete("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/opt-in-pages/#{URI.encode_www_form_component(page_id)}")
197
197
  end
198
198
 
199
199
  def set_webhook(workspace_id, url:, events: nil, description: nil)
@@ -204,19 +204,19 @@ module Sendly
204
204
  body[:events] = events if events
205
205
  body[:description] = description if description
206
206
 
207
- @client.put("/enterprise/workspaces/#{workspace_id}/webhooks", body)
207
+ @client.put("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/webhooks", body)
208
208
  end
209
209
 
210
210
  def list_webhooks(workspace_id)
211
211
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
212
212
 
213
- @client.get("/enterprise/workspaces/#{workspace_id}/webhooks")
213
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/webhooks")
214
214
  end
215
215
 
216
216
  def delete_webhooks(workspace_id, webhook_id: nil)
217
217
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
218
218
 
219
- path = "/enterprise/workspaces/#{workspace_id}/webhooks"
219
+ path = "/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/webhooks"
220
220
  path += "?webhookId=#{webhook_id}" if webhook_id
221
221
 
222
222
  @client.delete(path)
@@ -225,7 +225,7 @@ module Sendly
225
225
  def test_webhook(workspace_id)
226
226
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
227
227
 
228
- @client.post("/enterprise/workspaces/#{workspace_id}/webhooks/test")
228
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/webhooks/test")
229
229
  end
230
230
 
231
231
  def suspend(workspace_id, reason: nil)
@@ -234,13 +234,13 @@ module Sendly
234
234
  body = {}
235
235
  body[:reason] = reason if reason
236
236
 
237
- @client.post("/enterprise/workspaces/#{workspace_id}/suspend", body)
237
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/suspend", body)
238
238
  end
239
239
 
240
240
  def resume(workspace_id)
241
241
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
242
242
 
243
- @client.post("/enterprise/workspaces/#{workspace_id}/resume")
243
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/resume")
244
244
  end
245
245
 
246
246
  def provision_bulk(workspaces)
@@ -255,7 +255,7 @@ module Sendly
255
255
  raise ArgumentError, "Page ID is required" if page_id.nil? || page_id.empty?
256
256
  raise ArgumentError, "Domain is required" if domain.nil? || domain.empty?
257
257
 
258
- @client.put("/enterprise/workspaces/#{workspace_id}/pages/#{page_id}/domain", { domain: domain })
258
+ @client.put("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/pages/#{URI.encode_www_form_component(page_id)}/domain", { domain: domain })
259
259
  end
260
260
 
261
261
  def send_invitation(workspace_id, email:, role:)
@@ -263,7 +263,7 @@ module Sendly
263
263
  raise ArgumentError, "Email is required" if email.nil? || email.empty?
264
264
  raise ArgumentError, "Role is required" if role.nil? || role.empty?
265
265
 
266
- @client.post("/enterprise/workspaces/#{workspace_id}/invitations", {
266
+ @client.post("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/invitations", {
267
267
  email: email,
268
268
  role: role
269
269
  })
@@ -272,26 +272,26 @@ module Sendly
272
272
  def list_invitations(workspace_id)
273
273
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
274
274
 
275
- @client.get("/enterprise/workspaces/#{workspace_id}/invitations")
275
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/invitations")
276
276
  end
277
277
 
278
278
  def cancel_invitation(workspace_id, invite_id)
279
279
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
280
280
  raise ArgumentError, "Invite ID is required" if invite_id.nil? || invite_id.empty?
281
281
 
282
- @client.delete("/enterprise/workspaces/#{workspace_id}/invitations/#{invite_id}")
282
+ @client.delete("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/invitations/#{URI.encode_www_form_component(invite_id)}")
283
283
  end
284
284
 
285
285
  def get_quota(workspace_id)
286
286
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
287
287
 
288
- @client.get("/enterprise/workspaces/#{workspace_id}/quota")
288
+ @client.get("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/quota")
289
289
  end
290
290
 
291
291
  def set_quota(workspace_id, monthly_message_quota:)
292
292
  raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty?
293
293
 
294
- @client.put("/enterprise/workspaces/#{workspace_id}/quota", {
294
+ @client.put("/enterprise/workspaces/#{URI.encode_www_form_component(workspace_id)}/quota", {
295
295
  monthlyMessageQuota: monthly_message_quota
296
296
  })
297
297
  end
@@ -129,7 +129,7 @@ module Sendly
129
129
  end
130
130
 
131
131
  def get(id)
132
- response = @client.get("/templates/#{id}")
132
+ response = @client.get("/templates/#{URI.encode_www_form_component(id)}")
133
133
  Template.new(response)
134
134
  end
135
135
 
@@ -198,16 +198,16 @@ module Sendly
198
198
  request_body[:name] = name if name
199
199
  request_body[:text] = content if content
200
200
 
201
- response = @client.patch("/templates/#{id}", request_body)
201
+ response = @client.patch("/templates/#{URI.encode_www_form_component(id)}", request_body)
202
202
  Template.new(response)
203
203
  end
204
204
 
205
205
  def delete(id)
206
- @client.delete("/templates/#{id}")
206
+ @client.delete("/templates/#{URI.encode_www_form_component(id)}")
207
207
  end
208
208
 
209
209
  def publish(id)
210
- response = @client.post("/templates/#{id}/publish")
210
+ response = @client.post("/templates/#{URI.encode_www_form_component(id)}/publish")
211
211
  Template.new(response)
212
212
  end
213
213
 
@@ -217,7 +217,7 @@ module Sendly
217
217
  # this call fails with a 404. To retire a published template today,
218
218
  # {#create} and {#publish} a replacement, then {#delete} this one.
219
219
  def unpublish(id)
220
- response = @client.post("/templates/#{id}/unpublish")
220
+ response = @client.post("/templates/#{URI.encode_www_form_component(id)}/unpublish")
221
221
  Template.new(response)
222
222
  end
223
223
 
@@ -229,7 +229,7 @@ module Sendly
229
229
  def clone(id, name: nil)
230
230
  body = {}
231
231
  body[:name] = name if name
232
- response = @client.post("/templates/#{id}/clone", body)
232
+ response = @client.post("/templates/#{URI.encode_www_form_component(id)}/clone", body)
233
233
  Template.new(response)
234
234
  end
235
235
 
data/lib/sendly/verify.rb CHANGED
@@ -181,17 +181,17 @@ module Sendly
181
181
  end
182
182
 
183
183
  def resend(id)
184
- response = @client.post("/verify/#{id}/resend")
184
+ response = @client.post("/verify/#{URI.encode_www_form_component(id)}/resend")
185
185
  SendVerificationResponse.new(response)
186
186
  end
187
187
 
188
188
  def check(id, code:)
189
- response = @client.post("/verify/#{id}/check", { code: code })
189
+ response = @client.post("/verify/#{URI.encode_www_form_component(id)}/check", { code: code })
190
190
  CheckVerificationResponse.new(response)
191
191
  end
192
192
 
193
193
  def get(id)
194
- response = @client.get("/verify/#{id}")
194
+ response = @client.get("/verify/#{URI.encode_www_form_component(id)}")
195
195
  Verification.new(response)
196
196
  end
197
197
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sendly
4
- VERSION = "3.39.0"
4
+ VERSION = "4.0.0"
5
5
  end