Sha256: bba94ca1f3d0adc7e83c416facf87e9068e8a1990002ae5b5fc992944f771499
Contents?: true
Size: 1009 Bytes
Versions: 3
Compression:
Stored size: 1009 Bytes
Contents
module Stytch module Endpoints module User PATH = "/v1/users".freeze def get_user(user_id:) get("#{PATH}/#{user_id}") end def create_user( email:, name: {}, attributes: {} ) request = { email: email, } request[:name] = name if name != {} request[:attributes] = attributes if attributes != {} post(PATH, request) end def update_user( user_id:, name: nil, emails: [], attributes: {} ) request = { name: name, emails: format_emails(emails), } request[:attributes] = attributes if attributes != {} put("#{PATH}/#{user_id}", request) end def delete_user(user_id:) delete("#{PATH}/#{user_id}") end private def format_emails(emails) e = [] emails.each { |email| e << { email: email} } e end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stytch-0.1.9 | lib/stytch/endpoints/user.rb |
stytch-0.1.8 | lib/stytch/endpoints/user.rb |
stytch-0.1.7 | lib/stytch/endpoints/user.rb |