class Stytch::OTPs::SMS

Constants

PATH

Public Class Methods

new(connection) click to toggle source
# File lib/stytch/otps.rb, line 47
def initialize(connection)
  @connection = connection
end

Public Instance Methods

login_or_create( phone_number:, expiration_minutes: nil, attributes: {}, create_user_as_pending: false ) click to toggle source
# File lib/stytch/otps.rb, line 66
def login_or_create(
  phone_number:,
  expiration_minutes: nil,
  attributes: {},
  create_user_as_pending: false
)
  request = {
    phone_number: phone_number,
    expiration_minutes: expiration_minutes,
    create_user_as_pending: create_user_as_pending
  }

  request[:attributes] = attributes if attributes != {}

  post_request("#{PATH}/login_or_create", request)
end
send( phone_number:, expiration_minutes: nil, attributes: {} ) click to toggle source
# File lib/stytch/otps.rb, line 51
def send(
  phone_number:,
  expiration_minutes: nil,
  attributes: {}
)
  request = {
    phone_number: phone_number,
    expiration_minutes: expiration_minutes
  }

  request[:attributes] = attributes if attributes != {}

  post_request("#{PATH}/send", request)
end