lib/stytch/otps.rb in stytch-6.6.0 vs lib/stytch/otps.rb in stytch-7.0.0
- old
+ new
@@ -99,10 +99,11 @@
session_token: nil,
session_duration_minutes: nil,
session_jwt: nil,
session_custom_claims: nil
)
+ headers = {}
request = {
method_id: method_id,
code: code
}
request[:attributes] = attributes unless attributes.nil?
@@ -110,11 +111,11 @@
request[:session_token] = session_token unless session_token.nil?
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
request[:session_jwt] = session_jwt unless session_jwt.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
- post_request('/v1/otps/authenticate', request)
+ post_request('/v1/otps/authenticate', request, headers)
end
class Sms
include Stytch::RequestHelper
@@ -188,21 +189,22 @@
locale: nil,
user_id: nil,
session_token: nil,
session_jwt: nil
)
+ headers = {}
request = {
phone_number: phone_number
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
request[:locale] = locale unless locale.nil?
request[:user_id] = user_id unless user_id.nil?
request[:session_token] = session_token unless session_token.nil?
request[:session_jwt] = session_jwt unless session_jwt.nil?
- post_request('/v1/otps/sms/send', request)
+ post_request('/v1/otps/sms/send', request, headers)
end
# Send a One-Time Passcode (OTP) to a User using their phone number. If the phone number is not associated with a user already, a user will be created.
#
# ### Cost to send SMS OTP
@@ -262,19 +264,20 @@
expiration_minutes: nil,
attributes: nil,
create_user_as_pending: nil,
locale: nil
)
+ headers = {}
request = {
phone_number: phone_number
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
request[:create_user_as_pending] = create_user_as_pending unless create_user_as_pending.nil?
request[:locale] = locale unless locale.nil?
- post_request('/v1/otps/sms/login_or_create', request)
+ post_request('/v1/otps/sms/login_or_create', request, headers)
end
end
class Whatsapp
include Stytch::RequestHelper
@@ -347,21 +350,22 @@
locale: nil,
user_id: nil,
session_token: nil,
session_jwt: nil
)
+ headers = {}
request = {
phone_number: phone_number
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
request[:locale] = locale unless locale.nil?
request[:user_id] = user_id unless user_id.nil?
request[:session_token] = session_token unless session_token.nil?
request[:session_jwt] = session_jwt unless session_jwt.nil?
- post_request('/v1/otps/whatsapp/send', request)
+ post_request('/v1/otps/whatsapp/send', request, headers)
end
# Send a one-time passcode (OTP) to a User's WhatsApp using their phone number. If the phone number is not associated with a User already, a User will be created.
#
# ### Cost to send SMS OTP
@@ -419,19 +423,20 @@
expiration_minutes: nil,
attributes: nil,
create_user_as_pending: nil,
locale: nil
)
+ headers = {}
request = {
phone_number: phone_number
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
request[:create_user_as_pending] = create_user_as_pending unless create_user_as_pending.nil?
request[:locale] = locale unless locale.nil?
- post_request('/v1/otps/whatsapp/login_or_create', request)
+ post_request('/v1/otps/whatsapp/login_or_create', request, headers)
end
end
class Email
include Stytch::RequestHelper
@@ -505,10 +510,11 @@
session_token: nil,
session_jwt: nil,
login_template_id: nil,
signup_template_id: nil
)
+ headers = {}
request = {
email: email
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
@@ -517,11 +523,11 @@
request[:session_token] = session_token unless session_token.nil?
request[:session_jwt] = session_jwt unless session_jwt.nil?
request[:login_template_id] = login_template_id unless login_template_id.nil?
request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
- post_request('/v1/otps/email/send', request)
+ post_request('/v1/otps/email/send', request, headers)
end
# Send a one-time passcode (OTP) to a User using their email. If the email is not associated with a User already, a User will be created.
#
# ### Next steps
@@ -584,20 +590,21 @@
create_user_as_pending: nil,
locale: nil,
login_template_id: nil,
signup_template_id: nil
)
+ headers = {}
request = {
email: email
}
request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
request[:attributes] = attributes unless attributes.nil?
request[:create_user_as_pending] = create_user_as_pending unless create_user_as_pending.nil?
request[:locale] = locale unless locale.nil?
request[:login_template_id] = login_template_id unless login_template_id.nil?
request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
- post_request('/v1/otps/email/login_or_create', request)
+ post_request('/v1/otps/email/login_or_create', request, headers)
end
end
end
end