Class: Vonage::Conversation::Member

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/conversation/member.rb

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#create(conversation_id:, **params) ⇒ Response

Create a member.

Examples:

response = client.conversation.member.create(
  conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a',
  user: {
    id: 'USR-82e028d9-5201-4f1e-8188-604b2d3471ec'
  }
)

Parameters:

  • :conversation_id (required, String)

    The conversation_id of the conversation for which to create the member

  • :state (String)

    Must be one of [‘invited’, ‘joined’]

  • :user (Hash)

    (Either :id or :name is required)

    • @option user [String] :id The user_id of the user to add to the conversation

    • @option user [String] :name The name of the user to add to the conversation

  • :channel (Hash)
    • @option channel [required, String] :type The type of channel

    • @option channel [Hash] :from

      • @option from [String] :type

      • @option from [String] :number

      • @option from [String] :id

    • @option channel [Hash] :to

      • @option from [String] :type

      • @option from [String] :user

      • @option from [String] :number

      • @option from [String] :id

  • :media (Hash)
    • @option media [Boolean] :audio

    • @option media [Hash] :audio_settings

      • @option audio_settings [Boolean] :enabled

      • @option audio_settings [Boolean] :earmuffed

      • @option audio_settings [Boolean] :muted

  • :knocking_id (String)
  • :member_id_inviting (String)
  • :from (String)

Returns:

See Also:



81
82
83
# File 'lib/vonage/conversation/member.rb', line 81

def create(conversation_id:, **params)
  request("/v1/conversations/#{conversation_id}/members", params: params, type: Post)
end

#find(conversation_id:, member_id:) ⇒ Response

Retrieve a member

Examples:

response = client.conversation.member.find(
  conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a',
  member_id: 'MEM-63f61863-4a51-4f6b-86e1-46edebio0391'
)  

Parameters:

  • :conversation_id (required, String)
  • :member_id (required, String)

Returns:

See Also:



101
102
103
# File 'lib/vonage/conversation/member.rb', line 101

def find(conversation_id:, member_id:)   
  request("/v1/conversations/#{conversation_id}/members/#{member_id}", response_class: Vonage::Response)
end

#list(conversation_id:, **params) ⇒ Conversation::Member::ListResponse

List members of a conversation

Examples:

response = client.conversation.member.list(conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a')

Parameters:

  • :conversation_id (required, String)

    The conversation_id of the conversation to list members for

  • :page_size (Integer)

    Return this amount of records in the response.

  • :order ('asc', 'desc')

    Return the records in ascending or descending order.

  • :cursor (String)

    The cursor to start returning results from.

Returns:

See Also:



30
31
32
# File 'lib/vonage/conversation/member.rb', line 30

def list(conversation_id:, **params)
  request("/v1/conversations/#{conversation_id}/members", params: params, response_class: ListResponse)
end

#update(conversation_id:, member_id:, **params) ⇒ Response

Update a member

Examples:

response = client.conversation.member.update(
  conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a',
  member_id: 'MEM-63f61863-4a51-4f6b-86e1-46edebio0391',
  state: 'left'
)  

Parameters:

  • :conversation_id (required, String)
  • :member_id (required, String)
  • :state (String)

    Must be one of [‘joined’, ‘left’]

  • :from (String)
  • :reason (Hash)
    • @option reason [String] :code

    • @option reason [String] :text

Returns:

See Also:



130
131
132
# File 'lib/vonage/conversation/member.rb', line 130

def update(conversation_id:, member_id:, **params)
  request("/v1/conversations/#{conversation_id}/members/#{member_id}", params: params, type: Patch)
end