Class: Twilio::REST::Conversations::V1::ConfigurationContext::WebhookContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ WebhookContext

Initialize the WebhookContext

Parameters:

  • version (Version)

    Version that contains the resource



49
50
51
52
53
54
55
56
57
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 49

def initialize(version)
    super(version)

    # Path Solution
    @solution = {  }
    @uri = "/Configuration/Webhooks"

    
end

Instance Method Details

#fetchWebhookInstance

Fetch the WebhookInstance

Returns:



61
62
63
64
65
66
67
68
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 61

def fetch

    payload = @version.fetch('GET', @uri)
    WebhookInstance.new(
        @version,
        payload,
    )
end

#inspectObject

Provide a detailed, user friendly representation



111
112
113
114
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 111

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

#to_sObject

Provide a user friendly representation



104
105
106
107
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 104

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.WebhookContext #{context}>"
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:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 78

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

    data = Twilio::Values.of({
        'Method' => method,
        'Filters' => Twilio.serialize_list(filters) { |e| e },
        'PreWebhookUrl' => pre_webhook_url,
        'PostWebhookUrl' => post_webhook_url,
        'Target' => target,
    })

    payload = @version.update('POST', @uri, data: data)
    WebhookInstance.new(
        @version,
        payload,
    )
end