Class: Stytch::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/stytch/client.rb

Constant Summary collapse

ENVIRONMENTS =
i[live test].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_id:, secret:, env: nil, fraud_env: nil, timeout: nil, jwks: nil, &block) ⇒ Client



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/stytch/client.rb', line 35

def initialize(project_id:, secret:, env: nil, fraud_env: nil, timeout: nil, jwks: nil, &block)
  @api_host = api_host(env, project_id)
  @fraud_api_host = fraud_api_host(fraud_env)
  @project_id = project_id
  @secret = secret
  @timeout = timeout
  @is_b2b_client = false

  create_connection(&block)

  @jwks_cache = Stytch::JWKSCache.new(@connection, @project_id, jwks, is_b2b_client: @is_b2b_client)

  rbac = Stytch::RBAC.new(@connection)
  @policy_cache = Stytch::PolicyCache.new(rbac_client: rbac)

  @connected_app = Stytch::ConnectedApp.new(@connection)
  @crypto_wallets = Stytch::CryptoWallets.new(@connection)
  @debug = Stytch::Debug.new(@connection)
  @fraud = Stytch::Fraud.new(@fraud_connection)
  @idp = Stytch::IDP.new(@connection, @project_id, @jwks_cache, @policy_cache)
  @impersonation = Stytch::Impersonation.new(@connection)
  @m2m = Stytch::M2M.new(@connection, @project_id, @is_b2b_client, @jwks_cache)
  @magic_links = Stytch::MagicLinks.new(@connection)
  @oauth = Stytch::OAuth.new(@connection)
  @otps = Stytch::OTPs.new(@connection)
  @passwords = Stytch::Passwords.new(@connection)
  @project = Stytch::Project.new(@connection)
  @rbac = Stytch::RBAC.new(@connection)
  @sessions = Stytch::Sessions.new(@connection, @project_id, @jwks_cache, @policy_cache)
  @totps = Stytch::TOTPs.new(@connection)
  @users = Stytch::Users.new(@connection)
  @webauthn = Stytch::WebAuthn.new(@connection)
end

Instance Attribute Details

#connected_appObject (readonly)

Returns the value of attribute connected_app.



33
34
35
# File 'lib/stytch/client.rb', line 33

def connected_app
  @connected_app
end

#crypto_walletsObject (readonly)

Returns the value of attribute crypto_wallets.



33
34
35
# File 'lib/stytch/client.rb', line 33

def crypto_wallets
  @crypto_wallets
end

#debugObject (readonly)

Returns the value of attribute debug.



33
34
35
# File 'lib/stytch/client.rb', line 33

def debug
  @debug
end

#fraudObject (readonly)

Returns the value of attribute fraud.



33
34
35
# File 'lib/stytch/client.rb', line 33

def fraud
  @fraud
end

#idpObject (readonly)

Returns the value of attribute idp.



33
34
35
# File 'lib/stytch/client.rb', line 33

def idp
  @idp
end

#impersonationObject (readonly)

Returns the value of attribute impersonation.



33
34
35
# File 'lib/stytch/client.rb', line 33

def impersonation
  @impersonation
end

#m2mObject (readonly)

Returns the value of attribute m2m.



33
34
35
# File 'lib/stytch/client.rb', line 33

def m2m
  @m2m
end

Returns the value of attribute magic_links.



33
34
35
# File 'lib/stytch/client.rb', line 33

def magic_links
  @magic_links
end

#oauthObject (readonly)

Returns the value of attribute oauth.



33
34
35
# File 'lib/stytch/client.rb', line 33

def oauth
  @oauth
end

#otpsObject (readonly)

Returns the value of attribute otps.



33
34
35
# File 'lib/stytch/client.rb', line 33

def otps
  @otps
end

#passwordsObject (readonly)

Returns the value of attribute passwords.



33
34
35
# File 'lib/stytch/client.rb', line 33

def passwords
  @passwords
end

#projectObject (readonly)

Returns the value of attribute project.



33
34
35
# File 'lib/stytch/client.rb', line 33

def project
  @project
end

#rbacObject (readonly)

Returns the value of attribute rbac.



33
34
35
# File 'lib/stytch/client.rb', line 33

def rbac
  @rbac
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



33
34
35
# File 'lib/stytch/client.rb', line 33

def sessions
  @sessions
end

#totpsObject (readonly)

Returns the value of attribute totps.



33
34
35
# File 'lib/stytch/client.rb', line 33

def totps
  @totps
end

#usersObject (readonly)

Returns the value of attribute users.



33
34
35
# File 'lib/stytch/client.rb', line 33

def users
  @users
end

#webauthnObject (readonly)

Returns the value of attribute webauthn.



33
34
35
# File 'lib/stytch/client.rb', line 33

def webauthn
  @webauthn
end