Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service/configuration.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb

Defined Under Namespace

Classes: NotificationContext, NotificationInstance, NotificationList, NotificationPage, WebhookContext, WebhookInstance, WebhookList, WebhookPage

Instance Method Summary collapse

Constructor Details

#initialize(version, chat_service_sid) ⇒ ConfigurationContext

Initialize the ConfigurationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • chat_service_sid (String)

    The SID of the Service configuration resource to update.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 51

def initialize(version, chat_service_sid)
    super(version)

    # Path Solution
    @solution = { chat_service_sid: chat_service_sid,  }
    @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration"

    # Dependents
    @webhooks = nil
    @notifications = nil
end

Instance Method Details

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 65

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ConfigurationInstance.new(
        @version,
        payload,
        chat_service_sid: @solution[:chat_service_sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



146
147
148
149
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 146

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
end

#notificationsNotificationList, NotificationContext

Access the notifications



130
131
132
133
134
135
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 130

def notifications
    NotificationContext.new(
            @version,
            @solution[:chat_service_sid]
            )
end

#to_sObject

Provide a user friendly representation



139
140
141
142
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 139

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
end

#update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset, reachability_enabled: :unset) ⇒ ConfigurationInstance

Update the ConfigurationInstance

Parameters:

Returns:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 88

def update(
    default_conversation_creator_role_sid: :unset, 
    default_conversation_role_sid: :unset, 
    default_chat_service_role_sid: :unset, 
    reachability_enabled: :unset
)

    data = Twilio::Values.of({
        'DefaultConversationCreatorRoleSid' => default_conversation_creator_role_sid,
        'DefaultConversationRoleSid' => default_conversation_role_sid,
        'DefaultChatServiceRoleSid' => default_chat_service_role_sid,
        'ReachabilityEnabled' => reachability_enabled,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ConfigurationInstance.new(
        @version,
        payload,
        chat_service_sid: @solution[:chat_service_sid],
    )
end

#webhooksWebhookList, WebhookContext

Access the webhooks



120
121
122
123
124
125
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 120

def webhooks
    WebhookContext.new(
            @version,
            @solution[:chat_service_sid]
            )
end