Class: Twilio::REST::Api::V2010::AccountContext::QueueContext::MemberInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/queue/member.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, queue_sid: nil, call_sid: nil) ⇒ MemberInstance

Initialize the MemberInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Member resource.

  • sid (String)

    The SID of the Call resource to fetch.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 256

def initialize(version, payload , account_sid: nil, queue_sid: nil, call_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'call_sid' => payload['call_sid'],
        'date_enqueued' => Twilio.deserialize_rfc2822(payload['date_enqueued']),
        'position' => payload['position'] == nil ? payload['position'] : payload['position'].to_i,
        'uri' => payload['uri'],
        'wait_time' => payload['wait_time'] == nil ? payload['wait_time'] : payload['wait_time'].to_i,
        'queue_sid' => payload['queue_sid'],
    }

    # Context
    @instance_context = nil
    @params = { 'account_sid' =>   ,'queue_sid' => queue_sid  || @properties['queue_sid']  ,'call_sid' => call_sid  || @properties['call_sid']  , }
end

Instance Method Details

#call_sidString

Returns The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with.

Returns:



287
288
289
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 287

def call_sid
    @properties['call_sid']
end

#contextMemberContext

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

Returns:



278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 278

def context
    unless @instance_context
        @instance_context = MemberContext.new(@version , @params['account_sid'], @params['queue_sid'], @params['call_sid'])
    end
    @instance_context
end

#date_enqueuedTime

Returns The date that the member was enqueued, given in RFC 2822 format.

Returns:

  • (Time)

    The date that the member was enqueued, given in RFC 2822 format.



293
294
295
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 293

def date_enqueued
    @properties['date_enqueued']
end

#fetchMemberInstance

Fetch the MemberInstance

Returns:



324
325
326
327
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 324

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



354
355
356
357
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 354

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

#positionString

Returns This member’s current position in the queue.

Returns:

  • (String)

    This member’s current position in the queue.



299
300
301
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 299

def position
    @properties['position']
end

#queue_sidString

Returns The SID of the Queue the member is in.

Returns:

  • (String)

    The SID of the Queue the member is in.



317
318
319
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 317

def queue_sid
    @properties['queue_sid']
end

#to_sObject

Provide a user friendly representation



347
348
349
350
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 347

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

#update(url: nil, method: :unset) ⇒ MemberInstance

Update the MemberInstance

Parameters:

  • url (String) (defaults to: nil)

    The absolute URL of the Queue resource.

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

    How to pass the update request data. Can be ‘GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters.

Returns:



334
335
336
337
338
339
340
341
342
343
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 334

def update(
    url: nil, 
    method: :unset
)

    context.update(
        url: url, 
        method: method, 
    )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`.



305
306
307
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 305

def uri
    @properties['uri']
end

#wait_timeString

Returns The number of seconds the member has been in the queue.

Returns:

  • (String)

    The number of seconds the member has been in the queue.



311
312
313
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 311

def wait_time
    @properties['wait_time']
end