Class: Twilio::REST::Accounts::V1::BulkContactsList

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

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ BulkContactsList

Initialize the BulkContactsList

Parameters:

  • version (Version)

    Version that contains the resource



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

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

Instance Method Details

#create(items: nil) ⇒ BulkContactsInstance

Create the BulkContactsInstance

Parameters:

  • items (Array[Hash]) (defaults to: nil)

    A list of objects where each object represents a contact’s details. Each object includes the following fields: contact_id, which must be a string representing phone number in [E.164 format](www.twilio.com/docs/glossary/what-e164); correlation_id, a unique 32-character UUID that maps the response to the original request; country_iso_code, a string representing the country using the ISO format (e.g., US for the United States); and zip_code, a string representing the postal code.

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb', line 38

def create(
    items: nil
)

    data = Twilio::Values.of({
        'Items' => Twilio.serialize_list(items) { |e| Twilio.serialize_object(e) },
    })

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

#create_with_metadata(items: nil) ⇒ BulkContactsInstance

Create the BulkContactsInstanceMetadata

Parameters:

  • items (Array[Hash]) (defaults to: nil)

    A list of objects where each object represents a contact’s details. Each object includes the following fields: contact_id, which must be a string representing phone number in [E.164 format](www.twilio.com/docs/glossary/what-e164); correlation_id, a unique 32-character UUID that maps the response to the original request; country_iso_code, a string representing the country using the ISO format (e.g., US for the United States); and zip_code, a string representing the postal code.

Returns:



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
# File 'lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb', line 63

def (
  items: nil
)

    data = Twilio::Values.of({
        'Items' => Twilio.serialize_list(items) { |e| Twilio.serialize_object(e) },
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    bulk_contacts_instance = BulkContactsInstance.new(
        @version,
        response.body,
    )
    .new(
        @version,
        bulk_contacts_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



94
95
96
# File 'lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb', line 94

def to_s
    '#<Twilio.Accounts.V1.BulkContactsList>'
end