stytch 2.0.0 → 2.1.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/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: e297565a826ab7318a1471d3b4286bba6d8a58c1f335bb5fe39b31355dad8bb0
|
4
|
+
data.tar.gz: 6d5873eed220a0d85539b0264408757451ce18e106dd58cf5b747543697808cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcec30dcf3b4e89293bb41f05202aca38b6b46d2a42531d9cae2471a1b6c8a7052bca1aa962a4017a2486b92a0f1c24b7634c59c3ed8725f3763d17a6162cef7
|
7
|
+
data.tar.gz: 36d398ca7e3a987cb94efa45875d17473dfdd348266474e9c2f29ec6a1491a0bf001a1960f9ed712f946904daf0265f79e851689a7ff9cb9cf6e546d843d64af
|
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
|
9
|
+
attr_reader :sms, :whatsapp
|
10
10
|
|
11
11
|
PATH = '/v1/otps'
|
12
12
|
|
@@ -14,6 +14,7 @@ module Stytch
|
|
14
14
|
@connection = connection
|
15
15
|
|
16
16
|
@sms = Stytch::OTPs::SMS.new(@connection)
|
17
|
+
@whatsapp = Stytch::OTPs::WhatsApp.new(@connection)
|
17
18
|
end
|
18
19
|
|
19
20
|
def authenticate(
|
@@ -74,5 +75,47 @@ module Stytch
|
|
74
75
|
post_request("#{PATH}/login_or_create", request)
|
75
76
|
end
|
76
77
|
end
|
78
|
+
|
79
|
+
class WhatsApp
|
80
|
+
include Stytch::RequestHelper
|
81
|
+
|
82
|
+
PATH = "#{Stytch::OTPs::PATH}/whatsapp"
|
83
|
+
|
84
|
+
def initialize(connection)
|
85
|
+
@connection = connection
|
86
|
+
end
|
87
|
+
|
88
|
+
def send(
|
89
|
+
phone_number:,
|
90
|
+
expiration_minutes: nil,
|
91
|
+
attributes: {}
|
92
|
+
)
|
93
|
+
request = {
|
94
|
+
phone_number: phone_number,
|
95
|
+
expiration_minutes: expiration_minutes
|
96
|
+
}
|
97
|
+
|
98
|
+
request[:attributes] = attributes if attributes != {}
|
99
|
+
|
100
|
+
post_request("#{PATH}/send", request)
|
101
|
+
end
|
102
|
+
|
103
|
+
def login_or_create(
|
104
|
+
phone_number:,
|
105
|
+
expiration_minutes: nil,
|
106
|
+
attributes: {},
|
107
|
+
create_user_as_pending: false
|
108
|
+
)
|
109
|
+
request = {
|
110
|
+
phone_number: phone_number,
|
111
|
+
expiration_minutes: expiration_minutes,
|
112
|
+
create_user_as_pending: create_user_as_pending
|
113
|
+
}
|
114
|
+
|
115
|
+
request[:attributes] = attributes if attributes != {}
|
116
|
+
|
117
|
+
post_request("#{PATH}/login_or_create", request)
|
118
|
+
end
|
119
|
+
end
|
77
120
|
end
|
78
121
|
end
|
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.1.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-06-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|