Module: ChatWork::Member

Defined in:
lib/chatwork/member.rb

Class Method Summary collapse

Class Method Details

.get(room_id:) {|response_body, response_header| ... } ⇒ Array<Hashie::Mash>

Get the list of all chat members associated with the specified chat

Examples:

response format

[
  {
    "account_id": 123,
    "role": "member",
    "name": "John Smith",
    "chatwork_id": "tarochatworkid",
    "organization_id": 101,
    "organization_name": "Hello Company",
    "department": "Marketing",
    "avatar_image_url": "https://example.com/abc.png"
  }
]

Parameters:

  • room_id (Integer)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Array<Hashie::Mash>)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)

Returns:

  • (Array<Hashie::Mash>)

See Also:



29
30
31
# File 'lib/chatwork/member.rb', line 29

def self.get(room_id:, &block)
  ChatWork.client.get_members(room_id: room_id, &block)
end

.update_all(room_id:, members_admin_ids:, members_member_ids: nil, members_readonly_ids: nil) {|response_body, response_header| ... } ⇒ Hashie::Mash

Change associated members of group chat at once

Examples:

response format

{
  "admin": [123, 542, 1001],
  "member": [10, 103],
  "readonly": [6, 11]
}

Parameters:

  • room_id (Integer)
  • members_admin_ids (Array<Integer>, String)

    List of user IDs who will be given administrator permission for the group chat. At least one user must be specified as an administrator.

  • members_member_ids (Array<Integer>, String) (defaults to: nil)

    List of user IDs who will be given member permission for the group chat.

  • members_readonly_ids (Array<Integer>, String) (defaults to: nil)

    List of user IDs who will be given read-only permission for the group chat.

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)

Returns:

  • (Hashie::Mash)

See Also:



56
57
58
59
60
61
62
63
64
# File 'lib/chatwork/member.rb', line 56

def self.update_all(room_id:, members_admin_ids:, members_member_ids: nil, members_readonly_ids: nil, &block)
  ChatWork.client.update_all_members(
    room_id:              room_id,
    members_admin_ids:    members_admin_ids,
    members_member_ids:   members_member_ids,
    members_readonly_ids: members_readonly_ids,
    &block
  )
end