lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.4.3

- old
+ new

@@ -63,14 +63,11 @@ 'POST', @uri, data: data ) - ServiceInstance.new( - @version, - payload, - ) + ServiceInstance.new(@version, payload,) end ## # Lists ServiceInstance records from the API as a list. # Unlike stream(), this operation is eager and will load `limit` records into @@ -82,15 +79,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(friendly_name: :unset, limit: nil, page_size: nil) - self.stream( - friendly_name: friendly_name, - limit: limit, - page_size: page_size - ).entries + self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries end ## # Streams ServiceInstance records from the API as an Enumerable. # This operation lazily loads records as efficiently as possible until the limit @@ -104,14 +97,11 @@ # efficient page size, i.e. min(limit, 1000) # @return [Enumerable] Enumerable that will yield up to limit results def stream(friendly_name: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) - page = self.page( - friendly_name: friendly_name, - page_size: limits[:page_size], - ) + page = self.page(friendly_name: friendly_name, page_size: limits[:page_size],) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end ## @@ -119,13 +109,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 @@ -192,14 +180,11 @@ ## # Build an instance of ServiceInstance # @param [Hash] payload Payload response from the API # @return [ServiceInstance] ServiceInstance def get_instance(payload) - ServiceInstance.new( - @version, - payload, - ) + ServiceInstance.new(@version, payload,) end ## # Provide a user friendly representation def to_s @@ -217,13 +202,11 @@ # @return [ServiceContext] ServiceContext def initialize(version, sid) super(version) # Path Solution - @solution = { - sid: sid, - } + @solution = {sid: sid,} @uri = "/Services/#{@solution[:sid]}" # Dependents @bindings = nil @notifications = nil @@ -248,15 +231,11 @@ 'GET', @uri, params, ) - ServiceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) + ServiceInstance.new(@version, payload, sid: @solution[:sid],) end ## # Update the ServiceInstance # @param [String] friendly_name The friendly_name @@ -296,37 +275,26 @@ 'POST', @uri, data: data, ) - ServiceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) + ServiceInstance.new(@version, payload, sid: @solution[:sid],) end ## # Access the bindings # @return [BindingList] # @return [BindingContext] if sid was passed. def bindings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return BindingContext.new( - @version, - @solution[:sid], - sid, - ) + return BindingContext.new(@version, @solution[:sid], sid,) end unless @bindings - @bindings = BindingList.new( - @version, - service_sid: @solution[:sid], - ) + @bindings = BindingList.new(@version, service_sid: @solution[:sid],) end @bindings end @@ -334,14 +302,11 @@ # Access the notifications # @return [NotificationList] # @return [NotificationContext] def notifications unless @notifications - @notifications = NotificationList.new( - @version, - service_sid: @solution[:sid], - ) + @notifications = NotificationList.new(@version, service_sid: @solution[:sid],) end @notifications end @@ -351,22 +316,15 @@ # @return [UserContext] if identity was passed. def users(identity=:unset) raise ArgumentError, 'identity cannot be nil' if identity.nil? if identity != :unset - return UserContext.new( - @version, - @solution[:sid], - identity, - ) + return UserContext.new(@version, @solution[:sid], identity,) end unless @users - @users = UserList.new( - @version, - service_sid: @solution[:sid], - ) + @users = UserList.new(@version, service_sid: @solution[:sid],) end @users end @@ -374,14 +332,11 @@ # Access the segments # @return [SegmentList] # @return [SegmentContext] def segments unless @segments - @segments = SegmentList.new( - @version, - service_sid: @solution[:sid], - ) + @segments = SegmentList.new(@version, service_sid: @solution[:sid],) end @segments end @@ -427,24 +382,19 @@ 'default_alexa_notification_protocol_version' => payload['default_alexa_notification_protocol_version'], } # Context @instance_context = nil - @params = { - 'sid' => sid || @properties['sid'], - } + @params = {'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 [ServiceContext] ServiceContext for this ServiceInstance def context unless @instance_context - @instance_context = ServiceContext.new( - @version, - @params['sid'], - ) + @instance_context = ServiceContext.new(@version, @params['sid'],) end @instance_context end ## \ No newline at end of file