Class: Twilio::REST::Accounts::V1::CredentialList::PublicKeyContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ PublicKeyContext

Initialize the PublicKeyContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Twilio-provided string that uniquely identifies the PublicKey resource to update.



169
170
171
172
173
174
175
176
177
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 169

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Credentials/PublicKeys/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the PublicKeyInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



181
182
183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 181

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchPublicKeyInstance

Fetch the PublicKeyInstance

Returns:



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 193

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    PublicKeyInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



245
246
247
248
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 245

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Accounts.V1.PublicKeyContext #{context}>"
end

#to_sObject

Provide a user friendly representation



238
239
240
241
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 238

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Accounts.V1.PublicKeyContext #{context}>"
end

#update(friendly_name: :unset) ⇒ PublicKeyInstance

Update the PublicKeyInstance

Parameters:

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

Returns:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 213

def update(
    friendly_name: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    PublicKeyInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end