Class: KHL::HTTP::ChannelRole

Inherits:
Base
  • Object
show all
Defined in:
lib/khl/http/channel_role.rb

Overview

频道角色权限相关接口 developer.kaiheila.cn/doc/http/channel

Constant Summary

Constants inherited from Base

Base::API_VERSION, Base::BASE_URL, Base::END_POINT

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #post, #post_file

Constructor Details

This class inherits a constructor from KHL::HTTP::Base

Instance Method Details

#create(channel_id, options = {}) ⇒ KHL::HTTP::Response

创建频道角色权限

Parameters:

  • channel_id (String)

    频道 ID,如果频道是分组的 ID,会同步给所有 sync=1 的子频道

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :type (String)

    value 的类型,只能为 “role_id”,“user_id”,不传则默认为 “user_id”

  • :value (String)

    根据 type 的值,为 用户 ID 或 频道 ID

Returns:



23
24
25
# File 'lib/khl/http/channel_role.rb', line 23

def create(channel_id, options = {})
  post(options.merge(channel_id: channel_id))
end

#delete(channel_id, options = {}) ⇒ KHL::HTTP::Response

删除频道角色权限

Parameters:

  • channel_id (String)

    频道 ID,如果频道是分组的 ID,会同步给所有 sync=1 的子频道

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :type (String)

    value 的类型,只能为 “role_id”,“user_id”,不传则默认为 “user_id”

  • :value (String)

    根据 type 的值,为用户 ID 或频道 ID

Returns:



45
46
47
# File 'lib/khl/http/channel_role.rb', line 45

def delete(channel_id, options = {})
  post(options.merge(channel_id: channel_id))
end

#index(channel_id) ⇒ KHL::HTTP::Response

频道角色权限详情

Parameters:

  • channel_id (String)

    频道 ID

Returns:



13
14
15
# File 'lib/khl/http/channel_role.rb', line 13

def index(channel_id)
  get(channel_id: channel_id)
end

#update(channel_id, options = {}) ⇒ KHL::HTTP::Response

更新频道角色权限

Parameters:

  • channel_id (String)

    频道 ID,如果频道是分组的 ID,会同步给所有 sync=1 的子频道

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :type (String)

    value 的类型,只能为 “role_id”,“user_id”,不传则默认为 “user_id”

  • :value (String)

    根据 type 的值,为 用户 ID 或 频道 ID

  • :allow (Integer)

    默认为 0,想要设置的允许的权限值

  • :deny (Integer)

    默认为 0,想要设置的拒绝的权限值

Returns:



35
36
37
# File 'lib/khl/http/channel_role.rb', line 35

def update(channel_id, options = {})
  post(options.merge(channel_id: channel_id))
end