lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.39.0

- old
+ new

@@ -26,36 +26,31 @@ @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 # resource's `sid` in the URL. This value must be 64 characters or less in length # and be unique within the Service. # @param [String] attributes A valid JSON string that contains # application-specific data. # @param [channel.ChannelType] type The visibility of the channel. Can be: # `public` or `private` and defaults to `public`. - # @return [ChannelInstance] Newly created ChannelInstance + # @return [ChannelInstance] Created ChannelInstance def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, type: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'Attributes' => attributes, 'Type' => type, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], ) end ## @@ -124,15 +119,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. @@ -205,29 +198,23 @@ @messages = nil @invites = 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 # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Update the ChannelInstance # @param [String] friendly_name A descriptive string that you create to describe @@ -244,15 +231,11 @@ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'Attributes' => attributes, }) - payload = @version.update( - 'POST', - @uri, - data: data, - ) + payload = @version.update('POST', @uri, data: data) ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end ## @@ -467,17 +450,17 @@ 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 # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file