Class: Sendly::EnterpriseWorkspacesSubResource
- Inherits:
-
Object
- Object
- Sendly::EnterpriseWorkspacesSubResource
- Defined in:
- lib/sendly/enterprise.rb
Instance Method Summary collapse
- #cancel_invitation(workspace_id, invite_id) ⇒ Object
- #create(name:, description: nil) ⇒ Object
- #create_key(workspace_id, name: nil, type: nil) ⇒ Object
- #create_opt_in_page(workspace_id, business_name:, use_case: nil, use_case_summary: nil, sample_messages: nil) ⇒ Object
- #delete(workspace_id) ⇒ Object
- #delete_opt_in_page(workspace_id, page_id) ⇒ Object
- #delete_webhooks(workspace_id, webhook_id: nil) ⇒ Object
- #get(workspace_id) ⇒ Object
- #get_credits(workspace_id) ⇒ Object
- #get_quota(workspace_id) ⇒ Object
- #get_verification(workspace_id) ⇒ Object
- #inherit_verification(workspace_id, source_workspace_id:) ⇒ Object
-
#initialize(client) ⇒ EnterpriseWorkspacesSubResource
constructor
A new instance of EnterpriseWorkspacesSubResource.
- #list ⇒ Object
- #list_invitations(workspace_id) ⇒ Object
- #list_keys(workspace_id) ⇒ Object
- #list_opt_in_pages(workspace_id) ⇒ Object
- #list_webhooks(workspace_id) ⇒ Object
- #provision_bulk(workspaces) ⇒ Object
-
#resubmit_verification(workspace_id, **partial_updates) ⇒ Object
Convenience alias for resubmits.
- #resume(workspace_id) ⇒ Object
- #revoke_key(workspace_id, key_id) ⇒ Object
- #send_invitation(workspace_id, email:, role:) ⇒ Object
- #set_custom_domain(workspace_id, page_id, domain:) ⇒ Object
- #set_quota(workspace_id, monthly_message_quota:) ⇒ Object
- #set_webhook(workspace_id, url:, events: nil, description: nil) ⇒ Object
-
#submit_verification(workspace_id, business_name: nil, doing_business_as: nil, website: nil, entity_type: nil, address: nil, contact: nil, brn: nil, brn_type: nil, brn_country: nil, use_case: nil, use_case_summary: nil, sample_messages: nil, opt_in_workflow: nil, opt_in_image_urls: nil, monthly_volume: nil, additional_information: nil, age_gated_content: nil, isv_reseller: nil, privacy_url: nil, terms_url: nil) ⇒ Object
Submit (or resubmit) a verification for an enterprise workspace.
- #suspend(workspace_id, reason: nil) ⇒ Object
- #test_webhook(workspace_id) ⇒ Object
- #transfer_credits(workspace_id, source_workspace_id:, amount:) ⇒ Object
- #update_opt_in_page(workspace_id, page_id, logo_url: nil, header_color: nil, button_color: nil, custom_headline: nil, custom_benefits: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ EnterpriseWorkspacesSubResource
Returns a new instance of EnterpriseWorkspacesSubResource.
5 6 7 |
# File 'lib/sendly/enterprise.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#cancel_invitation(workspace_id, invite_id) ⇒ Object
278 279 280 281 282 283 |
# File 'lib/sendly/enterprise.rb', line 278 def cancel_invitation(workspace_id, invite_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Invite ID is required" if invite_id.nil? || invite_id.empty? @client.delete("/enterprise/workspaces/#{workspace_id}/invitations/#{invite_id}") end |
#create(name:, description: nil) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/sendly/enterprise.rb', line 9 def create(name:, description: nil) raise ArgumentError, "Workspace name is required" if name.nil? || name.strip.empty? body = { name: name } body[:description] = description if description @client.post("/enterprise/workspaces", body) end |
#create_key(workspace_id, name: nil, type: nil) ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/sendly/enterprise.rb', line 137 def create_key(workspace_id, name: nil, type: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? body = {} body[:name] = name if name body[:type] = type if type @client.post("/enterprise/workspaces/#{workspace_id}/keys", body) end |
#create_opt_in_page(workspace_id, business_name:, use_case: nil, use_case_summary: nil, sample_messages: nil) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/sendly/enterprise.rb', line 166 def create_opt_in_page(workspace_id, business_name:, use_case: nil, use_case_summary: nil, sample_messages: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Business name is required" if business_name.nil? || business_name.strip.empty? body = { businessName: business_name } body[:useCase] = use_case if use_case body[:useCaseSummary] = use_case_summary if use_case_summary body[:sampleMessages] = if @client.post("/enterprise/workspaces/#{workspace_id}/opt-in-pages", body) end |
#delete(workspace_id) ⇒ Object
28 29 30 31 32 |
# File 'lib/sendly/enterprise.rb', line 28 def delete(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.delete("/enterprise/workspaces/#{workspace_id}") end |
#delete_opt_in_page(workspace_id, page_id) ⇒ Object
192 193 194 195 196 197 |
# File 'lib/sendly/enterprise.rb', line 192 def delete_opt_in_page(workspace_id, page_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Page ID is required" if page_id.nil? || page_id.empty? @client.delete("/enterprise/workspaces/#{workspace_id}/opt-in-pages/#{page_id}") end |
#delete_webhooks(workspace_id, webhook_id: nil) ⇒ Object
216 217 218 219 220 221 222 223 |
# File 'lib/sendly/enterprise.rb', line 216 def delete_webhooks(workspace_id, webhook_id: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? path = "/enterprise/workspaces/#{workspace_id}/webhooks" path += "?webhookId=#{webhook_id}" if webhook_id @client.delete(path) end |
#get(workspace_id) ⇒ Object
22 23 24 25 26 |
# File 'lib/sendly/enterprise.rb', line 22 def get(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}") end |
#get_credits(workspace_id) ⇒ Object
131 132 133 134 135 |
# File 'lib/sendly/enterprise.rb', line 131 def get_credits(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/credits") end |
#get_quota(workspace_id) ⇒ Object
285 286 287 288 289 |
# File 'lib/sendly/enterprise.rb', line 285 def get_quota(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/quota") end |
#get_verification(workspace_id) ⇒ Object
114 115 116 117 118 |
# File 'lib/sendly/enterprise.rb', line 114 def get_verification(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/verification") end |
#inherit_verification(workspace_id, source_workspace_id:) ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/sendly/enterprise.rb', line 105 def inherit_verification(workspace_id, source_workspace_id:) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Source workspace ID is required" if source_workspace_id.nil? || source_workspace_id.empty? @client.post("/enterprise/workspaces/#{workspace_id}/verification/inherit", { source_workspace_id: source_workspace_id }) end |
#list ⇒ Object
18 19 20 |
# File 'lib/sendly/enterprise.rb', line 18 def list @client.get("/enterprise/workspaces") end |
#list_invitations(workspace_id) ⇒ Object
272 273 274 275 276 |
# File 'lib/sendly/enterprise.rb', line 272 def list_invitations(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/invitations") end |
#list_keys(workspace_id) ⇒ Object
147 148 149 150 151 |
# File 'lib/sendly/enterprise.rb', line 147 def list_keys(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/keys") end |
#list_opt_in_pages(workspace_id) ⇒ Object
160 161 162 163 164 |
# File 'lib/sendly/enterprise.rb', line 160 def list_opt_in_pages(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/opt-in-pages") end |
#list_webhooks(workspace_id) ⇒ Object
210 211 212 213 214 |
# File 'lib/sendly/enterprise.rb', line 210 def list_webhooks(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.get("/enterprise/workspaces/#{workspace_id}/webhooks") end |
#provision_bulk(workspaces) ⇒ Object
246 247 248 249 250 251 |
# File 'lib/sendly/enterprise.rb', line 246 def provision_bulk(workspaces) raise ArgumentError, "Workspaces array is required" if workspaces.nil? || !workspaces.is_a?(Array) || workspaces.empty? raise ArgumentError, "Maximum 50 workspaces per bulk provision" if workspaces.length > 50 @client.post("/enterprise/workspaces/provision/bulk", { workspaces: workspaces }) end |
#resubmit_verification(workspace_id, **partial_updates) ⇒ Object
Convenience alias for resubmits. Identical to submit_verification but reads more naturally when you only want to update a few fields after a rejection.
client.enterprise.workspaces.resubmit_verification(workspace_id,
contact: { email: "new@email.com" })
101 102 103 |
# File 'lib/sendly/enterprise.rb', line 101 def resubmit_verification(workspace_id, **partial_updates) submit_verification(workspace_id, **partial_updates) end |
#resume(workspace_id) ⇒ Object
240 241 242 243 244 |
# File 'lib/sendly/enterprise.rb', line 240 def resume(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.post("/enterprise/workspaces/#{workspace_id}/resume") end |
#revoke_key(workspace_id, key_id) ⇒ Object
153 154 155 156 157 158 |
# File 'lib/sendly/enterprise.rb', line 153 def revoke_key(workspace_id, key_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Key ID is required" if key_id.nil? || key_id.empty? @client.delete("/enterprise/workspaces/#{workspace_id}/keys/#{key_id}") end |
#send_invitation(workspace_id, email:, role:) ⇒ Object
261 262 263 264 265 266 267 268 269 270 |
# File 'lib/sendly/enterprise.rb', line 261 def send_invitation(workspace_id, email:, role:) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Email is required" if email.nil? || email.empty? raise ArgumentError, "Role is required" if role.nil? || role.empty? @client.post("/enterprise/workspaces/#{workspace_id}/invitations", { email: email, role: role }) end |
#set_custom_domain(workspace_id, page_id, domain:) ⇒ Object
253 254 255 256 257 258 259 |
# File 'lib/sendly/enterprise.rb', line 253 def set_custom_domain(workspace_id, page_id, domain:) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Page ID is required" if page_id.nil? || page_id.empty? raise ArgumentError, "Domain is required" if domain.nil? || domain.empty? @client.put("/enterprise/workspaces/#{workspace_id}/pages/#{page_id}/domain", { domain: domain }) end |
#set_quota(workspace_id, monthly_message_quota:) ⇒ Object
291 292 293 294 295 296 297 |
# File 'lib/sendly/enterprise.rb', line 291 def set_quota(workspace_id, monthly_message_quota:) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.put("/enterprise/workspaces/#{workspace_id}/quota", { monthlyMessageQuota: }) end |
#set_webhook(workspace_id, url:, events: nil, description: nil) ⇒ Object
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/sendly/enterprise.rb', line 199 def set_webhook(workspace_id, url:, events: nil, description: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Webhook URL is required" if url.nil? || url.empty? body = { url: url } body[:events] = events if events body[:description] = description if description @client.put("/enterprise/workspaces/#{workspace_id}/webhooks", body) end |
#submit_verification(workspace_id, business_name: nil, doing_business_as: nil, website: nil, entity_type: nil, address: nil, contact: nil, brn: nil, brn_type: nil, brn_country: nil, use_case: nil, use_case_summary: nil, sample_messages: nil, opt_in_workflow: nil, opt_in_image_urls: nil, monthly_volume: nil, additional_information: nil, age_gated_content: nil, isv_reseller: nil, privacy_url: nil, terms_url: nil) ⇒ Object
Submit (or resubmit) a verification for an enterprise workspace.
Partial-update friendly (May 2026): for resubmit on an existing workspace, you only need to send the fields you want to change —everything else is preserved from the existing record. Hosted page URLs (/biz/, /opt-in/, /legal/) generated during provision are auto-preserved.
For sole proprietors, leave brn/brn_type/brn_country nil — the server strips them before forwarding to the carrier.
Accepts snake_case keyword arguments which are transformed to the camelCase keys the API expects. Nested address and contact hashes should already use camelCase keys (e.g. firstName, lastName) since they are passed through verbatim.
Example (full submit):
client.enterprise.workspaces.submit_verification(workspace_id,
business_name: "Acme LLC",
website: "https://acme.com",
address: { street: "...", city: "...", state: "California", zip: "90001", country: "US" },
contact: { firstName: "...", lastName: "...", email: "...", phone: "+15551234567" },
use_case: "Insurance Services",
use_case_summary: "...",
sample_messages: "...",
opt_in_workflow: "...",
entity_type: "SOLE_PROPRIETOR")
Example (partial-update resubmit, only changing email):
client.enterprise.workspaces.submit_verification(workspace_id,
contact: { email: "new@email.com" })
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/sendly/enterprise.rb', line 67 def submit_verification(workspace_id, business_name: nil, doing_business_as: nil, website: nil, entity_type: nil, address: nil, contact: nil, brn: nil, brn_type: nil, brn_country: nil, use_case: nil, use_case_summary: nil, sample_messages: nil, opt_in_workflow: nil, opt_in_image_urls: nil, monthly_volume: nil, additional_information: nil, age_gated_content: nil, isv_reseller: nil, privacy_url: nil, terms_url: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? body = {} body[:businessName] = business_name unless business_name.nil? body[:doingBusinessAs] = doing_business_as unless doing_business_as.nil? body[:website] = website unless website.nil? body[:entityType] = entity_type unless entity_type.nil? body[:address] = address unless address.nil? body[:contact] = contact unless contact.nil? body[:brn] = brn unless brn.nil? body[:brnType] = brn_type unless brn_type.nil? body[:brnCountry] = brn_country unless brn_country.nil? body[:useCase] = use_case unless use_case.nil? body[:useCaseSummary] = use_case_summary unless use_case_summary.nil? body[:sampleMessages] = unless .nil? body[:optInWorkflow] = opt_in_workflow unless opt_in_workflow.nil? body[:optInImageUrls] = opt_in_image_urls unless opt_in_image_urls.nil? body[:monthlyVolume] = monthly_volume unless monthly_volume.nil? body[:additionalInformation] = additional_information unless additional_information.nil? body[:ageGatedContent] = age_gated_content unless age_gated_content.nil? body[:isvReseller] = isv_reseller unless isv_reseller.nil? body[:privacyUrl] = privacy_url unless privacy_url.nil? body[:termsUrl] = terms_url unless terms_url.nil? @client.post("/enterprise/workspaces/#{workspace_id}/verification/submit", body) end |
#suspend(workspace_id, reason: nil) ⇒ Object
231 232 233 234 235 236 237 238 |
# File 'lib/sendly/enterprise.rb', line 231 def suspend(workspace_id, reason: nil) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? body = {} body[:reason] = reason if reason @client.post("/enterprise/workspaces/#{workspace_id}/suspend", body) end |
#test_webhook(workspace_id) ⇒ Object
225 226 227 228 229 |
# File 'lib/sendly/enterprise.rb', line 225 def test_webhook(workspace_id) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? @client.post("/enterprise/workspaces/#{workspace_id}/webhooks/test") end |
#transfer_credits(workspace_id, source_workspace_id:, amount:) ⇒ Object
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/sendly/enterprise.rb', line 120 def transfer_credits(workspace_id, source_workspace_id:, amount:) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Source workspace ID is required" if source_workspace_id.nil? || source_workspace_id.empty? raise ArgumentError, "Amount must be a positive number" if !amount.is_a?(Integer) || amount <= 0 @client.post("/enterprise/workspaces/#{workspace_id}/transfer-credits", { source_workspace_id: source_workspace_id, amount: amount }) end |
#update_opt_in_page(workspace_id, page_id, logo_url: nil, header_color: nil, button_color: nil, custom_headline: nil, custom_benefits: nil) ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/sendly/enterprise.rb', line 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) raise ArgumentError, "Workspace ID is required" if workspace_id.nil? || workspace_id.empty? raise ArgumentError, "Page ID is required" if page_id.nil? || page_id.empty? body = {} body[:logoUrl] = logo_url unless logo_url.nil? body[:headerColor] = header_color unless header_color.nil? body[:buttonColor] = unless .nil? body[:customHeadline] = custom_headline unless custom_headline.nil? body[:customBenefits] = custom_benefits unless custom_benefits.nil? @client.patch("/enterprise/workspaces/#{workspace_id}/opt-in-pages/#{page_id}", body) end |