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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e40426c4e4622ec2de65ac043377a0ce080e0fad6b93fb19f848676b32bae3d0
4
- data.tar.gz: dc82a3b5b69da73bf40d2ff29d62c3afad63baa565fcf4ba59301b205e8dc6d8
3
+ metadata.gz: 95cdc60c0add8eb1aba7e844f54ed5e9c9ed3dc26ad299870a07d897634801b6
4
+ data.tar.gz: e88adcfd927ea90cfa200909e95706a765cd22c6153105a2206ee6aaa9840102
5
5
  SHA512:
6
- metadata.gz: 80b2cc7201c3f24d8486d4cbe76242b7d28f37c07a3128124e0420fd161bd62b802c875d22a1056a2743eac68c30f264a2bde070fe34876f4d722067c71705a2
7
- data.tar.gz: d5ce170c73e22b94853395012c2245824059a7eeaf833c8dfb815e4319ae093c42383889320947921a2438541ee70900848354f43ffc9c9afe6e456116996d0f
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
@@ -14,7 +14,7 @@ module Stytch
14
14
 
15
15
  def get(user_id:)
16
16
  query_params = {
17
- user_id: user_id
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
- session_token:,
27
- session_duration_minutes: nil
26
+ session_token:,
27
+ session_duration_minutes: nil
28
28
  )
29
29
  request = {
30
- session_token: session_token
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
- session_id: nil,
40
- session_token: nil
39
+ session_id: nil,
40
+ session_token: nil
41
41
  )
42
42
  request = {}
43
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '2.2.0'
4
+ VERSION = '2.3.0'
5
5
  end
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.2.0
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-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday