lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb in twilio-ruby-5.39.0
- old
+ new
@@ -26,12 +26,11 @@
@solution = {service_sid: service_sid}
@uri = "/Services/#{@solution[:service_sid]}/Channels"
end
##
- # Retrieve a single page of ChannelInstance records from the API.
- # Request is executed immediately.
+ # Create the ChannelInstance
# @param [String] friendly_name A descriptive string that you create to describe
# the new resource. It can be up to 64 characters long.
# @param [String] unique_name An application-defined string that uniquely
# identifies the resource. It can be used to address the resource in place of the
# Channel resource's `sid` in the URL. This value must be 64 characters or less in
@@ -50,27 +49,26 @@
# as the date it was last updated. The default value is `null`. Note that this
# parameter should only be used in cases where a Channel is being recreated from a
# backup/separate source and where a Message was previously updated.
# @param [String] created_by The `identity` of the User that created the channel.
# Default is: `system`.
- # @return [ChannelInstance] Newly created ChannelInstance
- def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, type: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
+ # @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
+ # @return [ChannelInstance] Created ChannelInstance
+ def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, type: :unset, date_created: :unset, date_updated: :unset, created_by: :unset, x_twilio_webhook_enabled: :unset)
data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'UniqueName' => unique_name,
'Attributes' => attributes,
'Type' => type,
'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
'CreatedBy' => created_by,
})
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
- payload = @version.create(
- 'POST',
- @uri,
- data: data
- )
+ payload = @version.create('POST', @uri, data: data, headers: headers)
ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], )
end
##
@@ -139,15 +137,13 @@
'Type' => Twilio.serialize_list(type) { |e| e },
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
})
- response = @version.page(
- 'GET',
- @uri,
- params
- )
+
+ response = @version.page('GET', @uri, params)
+
ChannelPage.new(@version, response, @solution)
end
##
# Retrieve a single page of ChannelInstance records from the API.
@@ -221,29 +217,27 @@
@invites = nil
@webhooks = nil
end
##
- # Fetch a ChannelInstance
+ # Fetch the ChannelInstance
# @return [ChannelInstance] Fetched ChannelInstance
def fetch
- params = Twilio::Values.of({})
+ payload = @version.fetch('GET', @uri)
- payload = @version.fetch(
- 'GET',
- @uri,
- params,
- )
-
ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end
##
- # Deletes the ChannelInstance
+ # Delete the ChannelInstance
+ # @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [Boolean] true if delete succeeds, false otherwise
- def delete
- @version.delete('delete', @uri)
+ def delete(x_twilio_webhook_enabled: :unset)
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
+
+ @version.delete('DELETE', @uri, headers: headers)
end
##
# Update the ChannelInstance
# @param [String] friendly_name A descriptive string that you create to describe
@@ -262,26 +256,25 @@
# @param [Time] date_updated The date, specified in [ISO
# 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
# as the date it was last updated.
# @param [String] created_by The `identity` of the User that created the channel.
# Default is: `system`.
+ # @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [ChannelInstance] Updated ChannelInstance
- def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
+ def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset, x_twilio_webhook_enabled: :unset)
data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'UniqueName' => unique_name,
'Attributes' => attributes,
'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
'CreatedBy' => created_by,
})
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
- payload = @version.update(
- 'POST',
- @uri,
- data: data,
- )
+ payload = @version.update('POST', @uri, data: data, headers: headers)
ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end
##
@@ -518,21 +511,23 @@
def links
@properties['links']
end
##
- # Fetch a ChannelInstance
+ # Fetch the ChannelInstance
# @return [ChannelInstance] Fetched ChannelInstance
def fetch
context.fetch
end
##
- # Deletes the ChannelInstance
+ # Delete the ChannelInstance
+ # @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [Boolean] true if delete succeeds, false otherwise
- def delete
- context.delete
+ def delete(x_twilio_webhook_enabled: :unset)
+ context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
end
##
# Update the ChannelInstance
# @param [String] friendly_name A descriptive string that you create to describe
@@ -551,18 +546,21 @@
# @param [Time] date_updated The date, specified in [ISO
# 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource
# as the date it was last updated.
# @param [String] created_by The `identity` of the User that created the channel.
# Default is: `system`.
+ # @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [ChannelInstance] Updated ChannelInstance
- def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
+ def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset, x_twilio_webhook_enabled: :unset)
context.update(
friendly_name: friendly_name,
unique_name: unique_name,
attributes: attributes,
date_created: date_created,
date_updated: date_updated,
created_by: created_by,
+ x_twilio_webhook_enabled: x_twilio_webhook_enabled,
)
end
##
# Access the members
\ No newline at end of file