Class: AuthingRuby::ManagementClient

Inherits:
Object
  • Object
show all
Defined in:
lib/authing_ruby/management/ManagementClient.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ManagementClient

Returns a new instance of ManagementClient.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/authing_ruby/management/ManagementClient.rb', line 12

def initialize(options = {})
  @userPoolId = options.fetch(:userPoolId, nil)
  @secret = options.fetch(:secret, nil)
  @appId = options.fetch(:appId, nil)
  @host = options.fetch(:host, 'https://core.authing.cn')
  @accessToken = options.fetch(:accessToken, nil)
  
  if @userPoolId == nil && @appId == nil
    raise '请提供 userPoolId 或 appId!'
  end

  graphqlApiEndpointV2 = "#{@host}/graphql/v2"
  @graphqlClient = AuthingRuby::Common::GraphqlClient.new(graphqlApiEndpointV2, options)
  @tokenProvider = AuthingRuby::ManagementTokenProvider.new(options, @graphqlClient)
  @httpClient = AuthingRuby::Common::HttpClient.new(options, @tokenProvider)
  @publicKeyManager = AuthingRuby::Common::PublicKeyManager.new(options)

  @users = AuthingRuby::UsersManagementClient.new(
    options,
    @graphqlClient,
    @httpClient,
    @tokenProvider,
    @publicKeyManager
  );

  @applications = AuthingRuby::ApplicationsManagementClient.new(
    options,
    @httpClient,
    @graphqlClient,
    @tokenProvider,
  );

  @acl = AuthingRuby::AclManagementClient.new(
    options,
    @httpClient,
    @graphqlClient,
    @tokenProvider,
  );

end

Instance Method Details

#aclObject



61
62
63
# File 'lib/authing_ruby/management/ManagementClient.rb', line 61

def acl
  return @acl
end

#applicationsObject



57
58
59
# File 'lib/authing_ruby/management/ManagementClient.rb', line 57

def applications
  return @applications
end

#usersObject



53
54
55
# File 'lib/authing_ruby/management/ManagementClient.rb', line 53

def users
  return @users
end