Class: Vonage::Conversation::Event

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

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

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

Create an event

Examples:

response = client.conversation.event.create(
  conversation_id: 'CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a',
  type: 'message',
  body: {
    message_type: 'text',
    text: 'Hello World'
  }
)  

Parameters:

  • :conversation_id (required, String)

    The conversation_id of the conversation to create the event for

  • :type (required, String)

    Event type.

  • :from (String)
  • :body (Hash)

    The body of the event. There are many possible properties depending on the event type and message_type

  • params (Hash)

    a customizable set of options

Options Hash (**params):

  • :from (required, String)

Returns:

See Also:



70
71
72
# File 'lib/vonage/conversation/event.rb', line 70

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

#delete(conversation_id:, event_id:) ⇒ Response

Delete an event.

Examples:

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

Parameters:

  • :conversation_id (String)
  • :event_id (String)

Returns:

See Also:



104
105
106
# File 'lib/vonage/conversation/event.rb', line 104

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

#find(conversation_id:, event_id:) ⇒ Response

Get details of a specific event

Examples:

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

Parameters:

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

Returns:

See Also:



87
88
89
# File 'lib/vonage/conversation/event.rb', line 87

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

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

List conversation events

Examples:

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

Parameters:

  • :conversation_id (required, String)

    The conversation_id of the conversation to list events for

  • :start_id (String)

    The ID to start returning events at

  • :end_id (String)

    The ID to end returning events at

  • :event_type (String)

    The type of event to search for. Does not currently support custom events

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



39
40
41
# File 'lib/vonage/conversation/event.rb', line 39

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