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

Version Path
authing_ruby-1.1.6 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.5 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.4 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.3 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.2 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.1 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.1.0 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.0.9 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.0.8 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.0.7 lib/authing_ruby/management/ApplicationsManagementClient.rb
authing_ruby-1.0.6 lib/authing_ruby/management/ApplicationsManagementClient.rb