lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb in twilio-ruby-5.4.3

- old
+ new

@@ -20,13 +20,11 @@ # @return [KeyList] KeyList def initialize(version, fleet_sid: nil) super(version) # Path Solution - @solution = { - fleet_sid: fleet_sid - } + @solution = {fleet_sid: fleet_sid} @uri = "/Fleets/#{@solution[:fleet_sid]}/Keys" end ## # Retrieve a single page of KeyInstance records from the API. @@ -35,26 +33,19 @@ # this Key credential, up to 256 characters long. # @param [String] device_sid Provides the unique string identifier of an existing # Device to become authenticated with this Key credential. # @return [KeyInstance] Newly created KeyInstance def create(friendly_name: :unset, device_sid: :unset) - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'DeviceSid' => device_sid, - }) + data = Twilio::Values.of({'FriendlyName' => friendly_name, 'DeviceSid' => device_sid,}) payload = @version.create( 'POST', @uri, data: data ) - KeyInstance.new( - @version, - payload, - fleet_sid: @solution[:fleet_sid], - ) + KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid],) end ## # Lists KeyInstance records from the API as a list. # Unlike stream(), this operation is eager and will load `limit` records into @@ -67,15 +58,11 @@ # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Array] Array of up to limit results def list(device_sid: :unset, limit: nil, page_size: nil) - self.stream( - device_sid: device_sid, - limit: limit, - page_size: page_size - ).entries + self.stream(device_sid: device_sid, limit: limit, page_size: page_size).entries end ## # Streams KeyInstance records from the API as an Enumerable. # This operation lazily loads records as efficiently as possible until the limit @@ -90,14 +77,11 @@ # efficient page size, i.e. min(limit, 1000) # @return [Enumerable] Enumerable that will yield up to limit results def stream(device_sid: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) - page = self.page( - device_sid: device_sid, - page_size: limits[:page_size], - ) + page = self.page(device_sid: device_sid, page_size: limits[:page_size],) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end ## @@ -105,13 +89,11 @@ # This operation lazily loads records as efficiently as possible until the limit # is reached. def each limits = @version.read_limits - page = self.page( - page_size: limits[:page_size], - ) + page = self.page(page_size: limits[:page_size],) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end @@ -179,15 +161,11 @@ ## # Build an instance of KeyInstance # @param [Hash] payload Payload response from the API # @return [KeyInstance] KeyInstance def get_instance(payload) - KeyInstance.new( - @version, - payload, - fleet_sid: @solution[:fleet_sid], - ) + KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid],) end ## # Provide a user friendly representation def to_s @@ -207,14 +185,11 @@ # @return [KeyContext] KeyContext def initialize(version, fleet_sid, sid) super(version) # Path Solution - @solution = { - fleet_sid: fleet_sid, - sid: sid, - } + @solution = {fleet_sid: fleet_sid, sid: sid,} @uri = "/Fleets/#{@solution[:fleet_sid]}/Keys/#{@solution[:sid]}" end ## # Fetch a KeyInstance @@ -226,16 +201,11 @@ 'GET', @uri, params, ) - KeyInstance.new( - @version, - payload, - fleet_sid: @solution[:fleet_sid], - sid: @solution[:sid], - ) + KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid],) end ## # Deletes the KeyInstance # @return [Boolean] true if delete succeeds, true otherwise @@ -249,27 +219,19 @@ # this Key credential, up to 256 characters long. # @param [String] device_sid Provides the unique string identifier of an existing # Device to become authenticated with this Key credential. # @return [KeyInstance] Updated KeyInstance def update(friendly_name: :unset, device_sid: :unset) - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'DeviceSid' => device_sid, - }) + data = Twilio::Values.of({'FriendlyName' => friendly_name, 'DeviceSid' => device_sid,}) payload = @version.update( 'POST', @uri, data: data, ) - KeyInstance.new( - @version, - payload, - fleet_sid: @solution[:fleet_sid], - sid: @solution[:sid], - ) + KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid],) end ## # Provide a user friendly representation def to_s @@ -306,27 +268,20 @@ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), } # Context @instance_context = nil - @params = { - 'fleet_sid' => fleet_sid, - 'sid' => sid || @properties['sid'], - } + @params = {'fleet_sid' => fleet_sid, 'sid' => sid || @properties['sid'],} end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [KeyContext] KeyContext for this KeyInstance def context unless @instance_context - @instance_context = KeyContext.new( - @version, - @params['fleet_sid'], - @params['sid'], - ) + @instance_context = KeyContext.new(@version, @params['fleet_sid'], @params['sid'],) end @instance_context end ## @@ -403,13 +358,10 @@ # this Key credential, up to 256 characters long. # @param [String] device_sid Provides the unique string identifier of an existing # Device to become authenticated with this Key credential. # @return [KeyInstance] Updated KeyInstance def update(friendly_name: :unset, device_sid: :unset) - context.update( - friendly_name: friendly_name, - device_sid: device_sid, - ) + context.update(friendly_name: friendly_name, device_sid: device_sid,) end ## # Provide a user friendly representation def to_s \ No newline at end of file