Module: ChatWork::Client::InvitationLinkMethods

Included in:
ChatWork::Client
Defined in:
lib/chatwork/client/invitation_link_methods.rb

Instance Method Summary collapse

Instance Method Details

Create invitation link

Examples:

response format

{
  "public": true,
  "url": "https://example.chatwork.com/g/unique-link-name",
  "need_acceptance": true,
  "description": "This is a public room for topic A."
}

Parameters:

  • room_id (Integer)
  • code (String) (defaults to: nil)

    link path (default. random string)

  • description (String) (defaults to: nil)

    description of link page

  • need_acceptance (Boolean) (defaults to: nil)

    Approval necessity. Whether participation requires administrator approval.

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:



49
50
51
52
53
54
55
56
# File 'lib/chatwork/client/invitation_link_methods.rb', line 49

def create_invitation_link(room_id:, code: nil, description: nil, need_acceptance: nil, &block)
  params = {
    code:            code,
    description:     description,
    need_acceptance: boolean_to_integer(need_acceptance),
  }
  post("/rooms/#{room_id}/link", params, &block)
end

Delete invitation link

Examples:

response format

{
  "public": false
}

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 (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:



107
108
109
# File 'lib/chatwork/client/invitation_link_methods.rb', line 107

def destroy_invitation_link(room_id:, &block)
  delete("/rooms/#{room_id}/link", &block)
end

Get invitation link

Examples:

response format

{
  "public": true,
  "url": "https://example.chatwork.com/g/randomcode42",
  "need_acceptance": true,
  "description": "Link description text"
}

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 (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:



22
23
24
# File 'lib/chatwork/client/invitation_link_methods.rb', line 22

def get_invitation_link(room_id:, &block)
  get("/rooms/#{room_id}/link", &block)
end

Update invitation link

Examples:

response format

{
  "public": true,
  "url": "https://example.chatwork.com/g/another_link_name",
  "need_acceptance": false,
  "description": "Public room for everybody"
}

Parameters:

  • room_id (Integer)
  • code (String) (defaults to: nil)

    link path (default. random string)

  • description (String) (defaults to: nil)

    description of link page

  • need_acceptance (Boolean) (defaults to: nil)

    Approval necessity. Whether participation requires administrator approval.

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:



81
82
83
84
85
86
87
88
# File 'lib/chatwork/client/invitation_link_methods.rb', line 81

def update_invitation_link(room_id:, code: nil, description: nil, need_acceptance: nil, &block)
  params = {
    code:            code,
    description:     description,
    need_acceptance: boolean_to_integer(need_acceptance),
  }
  put("/rooms/#{room_id}/link", params, &block)
end