sendly 3.9.0 → 3.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b564f46a8ec165fd80f89040c26500ab232c68cdff29779b64f3c00aeb4a0d81
4
- data.tar.gz: ca4a52d6b2fedc6ff013fd15522f89f7332bc2c994074f00de2981514e268294
3
+ metadata.gz: e88b9e3a59dab497fea9c606a1e98d838aa3334b57d337b3cd2ff9ecb7092f54
4
+ data.tar.gz: 2813db1e90f2932e658f040b6cb54a86cdeb22e970a25975a2addb98b27749eb
5
5
  SHA512:
6
- metadata.gz: c00792a9939c92f353dce974493a583bf1ef86a48dcff2bf822679bd513fd5e481f649f297a0e496ff10f70f749436724a4d48d6d460dbb0129f66684a7b2708
7
- data.tar.gz: 91cc0a4c85706f4169f3db2e17f04861a27d549b0b281328967101539bc728440744cd6c6efc118a620dab77fadffa81887bc9c9323935dc7a6f08d32b80b02b
6
+ metadata.gz: 991f19cbeadff9ebbf46730c6e41051985139394445d796ecf367b9d7a716d358c6fd6f78fe62a49a2425176d813fd0c6c226d08a9d1b0ba3e21d838a6e99a87
7
+ data.tar.gz: d582ced4e0d79a9d0009883f19d7850ceb1afceb8db8951e8ae0f1615f488f9e7ed5125ef85c8fbbe1f954ef102659b1d7aaceb6f1904e50d5a007ac4debd609
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sendly (3.9.0)
4
+ sendly (3.11.0)
5
5
  faraday (~> 2.0)
6
6
  faraday-retry (~> 2.0)
7
7
 
data/lib/sendly/verify.rb CHANGED
@@ -86,9 +86,81 @@ module Sendly
86
86
  end
87
87
  end
88
88
 
89
+ class VerifySession
90
+ attr_reader :id, :url, :status, :success_url, :cancel_url, :brand_name,
91
+ :brand_color, :phone, :verification_id, :token, :metadata,
92
+ :expires_at, :created_at
93
+
94
+ def initialize(data)
95
+ @id = data["id"]
96
+ @url = data["url"]
97
+ @status = data["status"]
98
+ @success_url = data["success_url"]
99
+ @cancel_url = data["cancel_url"]
100
+ @brand_name = data["brand_name"]
101
+ @brand_color = data["brand_color"]
102
+ @phone = data["phone"]
103
+ @verification_id = data["verification_id"]
104
+ @token = data["token"]
105
+ @metadata = data["metadata"] || {}
106
+ @expires_at = data["expires_at"]
107
+ @created_at = data["created_at"]
108
+ end
109
+
110
+ def to_h
111
+ {
112
+ id: id, url: url, status: status, success_url: success_url,
113
+ cancel_url: cancel_url, brand_name: brand_name, brand_color: brand_color,
114
+ phone: phone, verification_id: verification_id, token: token,
115
+ metadata: metadata, expires_at: expires_at, created_at: created_at
116
+ }.compact
117
+ end
118
+ end
119
+
120
+ class ValidateSessionResponse
121
+ attr_reader :valid, :session_id, :phone, :verified_at, :metadata
122
+
123
+ def initialize(data)
124
+ @valid = data["valid"]
125
+ @session_id = data["session_id"]
126
+ @phone = data["phone"]
127
+ @verified_at = data["verified_at"]
128
+ @metadata = data["metadata"] || {}
129
+ end
130
+
131
+ def valid?
132
+ valid
133
+ end
134
+ end
135
+
136
+ class SessionsResource
137
+ def initialize(client)
138
+ @client = client
139
+ end
140
+
141
+ def create(success_url:, cancel_url: nil, brand_name: nil, brand_color: nil, metadata: nil)
142
+ body = { success_url: success_url }
143
+ body[:cancel_url] = cancel_url if cancel_url
144
+ body[:brand_name] = brand_name if brand_name
145
+ body[:brand_color] = brand_color if brand_color
146
+ body[:metadata] = metadata if metadata
147
+
148
+ response = @client.post("/verify/sessions", body)
149
+ VerifySession.new(response)
150
+ end
151
+
152
+ def validate(token:)
153
+ response = @client.post("/verify/sessions/validate", { token: token })
154
+ ValidateSessionResponse.new(response)
155
+ end
156
+ end
157
+
89
158
  class VerifyResource
159
+ attr_reader :sessions
160
+
90
161
  def initialize(client)
91
162
  @client = client
163
+ @sessions = SessionsResource.new(client)
92
164
  end
93
165
 
94
166
  def send(phone:, channel: nil, code_length: nil, expires_in: nil, max_attempts: nil,
@@ -104,7 +176,12 @@ module Sendly
104
176
  body[:locale] = locale if locale
105
177
  body[:metadata] = metadata if metadata
106
178
 
107
- response = @client.post("/verify/send", body)
179
+ response = @client.post("/verify", body)
180
+ SendVerificationResponse.new(response)
181
+ end
182
+
183
+ def resend(id)
184
+ response = @client.post("/verify/#{id}/resend")
108
185
  SendVerificationResponse.new(response)
109
186
  end
110
187
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sendly
4
- VERSION = "3.9.0"
4
+ VERSION = "3.11.0"
5
5
  end
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.9.0
4
+ version: 3.11.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-01-05 00:00:00.000000000 Z
11
+ date: 2026-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday