Sha256: 6164888101269fb1d45014e4a4b306cd6b7aefd34205f1f8fd99a4737fe1228e
Contents?: true
Size: 1.69 KB
Versions: 11
Compression:
Stored size: 1.69 KB
Contents
# 管理应用 module AuthingRuby class ApplicationsManagementClient 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 # 获取应用列表 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 # 创建应用 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 # 删除应用 def delete(appid) url = "#{@options.fetch(:host, nil)}/api/v2/applications/#{appid}" result = @httpClient.request({ method: 'DELETE', url: url, }); return result end # 获取应用详情 def findById(appid) url = "#{@options.fetch(:host, nil)}/api/v2/applications/#{appid}" result = @httpClient.request({ url: url, method: 'GET' }); return result end end end
Version data entries
11 entries across 11 versions & 1 rubygems