Class: Nexmo::Conversations

Inherits:
Namespace
  • Object
show all
Defined in:
lib/nexmo/conversations.rb

Defined Under Namespace

Classes: Events, Legs, Members, Users

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Response

Create a conversation.

Examples:

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

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :name (String)

    Unique name for a conversation.

  • :display_name (String)

    The display name for the conversation. It does not have to be unique.

  • :image_url (String)

    A link to an image for conversations' and users' avatars.

  • :numbers (Hash)
    • :sms (String) phone number used for sms channel

    • :pstn (String) phone number used for pstn channel

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

Returns:

See Also:


35
36
37
# File 'lib/nexmo/conversations.rb', line 35

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

#delete(id) ⇒ Response

Delete a conversation.

Examples:

response = client.conversations.delete(id)

Parameters:

  • id (String)

Returns:

See Also:


127
128
129
# File 'lib/nexmo/conversations.rb', line 127

def delete(id)
  request('/beta/conversations/' + id, type: Delete)
end

#eventsEvents

Returns:


164
165
166
# File 'lib/nexmo/conversations.rb', line 164

def events
  @events ||= Events.new(@config)
end

#get(id) ⇒ Response

Retrieve a conversation.

Examples:

response = client.conversations.get(id)

Parameters:

  • id (String)

Returns:

See Also:


80
81
82
# File 'lib/nexmo/conversations.rb', line 80

def get(id)
  request('/beta/conversations/' + id)
end

#legsLegs

Returns:


170
171
172
# File 'lib/nexmo/conversations.rb', line 170

def legs
  @legs ||= Legs.new(@config)
end

#list(params = nil) ⇒ Response

List all conversations associated with your application.

Examples:

response = client.conversations.list

Parameters:

  • params (Hash, nil) (defaults to: nil)

Options Hash (params):

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

  • :record_index (Integer)

    Return calls from this index in the response.

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

    Return the records in ascending or descending order.

Returns:

See Also:


65
66
67
# File 'lib/nexmo/conversations.rb', line 65

def list(params = nil)
  request('/beta/conversations', params: params)
end

#membersMembers

Returns:


176
177
178
# File 'lib/nexmo/conversations.rb', line 176

def members
  @members ||= Members.new(@config)
end

#record(id, params) ⇒ Response

Record a conversation.

Examples:

response = client.conversations.record(id, action: 'start')

Parameters:

  • id (String)
  • params (Hash)

Options Hash (params):

  • :action (String)

    Recording action. Must be one of `start` or `stop`.

  • :event_url (String)

    The webhook endpoint where recording progress events are sent to.

  • :event_method (String)

    The HTTP method used to send event information to :event_url.

  • :split (String)

    Record the sent and received audio in separate channels of a stereo recording.

  • :format (String)

    Record the conversation in a specific format.

Returns:

See Also:


158
159
160
# File 'lib/nexmo/conversations.rb', line 158

def record(id, params)
  request('/v1/conversations/' + id + '/record', params: params, type: Put)
end

#update(id, params) ⇒ Response

Update a conversation.

Examples:

response = client.conversations.update(id, display_name: 'Updated conversation')

Parameters:

  • id (String)
  • params (Hash)

Options Hash (params):

  • :name (String)

    Unique name for a conversation

  • :display_name (String)

    The display name for the conversation.

  • :image_url (String)

    A link to an image for conversations' and users' avatars.

  • :numbers (Hash)
    • :sms (String) phone number used for sms channel

    • :pstn (String) phone number used for pstn channel

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

Returns:

See Also:


112
113
114
# File 'lib/nexmo/conversations.rb', line 112

def update(id, params)
  request('/beta/conversations/' + id, params: params, type: Put)
end

#usersUsers

Returns:


182
183
184
# File 'lib/nexmo/conversations.rb', line 182

def users
  @users ||= Users.new(@config)
end