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

- old
+ new

@@ -30,29 +30,24 @@ @solution = {service_sid: service_sid, channel_sid: channel_sid} @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Messages" end ## - # Retrieve a single page of MessageInstance records from the API. - # Request is executed immediately. + # Create the MessageInstance # @param [String] body The message to send to the channel. Can also be an empty # string or `null`, which sets the value as an empty string. You can send # structured data in the body by serializing it as a string. # @param [String] from The # [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new # message's author. The default value is `system`. # @param [String] attributes A valid JSON string that contains # application-specific data. - # @return [MessageInstance] Newly created MessageInstance + # @return [MessageInstance] Created MessageInstance def create(body: nil, from: :unset, attributes: :unset) data = Twilio::Values.of({'Body' => body, 'From' => from, 'Attributes' => attributes, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) MessageInstance.new( @version, payload, service_sid: @solution[:service_sid], @@ -126,15 +121,13 @@ 'Order' => order, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) - response = @version.page( - 'GET', - @uri, - params - ) + + response = @version.page('GET', @uri, params) + MessagePage.new(@version, response, @solution) end ## # Retrieve a single page of MessageInstance records from the API. @@ -210,35 +203,29 @@ @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Messages/#{@solution[:sid]}" end ## - # Fetch a MessageInstance + # Fetch the MessageInstance # @return [MessageInstance] Fetched MessageInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - MessageInstance.new( @version, payload, service_sid: @solution[:service_sid], channel_sid: @solution[:channel_sid], sid: @solution[:sid], ) end ## - # Deletes the MessageInstance + # Delete the MessageInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Update the MessageInstance # @param [String] body The message to send to the channel. Can also be an empty @@ -248,15 +235,11 @@ # application-specific data. # @return [MessageInstance] Updated MessageInstance def update(body: :unset, attributes: :unset) data = Twilio::Values.of({'Body' => body, 'Attributes' => attributes, }) - payload = @version.update( - 'POST', - @uri, - data: data, - ) + payload = @version.update('POST', @uri, data: data) MessageInstance.new( @version, payload, service_sid: @solution[:service_sid], @@ -416,17 +399,17 @@ def url @properties['url'] end ## - # Fetch a MessageInstance + # Fetch the MessageInstance # @return [MessageInstance] Fetched MessageInstance def fetch context.fetch end ## - # Deletes the MessageInstance + # Delete the MessageInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file