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

- old
+ new

@@ -24,12 +24,11 @@ @solution = {} @uri = "/Services" end ## - # Retrieve a single page of ServiceInstance records from the API. - # Request is executed immediately. + # Create the ServiceInstance # @param [String] friendly_name A descriptive string that you create to describe # the resource. It can be up to 64 characters long. # @param [String] inbound_request_url The URL we should call using # `inbound_method` when a message is received by any phone number or short code in # the Service. When this property is `null`, receiving inbound messages is @@ -60,11 +59,11 @@ # Geomatch](https://www.twilio.com/docs/sms/services#area-code-geomatch) on the # Service Instance. # @param [String] validity_period How long, in seconds, messages sent from the # Service are valid. Can be an integer from `1` to `14,400`. # @param [Boolean] synchronous_validation Reserved. - # @return [ServiceInstance] Newly created ServiceInstance + # @return [ServiceInstance] Created ServiceInstance def create(friendly_name: nil, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'InboundRequestUrl' => inbound_request_url, 'InboundMethod' => inbound_method, @@ -79,15 +78,11 @@ 'AreaCodeGeomatch' => area_code_geomatch, 'ValidityPeriod' => validity_period, 'SynchronousValidation' => synchronous_validation, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) ServiceInstance.new(@version, payload, ) end ## @@ -149,15 +144,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) + ServicePage.new(@version, response, @solution) end ## # Retrieve a single page of ServiceInstance records from the API. @@ -284,39 +277,29 @@ 'AreaCodeGeomatch' => area_code_geomatch, 'ValidityPeriod' => validity_period, 'SynchronousValidation' => synchronous_validation, }) - payload = @version.update( - 'POST', - @uri, - data: data, - ) + payload = @version.update('POST', @uri, data: data) ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end ## - # Fetch a ServiceInstance + # Fetch the ServiceInstance # @return [ServiceInstance] Fetched ServiceInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end ## - # Deletes the ServiceInstance + # Delete the ServiceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Access the phone_numbers # @return [PhoneNumberList] @@ -613,17 +596,17 @@ synchronous_validation: synchronous_validation, ) end ## - # Fetch a ServiceInstance + # Fetch the ServiceInstance # @return [ServiceInstance] Fetched ServiceInstance def fetch context.fetch end ## - # Deletes the ServiceInstance + # Delete the ServiceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file