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

- old
+ new

@@ -10,11 +10,10 @@ class V1 < Version class ServiceList < ListResource ## # Initialize the ServiceList # @param [Version] version Version that contains the resource - # @return [ServiceList] ServiceList def initialize(version) super(version) # Path Solution @@ -32,11 +31,10 @@ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id # @param [String] default_apn_notification_protocol_version The # default_apn_notification_protocol_version # @param [String] default_gcm_notification_protocol_version The # default_gcm_notification_protocol_version - # @return [ServiceInstance] Newly created ServiceInstance def create(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil) data = { 'FriendlyName' => friendly_name, 'ApnCredentialSid' => apn_credential_sid, @@ -68,11 +66,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(friendly_name: nil, limit: nil, page_size: nil) self.stream( friendly_name: friendly_name, limit: limit, @@ -89,11 +86,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(friendly_name: nil, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( @@ -132,11 +128,10 @@ # Request is executed immediately. # @param [String] friendly_name The friendly_name # @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 ServiceInstance def page(friendly_name: nil, page_token: nil, page_number: nil, page_size: nil) params = { 'FriendlyName' => friendly_name, 'PageToken' => page_token, @@ -162,11 +157,10 @@ ## # Initialize the ServicePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource - # @return [ServicePage] ServicePage def initialize(version, response, solution) super(version, response) # Path Solution @@ -174,11 +168,10 @@ end ## # Build an instance of ServiceInstance # @param [Hash] payload Payload response from the API - # @return [ServiceInstance] ServiceInstance def get_instance(payload) return ServiceInstance.new( @version, payload, @@ -195,11 +188,10 @@ class ServiceContext < InstanceContext ## # Initialize the ServiceContext # @param [Version] version Version that contains the resource # @param [String] sid The sid - # @return [ServiceContext] ServiceContext def initialize(version, sid) super(version) # Path Solution @@ -233,11 +225,11 @@ ) return ServiceInstance.new( @version, payload, - sid: @solution['sid'], + sid: @solution[:sid], ) end ## # Update the ServiceInstance @@ -248,11 +240,10 @@ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id # @param [String] default_apn_notification_protocol_version The # default_apn_notification_protocol_version # @param [String] default_gcm_notification_protocol_version The # default_gcm_notification_protocol_version - # @return [ServiceInstance] Updated ServiceInstance def update(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil) data = { 'FriendlyName' => friendly_name, 'ApnCredentialSid' => apn_credential_sid, @@ -270,11 +261,11 @@ ) return ServiceInstance.new( @version, payload, - sid: @solution['sid'], + sid: @solution[:sid], ) end ## # Access the bindings @@ -324,11 +315,10 @@ ## # Initialize the ServiceInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sid The sid - # @return [ServiceInstance] ServiceInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @@ -357,11 +347,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 [ServiceContext] ServiceContext for this ServiceInstance def context unless @instance_context @instance_context = ServiceContext.new( @version, @@ -425,18 +414,18 @@ ## # Deletes the ServiceInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - @context.delete() + context.delete end ## # Fetch a ServiceInstance # @return [ServiceInstance] Fetched ServiceInstance def fetch - @context.fetch() + context.fetch end ## # Update the ServiceInstance # @param [String] friendly_name The friendly_name @@ -446,14 +435,14 @@ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id # @param [String] default_apn_notification_protocol_version The # default_apn_notification_protocol_version # @param [String] default_gcm_notification_protocol_version The # default_gcm_notification_protocol_version - # @return [ServiceInstance] Updated ServiceInstance def update(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil) - @context.update( + context.update( + friendly_name: friendly_name, apn_credential_sid: apn_credential_sid, gcm_credential_sid: gcm_credential_sid, messaging_service_sid: messaging_service_sid, facebook_messenger_page_id: facebook_messenger_page_id, default_apn_notification_protocol_version: default_apn_notification_protocol_version, @@ -463,24 +452,24 @@ ## # Access the bindings # @return [bindings] bindings def bindings - @context.bindings + context.bindings end ## # Access the notifications # @return [notifications] notifications def notifications - @context.notifications + context.notifications end ## # Provide a user friendly representation def to_s - context = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Notifications.V1.ServiceInstance #{context}>" + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Notifications.V1.ServiceInstance #{values}>" end end end end end \ No newline at end of file