Class: Twilio::REST::Api::V2010::AccountContext::ValidationRequestList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/validation_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil) ⇒ ValidationRequestList

Initialize the ValidationRequestList

Parameters:

  • version (Version)

    Version that contains the resource



28
29
30
31
32
33
34
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 28

def initialize(version, account_sid: nil)
    super(version)
    # Path Solution
    @solution = { account_sid:  }
    @uri = "/Accounts/#{@solution[:account_sid]}/OutgoingCallerIds.json"
    
end

Instance Method Details

#create(phone_number: nil, friendly_name: :unset, call_delay: :unset, extension: :unset, status_callback: :unset, status_callback_method: :unset) ⇒ ValidationRequestInstance

Create the ValidationRequestInstance

Parameters:

  • phone_number (String) (defaults to: nil)

    The phone number to verify in [E.164](www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the new caller ID resource. It can be up to 64 characters long. The default value is a formatted version of the phone number.

  • call_delay (String) (defaults to: :unset)

    The number of seconds to delay before initiating the verification call. Can be an integer between ‘0` and `60`, inclusive. The default is `0`.

  • extension (String) (defaults to: :unset)

    The digits to dial after connecting the verification call.

  • status_callback (String) (defaults to: :unset)

    The URL we should call using the ‘status_callback_method` to send status information about the verification process to your application.

  • status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘status_callback`. Can be: `GET` or `POST`, and the default is `POST`.

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 44

def create(
    phone_number: nil, 
    friendly_name: :unset, 
    call_delay: :unset, 
    extension: :unset, 
    status_callback: :unset, 
    status_callback_method: :unset
)

    data = Twilio::Values.of({
        'PhoneNumber' => phone_number,
        'FriendlyName' => friendly_name,
        'CallDelay' => call_delay,
        'Extension' => extension,
        'StatusCallback' => status_callback,
        'StatusCallbackMethod' => status_callback_method,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    ValidationRequestInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
    )
end

#to_sObject

Provide a user friendly representation



80
81
82
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 80

def to_s
    '#<Twilio.Api.V2010.ValidationRequestList>'
end