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.



586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 586

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:



619
620
621
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 619

def 
    @properties['account_sid']
end

#bindingsbindings

Access the bindings

Returns:



713
714
715
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 713

def bindings
    context.bindings
end

#configurationconfiguration

Access the configuration

Returns:



692
693
694
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 692

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:



610
611
612
613
614
615
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 610

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

#conversation_with_participantsconversation_with_participants

Access the conversation_with_participants

Returns:



685
686
687
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 685

def conversation_with_participants
    context.conversation_with_participants
end

#conversationsconversations

Access the conversations

Returns:



720
721
722
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 720

def conversations
    context.conversations
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



637
638
639
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 637

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.



643
644
645
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 643

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



662
663
664
665
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 662

def delete

    context.delete
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



670
671
672
673
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 670

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.



631
632
633
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 631

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



733
734
735
736
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 733

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.



655
656
657
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 655

def links
    @properties['links']
end

#participant_conversationsparticipant_conversations

Access the participant_conversations

Returns:



678
679
680
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 678

def participant_conversations
    context.participant_conversations
end

#rolesroles

Access the roles

Returns:



706
707
708
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 706

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.



625
626
627
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 625

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



726
727
728
729
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 726

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.



649
650
651
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 649

def url
    @properties['url']
end

#usersusers

Access the users

Returns:



699
700
701
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 699

def users
    context.users
end