lib/twilio-ruby/rest/messaging/v1/service/short_code.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/messaging/v1/service/short_code.rb in twilio-ruby-5.39.0

- old
+ new

@@ -28,23 +28,18 @@ @solution = {service_sid: service_sid} @uri = "/Services/#{@solution[:service_sid]}/ShortCodes" end ## - # Retrieve a single page of ShortCodeInstance records from the API. - # Request is executed immediately. + # Create the ShortCodeInstance # @param [String] short_code_sid The SID of the ShortCode resource being added to # the Service. - # @return [ShortCodeInstance] Newly created ShortCodeInstance + # @return [ShortCodeInstance] Created ShortCodeInstance def create(short_code_sid: nil) data = Twilio::Values.of({'ShortCodeSid' => short_code_sid, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) ShortCodeInstance.new(@version, payload, service_sid: @solution[:service_sid], ) end ## @@ -106,15 +101,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) + ShortCodePage.new(@version, response, @solution) end ## # Retrieve a single page of ShortCodeInstance records from the API. @@ -185,28 +178,22 @@ @solution = {service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/ShortCodes/#{@solution[:sid]}" end ## - # Deletes the ShortCodeInstance + # Delete the ShortCodeInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## - # Fetch a ShortCodeInstance + # Fetch the ShortCodeInstance # @return [ShortCodeInstance] Fetched ShortCodeInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - ShortCodeInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end ## # Provide a user friendly representation @@ -320,17 +307,17 @@ def url @properties['url'] end ## - # Deletes the ShortCodeInstance + # Delete the ShortCodeInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end ## - # Fetch a ShortCodeInstance + # Fetch the ShortCodeInstance # @return [ShortCodeInstance] Fetched ShortCodeInstance def fetch context.fetch end \ No newline at end of file