lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.0.0.rc9 vs lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.0.0.rc10

- old
+ new

@@ -12,11 +12,10 @@ class ChannelList < ListResource ## # Initialize the ChannelList # @param [Version] version Version that contains the resource # @param [String] service_sid The service_sid - # @return [ChannelList] ChannelList def initialize(version, service_sid: nil) super(version) # Path Solution @@ -29,13 +28,12 @@ ## # Retrieve a single page of ChannelInstance records from the API. # Request is executed immediately. # @param [String] friendly_name The friendly_name # @param [String] unique_name The unique_name - # @param [String] attributes The attributes + # @param [Hash] attributes The attributes # @param [channel.ChannelType] type The type - # @return [ChannelInstance] Newly created ChannelInstance def create(friendly_name: nil, unique_name: nil, attributes: nil, type: nil) data = { 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, @@ -50,11 +48,11 @@ ) return ChannelInstance.new( @version, payload, - service_sid: @solution['service_sid'], + service_sid: @solution[:service_sid], ) end ## # Lists ChannelInstance records from the API as a list. @@ -64,11 +62,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when 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(limit: nil, page_size: nil) self.stream( limit: limit, page_size: page_size @@ -83,11 +80,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when 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 [Enumerable] Enumerable that will yield up to limit results def stream(limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( @@ -123,11 +119,10 @@ # Retrieve a single page of ChannelInstance records from the API. # Request is executed immediately. # @param [String] page_token PageToken provided by the API # @param [Integer] page_number Page Number, this value is simply for client state # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of ChannelInstance def page(page_token: nil, page_number: nil, page_size: nil) params = { 'PageToken' => page_token, 'Page' => page_number, @@ -153,11 +148,10 @@ # Initialize the ChannelPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @param [String] service_sid The service_sid - # @return [ChannelPage] ChannelPage def initialize(version, response, solution) super(version, response) # Path Solution @@ -165,17 +159,16 @@ end ## # Build an instance of ChannelInstance # @param [Hash] payload Payload response from the API - # @return [ChannelInstance] ChannelInstance def get_instance(payload) return ChannelInstance.new( @version, payload, - service_sid: @solution['service_sid'], + service_sid: @solution[:service_sid], ) end ## # Provide a user friendly representation @@ -188,11 +181,10 @@ ## # Initialize the ChannelContext # @param [Version] version Version that contains the resource # @param [String] service_sid The service_sid # @param [String] sid The sid - # @return [ChannelContext] ChannelContext def initialize(version, service_sid, sid) super(version) # Path Solution @@ -220,12 +212,12 @@ ) return ChannelInstance.new( @version, payload, - service_sid: @solution['service_sid'], - sid: @solution['sid'], + service_sid: @solution[:service_sid], + sid: @solution[:sid], ) end ## # Deletes the ChannelInstance @@ -236,13 +228,12 @@ ## # Update the ChannelInstance # @param [String] friendly_name The friendly_name # @param [String] unique_name The unique_name - # @param [String] attributes The attributes + # @param [Hash] attributes The attributes # @param [channel.ChannelType] type The type - # @return [ChannelInstance] Updated ChannelInstance def update(friendly_name: nil, unique_name: nil, attributes: nil, type: nil) data = { 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, @@ -257,12 +248,12 @@ ) return ChannelInstance.new( @version, payload, - service_sid: @solution['service_sid'], - sid: @solution['sid'], + service_sid: @solution[:service_sid], + sid: @solution[:sid], ) end ## # Access the members @@ -325,11 +316,10 @@ # Initialize the ChannelInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] service_sid The service_sid # @param [String] sid The sid - # @return [ChannelInstance] ChannelInstance def initialize(version, payload, service_sid: nil, sid: nil) super(version) # Marshaled Properties @@ -358,11 +348,10 @@ ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @param [Version] version Version that contains the resource - # @return [ChannelContext] ChannelContext for this ChannelInstance def context unless @instance_context @instance_context = ChannelContext.new( @version, @@ -423,54 +412,54 @@ ## # Fetch a ChannelInstance # @return [ChannelInstance] Fetched ChannelInstance def fetch - @context.fetch() + context.fetch end ## # Deletes the ChannelInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - @context.delete() + context.delete end ## # Update the ChannelInstance # @param [String] friendly_name The friendly_name # @param [String] unique_name The unique_name - # @param [String] attributes The attributes + # @param [Hash] attributes The attributes # @param [channel.ChannelType] type The type - # @return [ChannelInstance] Updated ChannelInstance def update(friendly_name: nil, unique_name: nil, attributes: nil, type: nil) - @context.update( + context.update( + friendly_name: friendly_name, unique_name: unique_name, attributes: attributes, type: type, ) end ## # Access the members # @return [members] members def members - @context.members + context.members end ## # Access the messages # @return [messages] messages def messages - @context.messages + context.messages end ## # Provide a user friendly representation def to_s - context = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.IpMessaging.V1.ChannelInstance #{context}>" + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.IpMessaging.V1.ChannelInstance #{values}>" end end end end end \ No newline at end of file