sendly 3.24.0 → 3.25.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/Gemfile.lock +1 -1
- data/lib/sendly/enterprise.rb +73 -0
- data/lib/sendly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ce8055e2573a8b49f9b1e428f08e19f0bcb91c54b336b1b7fd7b3abb74626eb
|
|
4
|
+
data.tar.gz: 78abce28f7442cf86dcd11fec12909069d28abb9e504e1e68db90bab04aa5348
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17f1465feaa0b9c6c1b12bd603fba057a4fe0f855687e659d79540662851f9ed0c7549a86e46d9cdb681f7c9000259483d2dc8a9423651810dd564975ac4fa19
|
|
7
|
+
data.tar.gz: ca17ea7e1000ff2434e426eb080dab0ff29df63b773af74850f47f1194ca0db053679f144dabd1c9f0fa2dad67c5e1d08463fcae757962505d1d4d913c793f65
|
data/Gemfile.lock
CHANGED
data/lib/sendly/enterprise.rb
CHANGED
|
@@ -390,5 +390,78 @@ module Sendly
|
|
|
390
390
|
|
|
391
391
|
@client.post("/enterprise/workspaces/provision", body)
|
|
392
392
|
end
|
|
393
|
+
|
|
394
|
+
def generate_business_page(business_name:, use_case: nil, use_case_summary: nil, contact_email: nil, contact_phone: nil, business_address: nil, social_url: nil)
|
|
395
|
+
raise ArgumentError, "Business name is required" if business_name.nil? || business_name.strip.empty?
|
|
396
|
+
|
|
397
|
+
body = { businessName: business_name }
|
|
398
|
+
body[:useCase] = use_case if use_case
|
|
399
|
+
body[:useCaseSummary] = use_case_summary if use_case_summary
|
|
400
|
+
body[:contactEmail] = contact_email if contact_email
|
|
401
|
+
body[:contactPhone] = contact_phone if contact_phone
|
|
402
|
+
body[:businessAddress] = business_address if business_address
|
|
403
|
+
body[:socialUrl] = social_url if social_url
|
|
404
|
+
|
|
405
|
+
@client.post("/enterprise/business-page/generate", body)
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
def upload_verification_document(file_path, workspace_id: nil, verification_id: nil)
|
|
409
|
+
raise ArgumentError, "File path is required" if file_path.nil? || file_path.empty?
|
|
410
|
+
raise ArgumentError, "File not found: #{file_path}" unless File.exist?(file_path)
|
|
411
|
+
|
|
412
|
+
content_type = case File.extname(file_path).downcase
|
|
413
|
+
when ".jpg", ".jpeg" then "image/jpeg"
|
|
414
|
+
when ".png" then "image/png"
|
|
415
|
+
when ".gif" then "image/gif"
|
|
416
|
+
when ".pdf" then "application/pdf"
|
|
417
|
+
when ".webp" then "image/webp"
|
|
418
|
+
else "application/octet-stream"
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
filename = File.basename(file_path)
|
|
422
|
+
|
|
423
|
+
boundary = "SendlyRuby#{SecureRandom.hex(16)}"
|
|
424
|
+
body_parts = []
|
|
425
|
+
body_parts << "--#{boundary}\r\n"
|
|
426
|
+
body_parts << "Content-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\r\n"
|
|
427
|
+
body_parts << "Content-Type: #{content_type}\r\n\r\n"
|
|
428
|
+
body_parts << File.binread(file_path)
|
|
429
|
+
|
|
430
|
+
if workspace_id
|
|
431
|
+
body_parts << "\r\n--#{boundary}\r\n"
|
|
432
|
+
body_parts << "Content-Disposition: form-data; name=\"workspaceId\"\r\n\r\n"
|
|
433
|
+
body_parts << workspace_id
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
if verification_id
|
|
437
|
+
body_parts << "\r\n--#{boundary}\r\n"
|
|
438
|
+
body_parts << "Content-Disposition: form-data; name=\"verificationId\"\r\n\r\n"
|
|
439
|
+
body_parts << verification_id
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
body_parts << "\r\n--#{boundary}--\r\n"
|
|
443
|
+
|
|
444
|
+
uri = URI.parse("#{@client.base_url}/enterprise/verification-document/upload")
|
|
445
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
446
|
+
http.use_ssl = uri.scheme == "https"
|
|
447
|
+
http.open_timeout = 10
|
|
448
|
+
http.read_timeout = @client.timeout
|
|
449
|
+
|
|
450
|
+
req = Net::HTTP::Post.new(uri)
|
|
451
|
+
req["Authorization"] = "Bearer #{@client.api_key}"
|
|
452
|
+
req["Accept"] = "application/json"
|
|
453
|
+
req["User-Agent"] = "sendly-ruby/#{Sendly::VERSION}"
|
|
454
|
+
req["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
|
|
455
|
+
req["X-Organization-Id"] = @client.organization_id if @client.organization_id
|
|
456
|
+
req.body = body_parts.join
|
|
457
|
+
|
|
458
|
+
response = http.request(req)
|
|
459
|
+
body = response.body.nil? || response.body.empty? ? {} : JSON.parse(response.body)
|
|
460
|
+
status = response.code.to_i
|
|
461
|
+
|
|
462
|
+
return body if status >= 200 && status < 300
|
|
463
|
+
|
|
464
|
+
raise Sendly::ErrorFactory.from_response(status, body)
|
|
465
|
+
end
|
|
393
466
|
end
|
|
394
467
|
end
|
data/lib/sendly/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sendly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sendly
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|