Class: Twilio::REST::Preview::TrustedComms::CpsInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/trusted_comms/cps.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, payload) ⇒ CpsInstance

Initialize the CpsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio


116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 116

def initialize(version, payload)
  super(version)

  # Marshaled Properties
  @properties = {
      'cps_url' => payload['cps_url'],
      'phone_number' => payload['phone_number'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {}
end

Instance Method Details

#contextCpsContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:

  • (CpsContext)

    CpsContext for this CpsInstance


135
136
137
138
139
140
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 135

def context
  unless @instance_context
    @instance_context = CpsContext.new(@version, )
  end
  @instance_context
end

#cps_urlString

Returns CPS URL of the phone number.

Returns:

  • (String)

    CPS URL of the phone number.


144
145
146
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 144

def cps_url
  @properties['cps_url']
end

#fetch(x_xcnam_sensitive_phone_number: :unset) ⇒ CpsInstance

Fetch the CpsInstance

Parameters:

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

    Phone number used to retrieve its corresponding CPS.

Returns:


165
166
167
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 165

def fetch(x_xcnam_sensitive_phone_number: :unset)
  context.fetch(x_xcnam_sensitive_phone_number: x_xcnam_sensitive_phone_number, )
end

#inspectObject

Provide a detailed, user friendly representation


178
179
180
181
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 178

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.TrustedComms.CpsInstance #{values}>"
end

#phone_numberString

Returns Phone number passed.

Returns:

  • (String)

    Phone number passed.


150
151
152
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 150

def phone_number
  @properties['phone_number']
end

#to_sObject

Provide a user friendly representation


171
172
173
174
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 171

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.TrustedComms.CpsInstance #{values}>"
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


156
157
158
# File 'lib/twilio-ruby/rest/preview/trusted_comms/cps.rb', line 156

def url
  @properties['url']
end