Class: Twilio::REST::Accounts::V1::BulkConsentsList

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

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ BulkConsentsList

Initialize the BulkConsentsList

Parameters:

  • version (Version)

    Version that contains the resource



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

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

Instance Method Details

#create(items: nil) ⇒ BulkConsentsInstance

Create the BulkConsentsInstance

Parameters:

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

    This is a list of objects that describes a contact’s opt-in status. Each object contains 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 used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].

Returns:



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

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)
    BulkConsentsInstance.new(
        @version,
        payload,
    )
end

#to_sObject

Provide a user friendly representation



62
63
64
# File 'lib/twilio-ruby/rest/accounts/v1/bulk_consents.rb', line 62

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