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 that contains the resource



28
29
30
31
32
33
34
35
# 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:

  • (defaults to: nil)

    The phone number to verify in E.164 format, which consists of a + followed by the country code and subscriber number.

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

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

  • (defaults to: :unset)

    The digits to dial after connecting the verification call.

  • (defaults to: :unset)

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

  • (defaults to: :unset)

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

Returns:

  • Created ValidationRequestInstance



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
75
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 45

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

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

Create the ValidationRequestInstanceMetadata

Parameters:

  • (defaults to: nil)

    The phone number to verify in E.164 format, which consists of a + followed by the country code and subscriber number.

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

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

  • (defaults to: :unset)

    The digits to dial after connecting the verification call.

  • (defaults to: :unset)

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

  • (defaults to: :unset)

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

Returns:

  • Created ValidationRequestInstance



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 86

def (
  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', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    validation_request_instance = ValidationRequestInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
    )
    ValidationRequestInstanceMetadata.new(
        @version,
        validation_request_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



128
129
130
# File 'lib/twilio-ruby/rest/api/v2010/account/validation_request.rb', line 128

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