Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::WebhookContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::WebhookContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#initialize(version, chat_service_sid, conversation_sid, sid) ⇒ WebhookContext
constructor
Initialize the WebhookContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
Constructor Details
#initialize(version, chat_service_sid, conversation_sid, sid) ⇒ WebhookContext
Initialize the WebhookContext
179 180 181 182 183 184 185 186 187 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 179 def initialize(version, chat_service_sid, conversation_sid, sid) super(version) # Path Solution @solution = { chat_service_sid: chat_service_sid, conversation_sid: conversation_sid, sid: sid, } @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Webhooks/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the WebhookInstance
191 192 193 194 195 196 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 191 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 201 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WebhookInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
261 262 263 264 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 261 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.WebhookContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
254 255 256 257 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 254 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.WebhookContext #{context}>" end |
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset) ⇒ WebhookInstance
Update the WebhookInstance
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 223 def update( configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset ) data = Twilio::Values.of({ 'Configuration.Url' => configuration_url, 'Configuration.Method' => configuration_method, 'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e }, 'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e }, 'Configuration.FlowSid' => configuration_flow_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WebhookInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |