Class: Twilio::REST::Messaging::V1::TollfreeVerificationList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ TollfreeVerificationList

Initialize the TollfreeVerificationList

Parameters:

  • version (Version)

    Version that contains the resource



25
26
27
28
29
30
31
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 25

def initialize(version)
    super(version)
    # Path Solution
    @solution = {  }
    @uri = "/Tollfree/Verifications"
    
end

Instance Method Details

#create(business_name: nil, business_website: nil, notification_email: nil, use_case_categories: nil, use_case_summary: nil, production_message_sample: nil, opt_in_image_urls: nil, opt_in_type: nil, message_volume: nil, tollfree_phone_number_sid: nil, customer_profile_sid: :unset, business_street_address: :unset, business_street_address2: :unset, business_city: :unset, business_state_province_region: :unset, business_postal_code: :unset, business_country: :unset, additional_information: :unset, business_contact_first_name: :unset, business_contact_last_name: :unset, business_contact_email: :unset, business_contact_phone: :unset, external_reference_id: :unset) ⇒ TollfreeVerificationInstance

Create the TollfreeVerificationInstance

Parameters:

  • business_name (String) (defaults to: nil)

    The name of the business or organization using the Tollfree number.

  • business_website (String) (defaults to: nil)

    The website of the business or organization using the Tollfree number.

  • notification_email (String) (defaults to: nil)

    The email address to receive the notification about the verification result. .

  • use_case_categories (Array[String]) (defaults to: nil)

    The category of the use case for the Tollfree Number. List as many are applicable..

  • use_case_summary (String) (defaults to: nil)

    Use this to further explain how messaging is used by the business or organization.

  • production_message_sample (String) (defaults to: nil)

    An example of message content, i.e. a sample message.

  • opt_in_image_urls (Array[String]) (defaults to: nil)

    Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL.

  • opt_in_type (OptInType) (defaults to: nil)
  • message_volume (String) (defaults to: nil)

    Estimate monthly volume of messages from the Tollfree Number.

  • tollfree_phone_number_sid (String) (defaults to: nil)

    The SID of the Phone Number associated with the Tollfree Verification.

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

    Customer’s Profile Bundle BundleSid.

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

    The address of the business or organization using the Tollfree number.

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

    The address of the business or organization using the Tollfree number.

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

    The city of the business or organization using the Tollfree number.

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

    The state/province/region of the business or organization using the Tollfree number.

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

    The postal code of the business or organization using the Tollfree number.

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

    The country of the business or organization using the Tollfree number.

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

    Additional information to be provided for verification.

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

    The first name of the contact for the business or organization using the Tollfree number.

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

    The last name of the contact for the business or organization using the Tollfree number.

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

    The email address of the contact for the business or organization using the Tollfree number.

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

    The phone number of the contact for the business or organization using the Tollfree number.

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

    An optional external reference ID supplied by customer and echoed back on status retrieval.

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 58

def create(
    business_name: nil, 
    business_website: nil, 
    notification_email: nil, 
    use_case_categories: nil, 
    use_case_summary: nil, 
    production_message_sample: nil, 
    opt_in_image_urls: nil, 
    opt_in_type: nil, 
    message_volume: nil, 
    tollfree_phone_number_sid: nil, 
    customer_profile_sid: :unset, 
    business_street_address: :unset, 
    business_street_address2: :unset, 
    business_city: :unset, 
    business_state_province_region: :unset, 
    business_postal_code: :unset, 
    business_country: :unset, 
    additional_information: :unset, 
    business_contact_first_name: :unset, 
    business_contact_last_name: :unset, 
    business_contact_email: :unset, 
    business_contact_phone: :unset, 
    external_reference_id: :unset
)

    data = Twilio::Values.of({
        'BusinessName' => business_name,
        'BusinessWebsite' => business_website,
        'NotificationEmail' => notification_email,
        'UseCaseCategories' => Twilio.serialize_list(use_case_categories) { |e| e },
        'UseCaseSummary' => use_case_summary,
        'ProductionMessageSample' => production_message_sample,
        'OptInImageUrls' => Twilio.serialize_list(opt_in_image_urls) { |e| e },
        'OptInType' => opt_in_type,
        'MessageVolume' => message_volume,
        'TollfreePhoneNumberSid' => tollfree_phone_number_sid,
        'CustomerProfileSid' => customer_profile_sid,
        'BusinessStreetAddress' => business_street_address,
        'BusinessStreetAddress2' => business_street_address2,
        'BusinessCity' => business_city,
        'BusinessStateProvinceRegion' => business_state_province_region,
        'BusinessPostalCode' => business_postal_code,
        'BusinessCountry' => business_country,
        'AdditionalInformation' => additional_information,
        'BusinessContactFirstName' => business_contact_first_name,
        'BusinessContactLastName' => business_contact_last_name,
        'BusinessContactEmail' => business_contact_email,
        'BusinessContactPhone' => business_contact_phone,
        'ExternalReferenceId' => external_reference_id,
    })

    payload = @version.create('POST', @uri, data: data)
    TollfreeVerificationInstance.new(
        @version,
        payload,
    )
end

#eachObject

When passed a block, yields TollfreeVerificationInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.



168
169
170
171
172
173
174
175
176
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 168

def each
    limits = @version.read_limits

    page = self.page(page_size: limits[:page_size], )

    @version.stream(page,
        limit: limits[:limit],
        page_limit: limits[:page_limit]).each {|x| yield x}
end

#get_page(target_url) ⇒ Page

Retrieve a single page of TollfreeVerificationInstance records from the API. Request is executed immediately.

Parameters:

  • target_url (String)

    API-generated URL for the requested results page

Returns:

  • (Page)

    Page of TollfreeVerificationInstance



206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 206

def get_page(target_url)
    response = @version.domain.request(
        'GET',
        target_url
    )
TollfreeVerificationPage.new(@version, response, @solution)
end

#list(tollfree_phone_number_sid: :unset, status: :unset, limit: nil, page_size: nil) ⇒ Array

Lists TollfreeVerificationInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.

Parameters:

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

    The SID of the Phone Number associated with the Tollfree Verification.

  • status (Status) (defaults to: :unset)

    The compliance status of the Tollfree Verification record.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Array)

    Array of up to limit results



131
132
133
134
135
136
137
138
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 131

def list(tollfree_phone_number_sid: :unset, status: :unset, limit: nil, page_size: nil)
    self.stream(
        tollfree_phone_number_sid: tollfree_phone_number_sid,
        status: status,
        limit: limit,
        page_size: page_size
    ).entries
end

#page(tollfree_phone_number_sid: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page

Retrieve a single page of TollfreeVerificationInstance records from the API. Request is executed immediately.

Parameters:

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

    The SID of the Phone Number associated with the Tollfree Verification.

  • status (Status) (defaults to: :unset)

    The compliance status of the Tollfree Verification record.

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

    PageToken provided by the API

  • page_number (Integer) (defaults to: :unset)

    Page Number, this value is simply for client state

  • page_size (Integer) (defaults to: :unset)

    Number of records to return, defaults to 50

Returns:

  • (Page)

    Page of TollfreeVerificationInstance



187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 187

def page(tollfree_phone_number_sid: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
    params = Twilio::Values.of({
        'TollfreePhoneNumberSid' => tollfree_phone_number_sid,
        'Status' => status,
        'PageToken' => page_token,
        'Page' => page_number,
        'PageSize' => page_size,
    })

    response = @version.page('GET', @uri, params: params)

    TollfreeVerificationPage.new(@version, response, @solution)
end

#stream(tollfree_phone_number_sid: :unset, status: :unset, limit: nil, page_size: nil) ⇒ Enumerable

Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.

Parameters:

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

    The SID of the Phone Number associated with the Tollfree Verification.

  • status (Status) (defaults to: :unset)

    The compliance status of the Tollfree Verification record.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Enumerable)

    Enumerable that will yield up to limit results



153
154
155
156
157
158
159
160
161
162
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 153

def stream(tollfree_phone_number_sid: :unset, status: :unset, limit: nil, page_size: nil)
    limits = @version.read_limits(limit, page_size)

    page = self.page(
        tollfree_phone_number_sid: tollfree_phone_number_sid,
        status: status,
        page_size: limits[:page_size], )

    @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end

#to_sObject

Provide a user friendly representation



217
218
219
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 217

def to_s
    '#<Twilio.Messaging.V1.TollfreeVerificationList>'
end