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 Credential Sid that uniquely identifies the Credential to fetch



189
190
191
192
193
194
195
196
197
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 189

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the PublicKeyInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  @version.delete('delete', @uri)
end

#fetchPublicKeyInstance

Fetch a PublicKeyInstance

Returns:



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 202

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  PublicKeyInstance.new(
      @version,
      payload,
      sid: @solution[:sid],
  )
end

#to_sObject

Provide a user friendly representation



250
251
252
253
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 250

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 human readable description of this resource, up to 64 characters.

Returns:



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 223

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

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

  PublicKeyInstance.new(
      @version,
      payload,
      sid: @solution[:sid],
  )
end