Class: Vonage::Conversation

Inherits:
Namespace
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/vonage/conversation.rb

Defined Under Namespace

Classes: Event, ListResponse, Member, User

Instance Method Summary collapse

Instance Method Details

#create(**params) ⇒ Response

Create a conversation.

Examples:

response = client.conversation.create(name: 'Example Conversation', display_name: 'Example Display Name')

Parameters:

  • :name (String)

    Your internal conversation name. Must be unique.

  • :display_name (String)

    The public facing name of the conversation.

  • :image_url (String)

    An image URL that you associate with the conversation

  • :properties (Hash)
    • :ttl (Integer) After how many seconds an empty conversation is deleted

    • :type (String)

    • :custom_sort_key (String)

    • :custom_data (Hash) Custom key/value pairs to be included with conversation data

  • params (Hash)

    a customizable set of options

Options Hash (**params):

  • :numbers (Array)

    An array of Hashes containing number information for different channels.

  • :callback (Hash)
    • @option callback :url (String)

    • @option callback :event_mask (String)

    • @option callback :params (Hash)

      • @option params :applicationId (String)

      • @option params :ncco_url (String)

    • @option callback :method (String) Must be one of [‘POST’, ‘GET’]

Returns:

See Also:



74
75
76
# File 'lib/vonage/conversation.rb', line 74

def create(**params)
  request('/v1/conversations', params: params, type: Post)
end

#delete(conversation_id:) ⇒ Response

Delete a conversation.

Examples:

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

Parameters:

  • :conversation_id (String)

Returns:

See Also:



142
143
144
# File 'lib/vonage/conversation.rb', line 142

def delete(conversation_id:)
  request("/v1/conversations/#{conversation_id}", type: Delete)
end

#eventObject



160
161
162
# File 'lib/vonage/conversation.rb', line 160

def event
  @event ||= Event.new(@config)
end

#find(conversation_id:) ⇒ Response

Retrieve a conversation.

Examples:

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

Parameters:

  • :conversation_id (String)

Returns:

See Also:



89
90
91
# File 'lib/vonage/conversation.rb', line 89

def find(conversation_id:)
  request("/v1/conversations/#{conversation_id}")
end

#list(**params) ⇒ Conversation::ListResponse

List conversations associated with a Vonage application.

Examples:

response = client.conversation.list

Parameters:

  • :date_start (String)

    Return the records that occurred after this point in time.

  • :date_end (String)

    Return the records that occurred before this point in time.

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



36
37
38
# File 'lib/vonage/conversation.rb', line 36

def list(**params)
  request('/v1/conversations', params: params, response_class: ListResponse)
end

#memberObject



154
155
156
# File 'lib/vonage/conversation.rb', line 154

def member
  @member ||= Member.new(@config)
end

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

Update a conversation.

Examples:

response = client.conversation.update(conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a', display_name: 'Updated conversation')

Parameters:

  • :name (String)

    Your internal conversation name. Must be unique.

  • :display_name (String)

    The public facing name of the conversation.

  • :image_url (String)

    An image URL that you associate with the conversation

  • :properties (Hash)
    • @option properties :ttl (Integer) After how many seconds an empty conversation is deleted

    • @option properties :type (String)

    • @option properties :custom_sort_key (String)

    • @option properties :custom_data (Hash) Custom key/value pairs to be included with conversation data

  • :numbers (Array)

    An array of Hashes containing number information for different channels.

  • params (Hash)

    a customizable set of options

Options Hash (**params):

  • :callback (Hash)
    • @option callback :url (String)

    • @option callback :event_mask (String)

    • @option callback :params (Hash)

      • @option params :applicationId (String)

      • @option params :ncco_url (String)

    • @option callback :method (String) Must be one of [‘POST’, ‘GET’]

Returns:

See Also:



127
128
129
# File 'lib/vonage/conversation.rb', line 127

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

#userObject



148
149
150
# File 'lib/vonage/conversation.rb', line 148

def user
  @user ||= User.new(@config)
end