Class: Telnyx::Resources::PhoneNumbers::Voicemail

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/phone_numbers/voicemail.rb

Overview

Voicemail API

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Voicemail

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Voicemail.

Parameters:



83
84
85
# File 'lib/telnyx/resources/phone_numbers/voicemail.rb', line 83

def initialize(client:)
  @client = client
end

Instance Method Details

#create(phone_number_id, enabled: nil, pin: nil, request_options: {}) ⇒ Telnyx::Models::PhoneNumbers::VoicemailCreateResponse

Create voicemail settings for a phone number

Parameters:

  • phone_number_id (String)

    The ID of the phone number.

  • enabled (Boolean)

    Whether voicemail is enabled.

  • pin (String)

    The pin used for voicemail

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/telnyx/resources/phone_numbers/voicemail.rb', line 23

def create(phone_number_id, params = {})
  parsed, options = Telnyx::PhoneNumbers::VoicemailCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["phone_numbers/%1$s/voicemail", phone_number_id],
    body: parsed,
    model: Telnyx::Models::PhoneNumbers::VoicemailCreateResponse,
    options: options
  )
end

#retrieve(phone_number_id, request_options: {}) ⇒ Telnyx::Models::PhoneNumbers::VoicemailRetrieveResponse

Returns the voicemail settings for a phone number

Parameters:

  • phone_number_id (String)

    The ID of the phone number.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



45
46
47
48
49
50
51
52
# File 'lib/telnyx/resources/phone_numbers/voicemail.rb', line 45

def retrieve(phone_number_id, params = {})
  @client.request(
    method: :get,
    path: ["phone_numbers/%1$s/voicemail", phone_number_id],
    model: Telnyx::Models::PhoneNumbers::VoicemailRetrieveResponse,
    options: params[:request_options]
  )
end

#update(phone_number_id, enabled: nil, pin: nil, request_options: {}) ⇒ Telnyx::Models::PhoneNumbers::VoicemailUpdateResponse

Update voicemail settings for a phone number

Parameters:

  • phone_number_id (String)

    The ID of the phone number.

  • enabled (Boolean)

    Whether voicemail is enabled.

  • pin (String)

    The pin used for voicemail

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
# File 'lib/telnyx/resources/phone_numbers/voicemail.rb', line 69

def update(phone_number_id, params = {})
  parsed, options = Telnyx::PhoneNumbers::VoicemailUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["phone_numbers/%1$s/voicemail", phone_number_id],
    body: parsed,
    model: Telnyx::Models::PhoneNumbers::VoicemailUpdateResponse,
    options: options
  )
end