Class: Twilio::REST::Conversations::V1::ConfigurationContext::WebhookInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ WebhookInstance

Initialize the WebhookInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 168

def initialize(version, payload )
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'method' => payload['method'],
        'filters' => payload['filters'],
        'pre_webhook_url' => payload['pre_webhook_url'],
        'post_webhook_url' => payload['post_webhook_url'],
        'target' => payload['target'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

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

Returns:



200
201
202
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 200

def 
    @properties['account_sid']
end

#contextWebhookContext

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

Returns:



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

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

#fetchWebhookInstance

Fetch the WebhookInstance

Returns:



243
244
245
246
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 243

def fetch

    context.fetch
end

#filtersArray<String>

Returns The list of webhook event triggers that are enabled for this Service: ‘onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`.

Returns:

  • (Array<String>)

    The list of webhook event triggers that are enabled for this Service: ‘onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`



212
213
214
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 212

def filters
    @properties['filters']
end

#inspectObject

Provide a detailed, user friendly representation



282
283
284
285
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 282

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

#methodMethod

Returns:

  • (Method)


206
207
208
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 206

def method
    @properties['method']
end

#post_webhook_urlString

Returns The absolute url the post-event webhook request should be sent to.

Returns:

  • (String)

    The absolute url the post-event webhook request should be sent to.



224
225
226
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 224

def post_webhook_url
    @properties['post_webhook_url']
end

#pre_webhook_urlString

Returns The absolute url the pre-event webhook request should be sent to.

Returns:

  • (String)

    The absolute url the pre-event webhook request should be sent to.



218
219
220
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 218

def pre_webhook_url
    @properties['pre_webhook_url']
end

#targetTarget

Returns:

  • (Target)


230
231
232
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 230

def target
    @properties['target']
end

#to_sObject

Provide a user friendly representation



275
276
277
278
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 275

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

#update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance

Update the WebhookInstance

Parameters:

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

    The HTTP method to be used when sending a webhook request.

  • filters (Array[String]) (defaults to: :unset)

    The list of webhook event triggers that are enabled for this Service: ‘onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`

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

    The absolute url the pre-event webhook request should be sent to.

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

    The absolute url the post-event webhook request should be sent to.

  • target (Target) (defaults to: :unset)

Returns:



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 256

def update(
    method: :unset, 
    filters: :unset, 
    pre_webhook_url: :unset, 
    post_webhook_url: :unset, 
    target: :unset
)

    context.update(
        method: method, 
        filters: filters, 
        pre_webhook_url: pre_webhook_url, 
        post_webhook_url: post_webhook_url, 
        target: target, 
    )
end

#urlString

Returns An absolute API resource API resource URL for this webhook.

Returns:

  • (String)

    An absolute API resource API resource URL for this webhook.



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

def url
    @properties['url']
end