stytch 2.0.0 → 2.1.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: c1f99d2093072e2e5ee91b23fa745105f56a4ae2b8abcd4ce01f76048d9bec42
4
- data.tar.gz: 718a09bc69310b8e30627ebe66cdddb49713f9101dd06cfe13746c8ad88a0ff3
3
+ metadata.gz: e297565a826ab7318a1471d3b4286bba6d8a58c1f335bb5fe39b31355dad8bb0
4
+ data.tar.gz: 6d5873eed220a0d85539b0264408757451ce18e106dd58cf5b747543697808cc
5
5
  SHA512:
6
- metadata.gz: a90634d8f228fd2860f3674dc7fd522d0d14cf0c36928bc547cafcba1e428597de622e503d1e1758df2fe90e62d0ca6e6fcdb8ff73232b6ce73cdd7b77565591
7
- data.tar.gz: 48117adc597da070fdd886e3bb30e9a27820913933dfe3636b1222a698ad135837debee40c4d71d04d984075a1d324659e25e9e5b7368452add397698027e60a
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.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.0.0
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-22 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday