class Twilio::REST::Api::V2010::AccountContext::KeyInstance
Public Class Methods
Initialize the KeyInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] account_sid A 34 character string that uniquely identifies this
resource.
@param [String] sid The Twilio-provided string that uniquely identifies the Key
resource to fetch.
@return [KeyInstance] KeyInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 217 def initialize(version, payload, account_sid: nil, sid: nil) 218 super(version) 219 220 # Marshaled Properties 221 @properties = { 222 'sid' => payload['sid'], 223 'friendly_name' => payload['friendly_name'], 224 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 225 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 226 } 227 228 # Context 229 @instance_context = nil 230 @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } 231 end
Public Instance Methods
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [KeyContext] KeyContext
for this KeyInstance
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 237 def context 238 unless @instance_context 239 @instance_context = KeyContext.new(@version, @params['account_sid'], @params['sid'], ) 240 end 241 @instance_context 242 end
@return [Time] The RFC 2822 date and time in GMT that the resource was created
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 258 def date_created 259 @properties['date_created'] 260 end
@return [Time] The RFC 2822 date and time in GMT that the resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 264 def date_updated 265 @properties['date_updated'] 266 end
Delete the KeyInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 287 def delete 288 context.delete 289 end
Fetch the KeyInstance
@return [KeyInstance] Fetched KeyInstance
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 271 def fetch 272 context.fetch 273 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 252 def friendly_name 253 @properties['friendly_name'] 254 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 300 def inspect 301 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 302 "<Twilio.Api.V2010.KeyInstance #{values}>" 303 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 246 def sid 247 @properties['sid'] 248 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 293 def to_s 294 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 295 "<Twilio.Api.V2010.KeyInstance #{values}>" 296 end
Update the KeyInstance
@param [String] friendly_name
A descriptive string that you create to describe
the resource. It can be up to 64 characters long.
@return [KeyInstance] Updated KeyInstance
# File lib/twilio-ruby/rest/api/v2010/account/key.rb 280 def update(friendly_name: :unset) 281 context.update(friendly_name: friendly_name, ) 282 end