stytch 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stytch/otps.rb +44 -1
- data/lib/stytch/sessions.rb +6 -6
- data/lib/stytch/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: 95cdc60c0add8eb1aba7e844f54ed5e9c9ed3dc26ad299870a07d897634801b6
|
4
|
+
data.tar.gz: e88adcfd927ea90cfa200909e95706a765cd22c6153105a2206ee6aaa9840102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 435c13d8d023dc519b00ca38b1c1a3b149cc01530e71b1dedd30a4f60ca0a63064c5c226f5af48a04aff1cf4d57962783d1fa9f15ca439f6b543960b40de9b51
|
7
|
+
data.tar.gz: da191a50f950473cb38337e867f3732a6263e862aa9a22245c003ecbd4586d009e0d3c5b62147e046e521ddff31e28967f533ee0937a6dddcd9b9adf929a4c6e
|
data/lib/stytch/otps.rb
CHANGED
@@ -6,7 +6,7 @@ module Stytch
|
|
6
6
|
class OTPs
|
7
7
|
include Stytch::RequestHelper
|
8
8
|
|
9
|
-
attr_reader :sms, :whatsapp
|
9
|
+
attr_reader :sms, :whatsapp, :email
|
10
10
|
|
11
11
|
PATH = '/v1/otps'
|
12
12
|
|
@@ -15,6 +15,7 @@ module Stytch
|
|
15
15
|
|
16
16
|
@sms = Stytch::OTPs::SMS.new(@connection)
|
17
17
|
@whatsapp = Stytch::OTPs::WhatsApp.new(@connection)
|
18
|
+
@email = Stytch::OTPs::Email.new(@connection)
|
18
19
|
end
|
19
20
|
|
20
21
|
def authenticate(
|
@@ -121,5 +122,47 @@ module Stytch
|
|
121
122
|
post_request("#{PATH}/login_or_create", request)
|
122
123
|
end
|
123
124
|
end
|
125
|
+
|
126
|
+
class Email
|
127
|
+
include Stytch::RequestHelper
|
128
|
+
|
129
|
+
PATH = "#{Stytch::OTPs::PATH}/email"
|
130
|
+
|
131
|
+
def initialize(connection)
|
132
|
+
@connection = connection
|
133
|
+
end
|
134
|
+
|
135
|
+
def send(
|
136
|
+
email:,
|
137
|
+
expiration_minutes: nil,
|
138
|
+
attributes: {}
|
139
|
+
)
|
140
|
+
request = {
|
141
|
+
email: email,
|
142
|
+
expiration_minutes: expiration_minutes
|
143
|
+
}
|
144
|
+
|
145
|
+
request[:attributes] = attributes if attributes != {}
|
146
|
+
|
147
|
+
post_request("#{PATH}/send", request)
|
148
|
+
end
|
149
|
+
|
150
|
+
def login_or_create(
|
151
|
+
email:,
|
152
|
+
expiration_minutes: nil,
|
153
|
+
attributes: {},
|
154
|
+
create_user_as_pending: false
|
155
|
+
)
|
156
|
+
request = {
|
157
|
+
email: email,
|
158
|
+
expiration_minutes: expiration_minutes,
|
159
|
+
create_user_as_pending: create_user_as_pending
|
160
|
+
}
|
161
|
+
|
162
|
+
request[:attributes] = attributes if attributes != {}
|
163
|
+
|
164
|
+
post_request("#{PATH}/login_or_create", request)
|
165
|
+
end
|
166
|
+
end
|
124
167
|
end
|
125
168
|
end
|
data/lib/stytch/sessions.rb
CHANGED
@@ -14,7 +14,7 @@ module Stytch
|
|
14
14
|
|
15
15
|
def get(user_id:)
|
16
16
|
query_params = {
|
17
|
-
|
17
|
+
user_id: user_id
|
18
18
|
}
|
19
19
|
|
20
20
|
request = request_with_query_params(PATH, query_params)
|
@@ -23,11 +23,11 @@ module Stytch
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def authenticate(
|
26
|
-
|
27
|
-
|
26
|
+
session_token:,
|
27
|
+
session_duration_minutes: nil
|
28
28
|
)
|
29
29
|
request = {
|
30
|
-
|
30
|
+
session_token: session_token
|
31
31
|
}
|
32
32
|
|
33
33
|
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
@@ -36,8 +36,8 @@ module Stytch
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def revoke(
|
39
|
-
|
40
|
-
|
39
|
+
session_id: nil,
|
40
|
+
session_token: nil
|
41
41
|
)
|
42
42
|
request = {}
|
43
43
|
|
data/lib/stytch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stytch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|