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



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 155

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



187
188
189
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 187

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



178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 178

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

#fetchWebhookInstance

Fetch the WebhookInstance



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

def fetch

    context.fetch
end

#filtersArray<String>



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

def filters
    @properties['filters']
end

#inspectObject

Provide a detailed, user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 269

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

#methodMethod



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

def method
    @properties['method']
end

#post_webhook_urlString



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

def post_webhook_url
    @properties['post_webhook_url']
end

#pre_webhook_urlString



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

def pre_webhook_url
    @properties['pre_webhook_url']
end

#targetTarget



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

def target
    @properties['target']
end

#to_sObject

Provide a user friendly representation



262
263
264
265
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 262

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



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

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



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

def url
    @properties['url']
end