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

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 296

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 responsible for this service.

Returns:

  • (String)

    The unique ID of the Account responsible for this service.



328
329
330
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 328

def 
  @properties['account_sid']
end

#bindingsbindings

Access the bindings

Returns:



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

def bindings
  context.bindings
end

#configurationconfiguration

Access the configuration

Returns:



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

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:



319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 319

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

#conversationsconversations

Access the conversations

Returns:



385
386
387
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 385

def conversations
  context.conversations
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 346

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.



352
353
354
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 352

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
  context.delete
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns The human-readable name of this service.

Returns:

  • (String)

    The human-readable name of this service.



340
341
342
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 340

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 426

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

Returns Absolute URLs to access the conversations, users, roles, bindings and configuration of this service.

Returns:

  • (String)

    Absolute URLs to access the conversations, users, roles, bindings and configuration of this service.



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

def links
  @properties['links']
end

#rolesroles

Access the roles

Returns:



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

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.



334
335
336
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 334

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns An absolute URL for this service.

Returns:

  • (String)

    An absolute URL for this service.



358
359
360
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 358

def url
  @properties['url']
end

#usersusers

Access the users

Returns:



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

def users
  context.users
end