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

- old
+ new

@@ -10,11 +10,10 @@ class V1 < Version class CredentialList < ListResource ## # Initialize the CredentialList # @param [Version] version Version that contains the resource - # @return [CredentialList] CredentialList def initialize(version) super(version) # Path Solution @@ -30,11 +29,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 @@ -49,11 +47,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( @@ -89,11 +86,10 @@ # Retrieve a single page of CredentialInstance 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 CredentialInstance def page(page_token: nil, page_number: nil, page_size: nil) params = { 'PageToken' => page_token, 'Page' => page_number, @@ -108,22 +104,21 @@ end ## # Retrieve a single page of CredentialInstance records from the API. # Request is executed immediately. - # @param [String] friendly_name The friendly_name # @param [credential.PushService] type The type + # @param [String] friendly_name The friendly_name # @param [String] certificate The certificate # @param [String] private_key The private_key # @param [Boolean] sandbox The sandbox # @param [String] api_key The api_key - # @return [CredentialInstance] Newly created CredentialInstance - def create(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) + def create(type: nil, friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) data = { - 'FriendlyName' => friendly_name, 'Type' => type, + 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, } @@ -151,11 +146,10 @@ ## # Initialize the CredentialPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource - # @return [CredentialPage] CredentialPage def initialize(version, response, solution) super(version, response) # Path Solution @@ -163,11 +157,10 @@ end ## # Build an instance of CredentialInstance # @param [Hash] payload Payload response from the API - # @return [CredentialInstance] CredentialInstance def get_instance(payload) return CredentialInstance.new( @version, payload, @@ -184,11 +177,10 @@ class CredentialContext < InstanceContext ## # Initialize the CredentialContext # @param [Version] version Version that contains the resource # @param [String] sid The sid - # @return [CredentialContext] CredentialContext def initialize(version, sid) super(version) # Path Solution @@ -211,28 +203,25 @@ ) return CredentialInstance.new( @version, payload, - sid: @solution['sid'], + sid: @solution[:sid], ) end ## # Update the CredentialInstance # @param [String] friendly_name The friendly_name - # @param [credential.PushService] type The type # @param [String] certificate The certificate # @param [String] private_key The private_key # @param [Boolean] sandbox The sandbox # @param [String] api_key The api_key - # @return [CredentialInstance] Updated CredentialInstance - def update(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) + def update(friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) data = { 'FriendlyName' => friendly_name, - 'Type' => type, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, } @@ -244,11 +233,11 @@ ) return CredentialInstance.new( @version, payload, - sid: @solution['sid'], + sid: @solution[:sid], ) end ## # Deletes the CredentialInstance @@ -269,11 +258,10 @@ ## # Initialize the CredentialInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sid The sid - # @return [CredentialInstance] CredentialInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @@ -297,11 +285,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 [CredentialContext] CredentialContext for this CredentialInstance def context unless @instance_context @instance_context = CredentialContext.new( @version, @@ -345,26 +332,24 @@ ## # Fetch a CredentialInstance # @return [CredentialInstance] Fetched CredentialInstance def fetch - @context.fetch() + context.fetch end ## # Update the CredentialInstance # @param [String] friendly_name The friendly_name - # @param [credential.PushService] type The type # @param [String] certificate The certificate # @param [String] private_key The private_key # @param [Boolean] sandbox The sandbox # @param [String] api_key The api_key - # @return [CredentialInstance] Updated CredentialInstance - def update(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) - @context.update( - type: type, + def update(friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil) + context.update( + friendly_name: friendly_name, certificate: certificate, private_key: private_key, sandbox: sandbox, api_key: api_key, ) @@ -372,17 +357,17 @@ ## # Deletes the CredentialInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - @context.delete() + context.delete end ## # Provide a user friendly representation def to_s - context = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.IpMessaging.V1.CredentialInstance #{context}>" + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.IpMessaging.V1.CredentialInstance #{values}>" end end end end end \ No newline at end of file