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



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

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, business_registration_number: :unset, business_registration_authority: :unset, business_registration_country: :unset, business_type: :unset, business_registration_phone_number: :unset, doing_business_as: :unset, opt_in_confirmation_message: :unset, help_message_sample: :unset, privacy_policy_url: :unset, terms_and_conditions_url: :unset, age_gated_content: :unset, opt_in_keywords: :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 E.164 formatted 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.

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

    A legally recognized business registration number

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

    The organizational authority for business registrations

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

    Country business is registered in

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

    The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT

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

    The E.164 formatted number associated with the business.

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

    Trade name, sub entity, or downstream business name of business being submitted for verification

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

    The confirmation message sent to users when they opt in to receive messages.

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

    A sample help message provided to users.

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

    The URL to the privacy policy for the business or organization.

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

    The URL to the terms and conditions for the business or organization.

  • age_gated_content (Boolean) (defaults to: :unset)

    Indicates if the content is age gated.

  • opt_in_keywords (Array[String]) (defaults to: :unset)

    List of keywords that users can text in to opt in to receive messages.

Returns:



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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 71

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, 
    business_registration_number: :unset, 
    business_registration_authority: :unset, 
    business_registration_country: :unset, 
    business_type: :unset, 
    business_registration_phone_number: :unset, 
    doing_business_as: :unset, 
    opt_in_confirmation_message: :unset, 
    help_message_sample: :unset, 
    privacy_policy_url: :unset, 
    terms_and_conditions_url: :unset, 
    age_gated_content: :unset, 
    opt_in_keywords: :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,
        'BusinessRegistrationNumber' => business_registration_number,
        'BusinessRegistrationAuthority' => business_registration_authority,
        'BusinessRegistrationCountry' => business_registration_country,
        'BusinessType' => business_type,
        'BusinessRegistrationPhoneNumber' => business_registration_phone_number,
        'DoingBusinessAs' => doing_business_as,
        'OptInConfirmationMessage' => opt_in_confirmation_message,
        'HelpMessageSample' => help_message_sample,
        'PrivacyPolicyUrl' => privacy_policy_url,
        'TermsAndConditionsUrl' => terms_and_conditions_url,
        'AgeGatedContent' => age_gated_content,
        'OptInKeywords' => Twilio.serialize_list(opt_in_keywords) { |e| e },
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    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.



223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 223

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



271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 271

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, external_reference_id: :unset, include_sub_accounts: :unset, trust_product_sid: :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.

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

    Customer supplied reference id for the Tollfree Verification record.

  • include_sub_accounts (Boolean) (defaults to: :unset)

    Whether to include Tollfree Verifications from sub accounts in list response.

  • trust_product_sid (Array[String]) (defaults to: :unset)

    The trust product sids / tollfree bundle sids of tollfree verifications

  • 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



177
178
179
180
181
182
183
184
185
186
187
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 177

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

#page(tollfree_phone_number_sid: :unset, status: :unset, external_reference_id: :unset, include_sub_accounts: :unset, trust_product_sid: :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.

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

    Customer supplied reference id for the Tollfree Verification record.

  • include_sub_accounts (Boolean) (defaults to: :unset)

    Whether to include Tollfree Verifications from sub accounts in list response.

  • trust_product_sid (Array[String]) (defaults to: :unset)

    The trust product sids / tollfree bundle sids of tollfree verifications

  • 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



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 245

def page(tollfree_phone_number_sid: :unset, status: :unset, external_reference_id: :unset, include_sub_accounts: :unset, trust_product_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
    params = Twilio::Values.of({
        'TollfreePhoneNumberSid' => tollfree_phone_number_sid,
        'Status' => status,
        'ExternalReferenceId' => external_reference_id,
        'IncludeSubAccounts' => include_sub_accounts,
        
        'TrustProductSid' =>  Twilio.serialize_list(trust_product_sid) { |e| e },
        'PageToken' => page_token,
        'Page' => page_number,
        'PageSize' => page_size,
    })
    headers = Twilio::Values.of({})
    
    

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

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

#stream(tollfree_phone_number_sid: :unset, status: :unset, external_reference_id: :unset, include_sub_accounts: :unset, trust_product_sid: :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.

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

    Customer supplied reference id for the Tollfree Verification record.

  • include_sub_accounts (Boolean) (defaults to: :unset)

    Whether to include Tollfree Verifications from sub accounts in list response.

  • trust_product_sid (Array[String]) (defaults to: :unset)

    The trust product sids / tollfree bundle sids of tollfree verifications

  • 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



205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 205

def stream(tollfree_phone_number_sid: :unset, status: :unset, external_reference_id: :unset, include_sub_accounts: :unset, trust_product_sid: :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,
        external_reference_id: external_reference_id,
        include_sub_accounts: include_sub_accounts,
        trust_product_sid: trust_product_sid,
        page_size: limits[:page_size], )

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

#to_sObject

Provide a user friendly representation



282
283
284
# File 'lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb', line 282

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