Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this service.
-
#chat_service_sid ⇒ String
The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#filters ⇒ Array<String>
The list of events that your configured webhook targets will receive.
-
#initialize(version, payload, chat_service_sid: nil) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #method ⇒ Method
-
#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.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
An absolute API resource URL for this webhook.
Constructor Details
#initialize(version, payload, chat_service_sid: nil) ⇒ WebhookInstance
Initialize the WebhookInstance
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 156 def initialize(version, payload , chat_service_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'chat_service_sid' => payload['chat_service_sid'], 'pre_webhook_url' => payload['pre_webhook_url'], 'post_webhook_url' => payload['post_webhook_url'], 'filters' => payload['filters'], 'method' => payload['method'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'chat_service_sid' => chat_service_sid || @properties['chat_service_sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this service.
188 189 190 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 188 def account_sid @properties['account_sid'] end |
#chat_service_sid ⇒ String
Returns The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
194 195 196 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 194 def chat_service_sid @properties['chat_service_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
179 180 181 182 183 184 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 179 def context unless @instance_context @instance_context = WebhookContext.new(@version , @params['chat_service_sid']) end @instance_context end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
231 232 233 234 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 231 def fetch context.fetch end |
#filters ⇒ Array<String>
Returns The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are ‘onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`.
212 213 214 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 212 def filters @properties['filters'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
267 268 269 270 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 267 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.WebhookInstance #{values}>" end |
#method ⇒ Method
218 219 220 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 218 def method @properties['method'] end |
#post_webhook_url ⇒ String
Returns The absolute url the post-event webhook request should be sent to.
206 207 208 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 206 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.
200 201 202 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 200 def pre_webhook_url @properties['pre_webhook_url'] end |
#to_s ⇒ Object
Provide a user friendly representation
260 261 262 263 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 260 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.WebhookInstance #{values}>" end |
#update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset) ⇒ WebhookInstance
Update the WebhookInstance
243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 243 def update( pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset ) context.update( pre_webhook_url: pre_webhook_url, post_webhook_url: post_webhook_url, filters: filters, method: method, ) end |
#url ⇒ String
Returns An absolute API resource URL for this webhook.
224 225 226 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 224 def url @properties['url'] end |