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 Queue resource.

  • queue_sid (String) (defaults to: nil)

    The SID of the Queue the member is in.

  • call_sid (String) (defaults to: nil)

    The Call SID of the resource(s) to fetch.


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 238

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'].to_i,
      'uri' => payload['uri'],
      'wait_time' => payload['wait_time'].to_i,
      'queue_sid' => payload['queue_sid'],
  }

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

Instance Method Details

#call_sidString

Returns The SID of the Call the resource is associated with.

Returns:

  • (String)

    The SID of the Call the resource is associated with


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

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:


264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 264

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 the member was enqueued.

Returns:

  • (Time)

    The date the member was enqueued


284
285
286
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 284

def date_enqueued
  @properties['date_enqueued']
end

#fetchMemberInstance

Fetch the MemberInstance

Returns:


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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


339
340
341
342
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 339

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.


290
291
292
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 290

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


308
309
310
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 308

def queue_sid
  @properties['queue_sid']
end

#to_sObject

Provide a user friendly representation


332
333
334
335
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 332

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:


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

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:


296
297
298
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 296

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.


302
303
304
# File 'lib/twilio-ruby/rest/api/v2010/account/queue/member.rb', line 302

def wait_time
  @properties['wait_time']
end