Class: Twilio::REST::Conversations::V1::ConfigurationInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ ConfigurationInstance

Initialize the ConfigurationInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 160

def initialize(version, payload )
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'default_chat_service_sid' => payload['default_chat_service_sid'],
        'default_messaging_service_sid' => payload['default_messaging_service_sid'],
        'default_inactive_timer' => payload['default_inactive_timer'],
        'default_closed_timer' => payload['default_closed_timer'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = {  }
end

Instance Method Details

#account_sidString

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

Returns:



192
193
194
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 192

def 
    @properties['account_sid']
end

#contextConfigurationContext

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

Returns:



183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 183

def context
    unless @instance_context
        @instance_context = ConfigurationContext.new(@version )
    end
    @instance_context
end

#default_chat_service_sidString

Returns The SID of the default [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation.

Returns:



198
199
200
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 198

def default_chat_service_sid
    @properties['default_chat_service_sid']
end

#default_closed_timerString

Returns Default ISO8601 duration when conversation will be switched to ‘closed` state. Minimum value for this timer is 10 minutes.

Returns:

  • (String)

    Default ISO8601 duration when conversation will be switched to ‘closed` state. Minimum value for this timer is 10 minutes.



216
217
218
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 216

def default_closed_timer
    @properties['default_closed_timer']
end

#default_inactive_timerString

Returns Default ISO8601 duration when conversation will be switched to ‘inactive` state. Minimum value for this timer is 1 minute.

Returns:

  • (String)

    Default ISO8601 duration when conversation will be switched to ‘inactive` state. Minimum value for this timer is 1 minute.



210
211
212
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 210

def default_inactive_timer
    @properties['default_inactive_timer']
end

#default_messaging_service_sidString

Returns The SID of the default [Messaging Service](www.twilio.com/docs/messaging/api/service-resource) used when creating a conversation.

Returns:



204
205
206
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 204

def default_messaging_service_sid
    @properties['default_messaging_service_sid']
end

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:



235
236
237
238
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 235

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



278
279
280
281
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 278

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

Returns Contains absolute API resource URLs to access the webhook and default service configurations.

Returns:

  • (Hash)

    Contains absolute API resource URLs to access the webhook and default service configurations.



228
229
230
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 228

def links
    @properties['links']
end

#to_sObject

Provide a user friendly representation



271
272
273
274
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 271

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

#update(default_chat_service_sid: :unset, default_messaging_service_sid: :unset, default_inactive_timer: :unset, default_closed_timer: :unset) ⇒ ConfigurationInstance

Update the ConfigurationInstance

Parameters:

  • default_chat_service_sid (String) (defaults to: :unset)

    The SID of the default [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) to use when creating a conversation.

  • default_messaging_service_sid (String) (defaults to: :unset)

    The SID of the default [Messaging Service](www.twilio.com/docs/messaging/api/service-resource) to use when creating a conversation.

  • default_inactive_timer (String) (defaults to: :unset)

    Default ISO8601 duration when conversation will be switched to ‘inactive` state. Minimum value for this timer is 1 minute.

  • default_closed_timer (String) (defaults to: :unset)

    Default ISO8601 duration when conversation will be switched to ‘closed` state. Minimum value for this timer is 10 minutes.

Returns:



247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 247

def update(
    default_chat_service_sid: :unset, 
    default_messaging_service_sid: :unset, 
    default_inactive_timer: :unset, 
    default_closed_timer: :unset
)

    context.update(
        default_chat_service_sid: default_chat_service_sid, 
        default_messaging_service_sid: default_messaging_service_sid, 
        default_inactive_timer: default_inactive_timer, 
        default_closed_timer: default_closed_timer, 
    )
end

#urlString

Returns An absolute API resource URL for this global configuration.

Returns:

  • (String)

    An absolute API resource URL for this global configuration.



222
223
224
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 222

def url
    @properties['url']
end

#webhookswebhooks

Access the webhooks

Returns:



265
266
267
# File 'lib/twilio-ruby/rest/conversations/v1/configuration.rb', line 265

def webhooks
    context.webhooks
end