lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb in twilio-ruby-5.39.0

- old
+ new

@@ -27,37 +27,32 @@ @solution = {fleet_sid: fleet_sid} @uri = "/Fleets/#{@solution[:fleet_sid]}/Devices" end ## - # Retrieve a single page of DeviceInstance records from the API. - # Request is executed immediately. + # Create the DeviceInstance # @param [String] unique_name Provides a unique and addressable name to be # assigned to this Device, to be used in addition to SID, up to 128 characters # long. # @param [String] friendly_name Provides a human readable descriptive text to be # assigned to this Device, up to 256 characters long. # @param [String] identity Provides an arbitrary string identifier representing a # human user to be associated with this Device, up to 256 characters long. # @param [String] deployment_sid Specifies the unique string identifier of the # Deployment group that this Device is going to be associated with. # @param [Boolean] enabled The enabled - # @return [DeviceInstance] Newly created DeviceInstance + # @return [DeviceInstance] Created DeviceInstance def create(unique_name: :unset, friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) data = Twilio::Values.of({ 'UniqueName' => unique_name, 'FriendlyName' => friendly_name, 'Identity' => identity, 'DeploymentSid' => deployment_sid, 'Enabled' => enabled, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], ) end ## @@ -126,15 +121,13 @@ 'DeploymentSid' => deployment_sid, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) - response = @version.page( - 'GET', - @uri, - params - ) + + response = @version.page('GET', @uri, params) + DevicePage.new(@version, response, @solution) end ## # Retrieve a single page of DeviceInstance records from the API. @@ -204,29 +197,23 @@ @solution = {fleet_sid: fleet_sid, sid: sid, } @uri = "/Fleets/#{@solution[:fleet_sid]}/Devices/#{@solution[:sid]}" end ## - # Fetch a DeviceInstance + # Fetch the DeviceInstance # @return [DeviceInstance] Fetched DeviceInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end ## - # Deletes the DeviceInstance + # Delete the DeviceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Update the DeviceInstance # @param [String] friendly_name Provides a human readable descriptive text to be @@ -243,15 +230,11 @@ 'Identity' => identity, 'DeploymentSid' => deployment_sid, 'Enabled' => enabled, }) - payload = @version.update( - 'POST', - @uri, - data: data, - ) + payload = @version.update('POST', @uri, data: data) DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end ## @@ -387,17 +370,17 @@ def date_authenticated @properties['date_authenticated'] end ## - # Fetch a DeviceInstance + # Fetch the DeviceInstance # @return [DeviceInstance] Fetched DeviceInstance def fetch context.fetch end ## - # Deletes the DeviceInstance + # Delete the DeviceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file