Class: Twilio::REST::Conversations::V1::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/webhook.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique id of the Account responsible for this conversation.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#filters ⇒ String
The list of webhook event triggers that are enabled for this Service.
-
#initialize(version, payload) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#method ⇒ webhook.Method
The HTTP method to be used when sending a webhook request.
-
#post_webhook_url ⇒ String
The absolute url the post-event webhook request should be sent to.
-
#pre_webhook_url ⇒ String
The absolute url the pre-event webhook request should be sent to.
-
#target ⇒ webhook.Target
The routing target of the webhook.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
An absolute URL for this webhook.
Constructor Details
#initialize(version, payload) ⇒ WebhookInstance
Initialize the WebhookInstance
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 141 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_sid ⇒ String
Returns The unique id of the Account responsible for this conversation.
173 174 175 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 173 def account_sid @properties['account_sid'] end |
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
164 165 166 167 168 169 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 164 def context unless @instance_context @instance_context = WebhookContext.new(@version, ) end @instance_context end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
216 217 218 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 216 def fetch context.fetch end |
#filters ⇒ String
Returns The list of webhook event triggers that are enabled for this Service.
185 186 187 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 185 def filters @properties['filters'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
254 255 256 257 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 254 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.WebhookInstance #{values}>" end |
#method ⇒ webhook.Method
Returns The HTTP method to be used when sending a webhook request.
179 180 181 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 179 def method @properties['method'] end |
#post_webhook_url ⇒ String
Returns The absolute url the post-event webhook request should be sent to.
197 198 199 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 197 def post_webhook_url @properties['post_webhook_url'] end |
#pre_webhook_url ⇒ String
Returns The absolute url the pre-event webhook request should be sent to.
191 192 193 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 191 def pre_webhook_url @properties['pre_webhook_url'] end |
#target ⇒ webhook.Target
Returns The routing target of the webhook.
203 204 205 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 203 def target @properties['target'] end |
#to_s ⇒ Object
Provide a user friendly representation
247 248 249 250 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 247 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
235 236 237 238 239 240 241 242 243 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 235 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 |
#url ⇒ String
Returns An absolute URL for this webhook.
209 210 211 |
# File 'lib/twilio-ruby/rest/conversations/v1/webhook.rb', line 209 def url @properties['url'] end |