Class: AuthingRuby::ApplicationsManagementClient

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, httpClient, graphqlClient, tokenProvider) ⇒ ApplicationsManagementClient

Returns a new instance of ApplicationsManagementClient.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/authing_ruby/management/ApplicationsManagementClient.rb', line 6

def initialize(options = {}, httpClient, graphqlClient, tokenProvider)
  @options = options;
  @httpClient = httpClient;
  @graphqlClient = graphqlClient;
  @tokenProvider = tokenProvider;
  # this.acl = new AclManagementClient(
  #  options,
  #  graphqlClient,
  #  httpClient,
  #  tokenProvider
  # );
  # this.roles = new RolesManagementClient(
  #  options,
  #  graphqlClient,
  #  tokenProvider
  # );
  # this.agreements = new AgreementManagementClient(
  #  options,
  #  graphqlClient,
  #  httpClient,
  #  tokenProvider
  # );
end

Instance Method Details

#create(options = {}) ⇒ Object

创建应用



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/authing_ruby/management/ApplicationsManagementClient.rb', line 44

def create(options = {})
  result = @httpClient.request({
    method: 'POST',
    url: "#{@options.fetch(:host, nil)}/api/v2/applications",
    data: {
      "name": options.fetch(:name, nil),
      "identifier": options.fetch(:identifier, nil),
      "redirectUris": options.fetch(:redirectUris, nil),
      "logo": options.fetch(:logo, nil),
    }
  });
  return result;
end

#delete(appid) ⇒ Object

删除应用



59
60
61
62
63
64
65
66
# File 'lib/authing_ruby/management/ApplicationsManagementClient.rb', line 59

def delete(appid)
  url = "#{@options.fetch(:host, nil)}/api/v2/applications/#{appid}"
  result = @httpClient.request({
    method: 'DELETE',
    url: url,
  });
  return result
end

#findById(appid) ⇒ Object

获取应用详情



69
70
71
72
73
74
75
76
# File 'lib/authing_ruby/management/ApplicationsManagementClient.rb', line 69

def findById(appid)
  url = "#{@options.fetch(:host, nil)}/api/v2/applications/#{appid}"
  result = @httpClient.request({
    url: url,
    method: 'GET'
  });
  return result
end

#list(page = 1, limit = 10) ⇒ Object

获取应用列表



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/authing_ruby/management/ApplicationsManagementClient.rb', line 31

def list(page = 1, limit = 10)
  data = @httpClient.request({
    method: 'GET',
    url: "#{@options.fetch(:host, nil)}/api/v2/applications",
    data: {
      "page": page,
      "limit": limit
    }
  });
  return data;
end