Class: Twilio::REST::Preview::TrustedComms::DeviceList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/trusted_comms/device.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ DeviceList

Initialize the DeviceList

Parameters:

  • version (Version)

    Version that contains the resource



20
21
22
23
24
25
26
# File 'lib/twilio-ruby/rest/preview/trusted_comms/device.rb', line 20

def initialize(version)
  super(version)

  # Path Solution
  @solution = {}
  @uri = "/Devices"
end

Instance Method Details

#create(phone_number: nil, push_token: nil) ⇒ DeviceInstance

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

Parameters:

  • phone_number (String) (defaults to: nil)

    The end user Phone Number linked to the device, given in E.164 format (en.wikipedia.org/wiki/E.164). The SDK or partner app is responsible of verifying this phone number veracity.

  • push_token (String) (defaults to: nil)

    The Push Token for this Phone Number, linked to the correct SDK’s application, certificate and keys.

Returns:



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/twilio-ruby/rest/preview/trusted_comms/device.rb', line 37

def create(phone_number: nil, push_token: nil)
  data = Twilio::Values.of({'PhoneNumber' => phone_number, 'PushToken' => push_token, })

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

  DeviceInstance.new(@version, payload, )
end

#to_sObject

Provide a user friendly representation



51
52
53
# File 'lib/twilio-ruby/rest/preview/trusted_comms/device.rb', line 51

def to_s
  '#<Twilio.Preview.TrustedComms.DeviceList>'
end