Class: Plivo::Resources::Endpoint

Inherits:
Base::Resource show all
Defined in:
lib/plivo/resources/endpoints.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

Instance Attribute Summary collapse

Attributes inherited from Base::Resource

#id

Instance Method Summary collapse

Methods included from Utils

expected_type?, expected_value?, raise_invalid_request, valid_account?, valid_mainaccount?, valid_param?, valid_signature?, valid_subaccount?

Constructor Details

#initialize(client, options = nil) ⇒ Endpoint

Returns a new instance of Endpoint.



5
6
7
8
9
# File 'lib/plivo/resources/endpoints.rb', line 5

def initialize(client, options = nil)
  @_name = 'Endpoint'
  @_identifier_string = 'endpoint_id'
  super
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



35
36
37
# File 'lib/plivo/resources/endpoints.rb', line 35

def password
  @password
end

#sip_expiresObject (readonly)

Returns the value of attribute sip_expires.



37
38
39
# File 'lib/plivo/resources/endpoints.rb', line 37

def sip_expires
  @sip_expires
end

Instance Method Details

#deleteObject



31
32
33
# File 'lib/plivo/resources/endpoints.rb', line 31

def delete
  perform_delete
end

#sip_contactObject



39
40
41
# File 'lib/plivo/resources/endpoints.rb', line 39

def sip_contact
  @sip_expires
end

#sip_user_agentObject



43
44
45
# File 'lib/plivo/resources/endpoints.rb', line 43

def sip_user_agent
  @sip_expires
end

#to_sObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/plivo/resources/endpoints.rb', line 47

def to_s
  {
    alias: @alias,
    application: @application,
    endpoint_id: @endpoint_id,
    resource_uri: @resource_uri,
    sip_contact: @sip_contact,
    sip_expires: @sip_expires,
    sip_registered: @sip_registered,
    sip_uri: @sip_uri,
    sip_user_agent: @sip_user_agent,
    sub_account: @sub_account,
    username: @username,
    password: @password
  }.to_s
end

#update(options = nil) ⇒ Object

Parameters:

  • options (Hash) (defaults to: nil)

Options Hash (options):

  • :password (String)

    The password for your endpoint username.

  • :alias (String)

    Alias for this endpoint

  • :app_id (String)

    The app_id of the application that is to be attached to this endpoint. If app_id is not specified, then the endpoint does not point to any application.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/plivo/resources/endpoints.rb', line 15

def update(options = nil)
  return if options.nil?
  valid_param?(:options, options, Hash, true)

  params = {}
  params_expected = %i[password alias app_id]
  params_expected.each do |param|
    if options.key?(param) &&
       valid_param?(param, options[param], [String, Symbol], true)
      params[param] = options[param]
    end
  end

  perform_update(params)
end