lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb in twilio-ruby-5.39.0
- old
+ new
@@ -87,15 +87,13 @@
params = Twilio::Values.of({
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
})
- response = @version.page(
- 'GET',
- @uri,
- params
- )
+
+ response = @version.page('GET', @uri, params)
+
WebhookPage.new(@version, response, @solution)
end
##
# Retrieve a single page of WebhookInstance records from the API.
@@ -109,12 +107,11 @@
)
WebhookPage.new(@version, response, @solution)
end
##
- # Retrieve a single page of WebhookInstance records from the API.
- # Request is executed immediately.
+ # Create the WebhookInstance
# @param [webhook.Target] target The target of this webhook: `webhook`, `studio`,
# `trigger`
# @param [String] configuration_url The absolute url the webhook request should be
# sent to.
# @param [webhook.Method] configuration_method The HTTP method to be used when
@@ -125,11 +122,11 @@
# event for this Conversation.
# @param [String] configuration_flow_sid The studio flow sid, where the webhook
# should be sent to.
# @param [String] configuration_replay_after The message index for which and it's
# successors the webhook will be replayed. Not set by default
- # @return [WebhookInstance] Newly created WebhookInstance
+ # @return [WebhookInstance] Created WebhookInstance
def create(target: nil, configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_replay_after: :unset)
data = Twilio::Values.of({
'Target' => target,
'Configuration.Url' => configuration_url,
'Configuration.Method' => configuration_method,
@@ -137,15 +134,11 @@
'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e },
'Configuration.FlowSid' => configuration_flow_sid,
'Configuration.ReplayAfter' => configuration_replay_after,
})
- payload = @version.create(
- 'POST',
- @uri,
- data: data
- )
+ payload = @version.create('POST', @uri, data: data)
WebhookInstance.new(@version, payload, conversation_sid: @solution[:conversation_sid], )
end
##
@@ -204,21 +197,15 @@
@solution = {conversation_sid: conversation_sid, sid: sid, }
@uri = "/Conversations/#{@solution[:conversation_sid]}/Webhooks/#{@solution[:sid]}"
end
##
- # Fetch a WebhookInstance
+ # Fetch the WebhookInstance
# @return [WebhookInstance] Fetched WebhookInstance
def fetch
- params = Twilio::Values.of({})
+ payload = @version.fetch('GET', @uri)
- payload = @version.fetch(
- 'GET',
- @uri,
- params,
- )
-
WebhookInstance.new(
@version,
payload,
conversation_sid: @solution[:conversation_sid],
sid: @solution[:sid],
@@ -245,29 +232,25 @@
'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e },
'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e },
'Configuration.FlowSid' => configuration_flow_sid,
})
- payload = @version.update(
- 'POST',
- @uri,
- data: data,
- )
+ payload = @version.update('POST', @uri, data: data)
WebhookInstance.new(
@version,
payload,
conversation_sid: @solution[:conversation_sid],
sid: @solution[:sid],
)
end
##
- # Deletes the WebhookInstance
+ # Delete the WebhookInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
- @version.delete('delete', @uri)
+ @version.delete('DELETE', @uri)
end
##
# Provide a user friendly representation
def to_s
@@ -373,11 +356,11 @@
def date_updated
@properties['date_updated']
end
##
- # Fetch a WebhookInstance
+ # Fetch the WebhookInstance
# @return [WebhookInstance] Fetched WebhookInstance
def fetch
context.fetch
end
@@ -403,10 +386,10 @@
configuration_flow_sid: configuration_flow_sid,
)
end
##
- # Deletes the WebhookInstance
+ # Delete the WebhookInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
context.delete
end
\ No newline at end of file