Class: Twilio::REST::Conversations::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Service resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 338

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'sid' => payload['sid'],
        'friendly_name' => payload['friendly_name'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString

Returns The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this service.

Returns:



370
371
372
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 370

def 
    @properties['account_sid']
end

#bindingsbindings

Access the bindings

Returns:



457
458
459
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 457

def bindings
    context.bindings
end

#configurationconfiguration

Access the configuration

Returns:



450
451
452
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 450

def configuration
    context.configuration
end

#contextServiceContext

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

Returns:



361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 361

def context
    unless @instance_context
        @instance_context = ServiceContext.new(@version , @params['sid'])
    end
    @instance_context
end

#conversationsconversations

Access the conversations

Returns:



464
465
466
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 464

def conversations
    context.conversations
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



388
389
390
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 388

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • (Time)

    The date that this resource was last updated.



394
395
396
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 394

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



413
414
415
416
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 413

def delete

    context.delete
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



421
422
423
424
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 421

def fetch

    context.fetch
end

#friendly_nameString

Returns The human-readable name of this service, limited to 256 characters. Optional.

Returns:

  • (String)

    The human-readable name of this service, limited to 256 characters. Optional.



382
383
384
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 382

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



477
478
479
480
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 477

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

Returns Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service.

Returns:

  • (Hash)

    Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service.



406
407
408
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 406

def links
    @properties['links']
end

#participant_conversationsparticipant_conversations

Access the participant_conversations

Returns:



429
430
431
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 429

def participant_conversations
    context.participant_conversations
end

#rolesroles

Access the roles

Returns:



443
444
445
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 443

def roles
    context.roles
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



376
377
378
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 376

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



470
471
472
473
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 470

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

#urlString

Returns An absolute API resource URL for this service.

Returns:

  • (String)

    An absolute API resource URL for this service.



400
401
402
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 400

def url
    @properties['url']
end

#usersusers

Access the users

Returns:



436
437
438
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 436

def users
    context.users
end