Class: StytchB2B::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/stytch/b2b_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

Returns a new instance of Client.



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
68
69
70
71
# File 'lib/stytch/b2b_client.rb', line 37

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 = true

  create_connection(&block)

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

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

  @connected_app = Stytch::ConnectedApp.new(@connection)
  @debug = Stytch::Debug.new(@connection)
  @discovery = StytchB2B::Discovery.new(@connection)
  @fraud = Stytch::Fraud.new(@fraud_connection)
  @idp = StytchB2B::IDP.new(@connection, @project_id, @jwks_cache, @policy_cache)
  @impersonation = StytchB2B::Impersonation.new(@connection)
  @m2m = Stytch::M2M.new(@connection, @project_id, @is_b2b_client, @jwks_cache)
  @magic_links = StytchB2B::MagicLinks.new(@connection)
  @oauth = StytchB2B::OAuth.new(@connection)
  @otps = StytchB2B::OTPs.new(@connection)
  @organizations = StytchB2B::Organizations.new(@connection)
  @passwords = StytchB2B::Passwords.new(@connection)
  @project = Stytch::Project.new(@connection)
  @rbac = StytchB2B::RBAC.new(@connection)
  @recovery_codes = StytchB2B::RecoveryCodes.new(@connection)
  @scim = StytchB2B::SCIM.new(@connection)
  @sso = StytchB2B::SSO.new(@connection)
  @sessions = StytchB2B::Sessions.new(@connection, @project_id, @jwks_cache, @policy_cache)
  @totps = StytchB2B::TOTPs.new(@connection)
end

Instance Attribute Details

#connected_appObject (readonly)

Returns the value of attribute connected_app.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def connected_app
  @connected_app
end

#debugObject (readonly)

Returns the value of attribute debug.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def debug
  @debug
end

#discoveryObject (readonly)

Returns the value of attribute discovery.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def discovery
  @discovery
end

#fraudObject (readonly)

Returns the value of attribute fraud.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def fraud
  @fraud
end

#idpObject (readonly)

Returns the value of attribute idp.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def idp
  @idp
end

#impersonationObject (readonly)

Returns the value of attribute impersonation.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def impersonation
  @impersonation
end

#m2mObject (readonly)

Returns the value of attribute m2m.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def m2m
  @m2m
end

Returns the value of attribute magic_links.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def magic_links
  @magic_links
end

#oauthObject (readonly)

Returns the value of attribute oauth.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def oauth
  @oauth
end

#organizationsObject (readonly)

Returns the value of attribute organizations.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def organizations
  @organizations
end

#otpsObject (readonly)

Returns the value of attribute otps.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def otps
  @otps
end

#passwordsObject (readonly)

Returns the value of attribute passwords.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def passwords
  @passwords
end

#projectObject (readonly)

Returns the value of attribute project.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def project
  @project
end

#rbacObject (readonly)

Returns the value of attribute rbac.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def rbac
  @rbac
end

#recovery_codesObject (readonly)

Returns the value of attribute recovery_codes.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def recovery_codes
  @recovery_codes
end

#scimObject (readonly)

Returns the value of attribute scim.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def scim
  @scim
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def sessions
  @sessions
end

#ssoObject (readonly)

Returns the value of attribute sso.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def sso
  @sso
end

#totpsObject (readonly)

Returns the value of attribute totps.



35
36
37
# File 'lib/stytch/b2b_client.rb', line 35

def totps
  @totps
end