Class: Vonage::Users

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

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#create(**params) ⇒ Vonage::Response

Create a new User associated with the Vonage Application.

Parameters:

  • :name (optional, String)

    A unique name for the user. If not provided, a name will be auto-generated.

  • :display_name (optional, String)

    A string to be displayed as user name. It does not need to be unique.

  • :image_url (optional, String)

    A publicly accessible URL to an image file for an image to be associated with the user.

  • :properties (optional, Hash)

    A hash defining properties for the User. @option properties [Hash] :custom_data A hash of custom data as key/value pairs.

  • :channels (optional, Hash)

    A hash defining details of various channels. @option channels [Array] :pstn An array containing a Hash which defines data for the pstn channel.

    @option pstn [Integer] :number The pstn number.
    

    @option channels [Array] :sip An array containing a Hash which defines data for the sip channel.

    @option sip [String] :uri The sip uri.
    @option sip [String] :username The sip username.
    @option sip [String] :password The sip password.
    

    @option channels [Array] :vbc An array containing a Hash which defines data for the vbc channel.

    @option vbc [String] :extension The vbc extension.
    

    @option channels [Array] :websocket An array containing a Hash which defines data for the websocket channel.

    @option websocket [String] :uri The websocket uri.
    @option websocket [String] :content-type The websocket audio type. Must be one of: `audio/l16;rate=8000`, `audio/l16;rate=16000`.
    @option websocket [Hash] :headers A hash of custom websocket headers provided as key/value pairs.
    

    @option channels [Array] :sms An array containing a Hash which defines data for the sms channel.

    @option sms [Integer] :number The sms number.
    

    @option channels [Array] :mms An array containing a Hash which defines data for the mms channel.

    @option mms [Integer] :number The mms number.
    

    @option channels [Array] :whatsapp An array containing a Hash which defines data for the whatsapp channel.

    @option whatsapp [Integer] :number The whatsapp number.
    

    @option channels [Array] :viber An array containing a Hash which defines data for the sms channel.

    @option viber [Integer] :number The viber number.
    

    @option channels [Array] :messenger An array containing a Hash which defines data for the messenger channel.

    @option messenger [Integer] :id The messenger id.
    

Returns:

See Also:



90
91
92
# File 'lib/vonage/users.rb', line 90

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

#delete(id:) ⇒ Vonage::Response

Delete a specified User associated with the Vonage Application.

Parameters:

  • :id (required, String)

    The unique ID or name for the user.

Returns:

See Also:



152
153
154
# File 'lib/vonage/users.rb', line 152

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

#find(id:) ⇒ Vonage::Response

Get a specified User associated with the Vonage Application.

Parameters:

  • :id (required, String)

    The unique ID or name for the user.

Returns:

See Also:



44
45
46
# File 'lib/vonage/users.rb', line 44

def find(id:)
  request("/v1/users/#{id}")
end

#list(**params) ⇒ ListResponse

Get a list of Users associated with the Vonage Application.

Parameters:

  • :page_size (optional, Integer)

    Specifies the number of records to be returned in the response.

  • :order (optional, String)

    Specifies the order in which the records should be returned. Must be one of ‘asc`, `ASC`, `desc`, or `DESC`

  • :cursor (optional, String)

    Specficy a cursor point from which to start returning results, for example the values of the ‘next` or `prev` `_links` contained in a response.

  • :name (optional, String)

    Specify a user name with which to filter results

Returns:

See Also:



31
32
33
# File 'lib/vonage/users.rb', line 31

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

#update(id:, **params) ⇒ Vonage::Response

Update an existing User associated with the Vonage Application.

Parameters:

  • :id (required, String)

    The unique ID or name for the user to be updated.

  • :name (optional, String)

    A unique name for the user.

  • :display_name (optional, String)

    A string to be displayed as user name. It does not need to be unique.

  • :image_url (optional, String)

    A publicly accessible URL to an image file for an image to be associated with the user.

  • :properties (optional, Hash)

    A hash defining properties for the User. @option properties [Hash] :custom_data A hash of custom data as key/value pairs.

  • :channels (optional, Hash)

    A hash defining details of various channels. @option channels [Array] :pstn An array containing a Hash which defines data for the pstn channel.

    @option pstn [Integer] :number The pstn number.
    

    @option channels [Array] :sip An array containing a Hash which defines data for the sip channel.

    @option sip [String] :uri The sip uri.
    @option sip [String] :username The sip username.
    @option sip [String] :password The sip password.
    

    @option channels [Array] :vbc An array containing a Hash which defines data for the vbc channel.

    @option vbc [String] :extension The vbc extension.
    

    @option channels [Array] :websocket An array containing a Hash which defines data for the websocket channel.

    @option websocket [String] :uri The websocket uri.
    @option websocket [String] :content-type The websocket audio type. Must be one of: `audio/l16;rate=8000`, `audio/l16;rate=16000`.
    @option websocket [Hash] :headers A hash of custom websocket headers provided as key/value pairs.
    

    @option channels [Array] :sms An array containing a Hash which defines data for the sms channel.

    @option sms [Integer] :number The sms number.
    

    @option channels [Array] :mms An array containing a Hash which defines data for the mms channel.

    @option mms [Integer] :number The mms number.
    

    @option channels [Array] :whatsapp An array containing a Hash which defines data for the whatsapp channel.

    @option whatsapp [Integer] :number The whatsapp number.
    

    @option channels [Array] :viber An array containing a Hash which defines data for the sms channel.

    @option viber [Integer] :number The viber number.
    

    @option channels [Array] :messenger An array containing a Hash which defines data for the messenger channel.

    @option messenger [Integer] :id The messenger id.
    

Returns:

See Also:



139
140
141
# File 'lib/vonage/users.rb', line 139

def update(id:, **params)
  request("/v1/users/#{id}", params: params, type: Patch)
end