lib/twilio-ruby/rest/chat/v1/credential.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/chat/v1/credential.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -87,53 +87,66 @@ # 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 = { + def page(page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return CredentialPage.new(@version, response, @solution) + CredentialPage.new(@version, response, @solution) end ## # Retrieve a single page of CredentialInstance records from the API. # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of CredentialInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + CredentialPage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of CredentialInstance records from the API. + # Request is executed immediately. # @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 # @param [String] secret The secret # @return [CredentialInstance] Newly created CredentialInstance - def create(type: nil, friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil, secret: nil) - data = { + def create(type: nil, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) + data = Twilio::Values.of({ 'Type' => type, 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, 'Secret' => secret, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return CredentialInstance.new( + CredentialInstance.new( @version, payload, ) end @@ -161,11 +174,11 @@ ## # Build an instance of CredentialInstance # @param [Hash] payload Payload response from the API # @return [CredentialInstance] CredentialInstance def get_instance(payload) - return CredentialInstance.new( + CredentialInstance.new( @version, payload, ) end @@ -194,19 +207,19 @@ ## # Fetch a CredentialInstance # @return [CredentialInstance] Fetched CredentialInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return CredentialInstance.new( + CredentialInstance.new( @version, payload, sid: @solution[:sid], ) end @@ -218,38 +231,38 @@ # @param [String] private_key The private_key # @param [Boolean] sandbox The sandbox # @param [String] api_key The api_key # @param [String] secret The secret # @return [CredentialInstance] Updated CredentialInstance - def update(friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil, secret: nil) - data = { + def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, 'Secret' => secret, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return CredentialInstance.new( + CredentialInstance.new( @version, payload, sid: @solution[:sid], ) end ## # Deletes the CredentialInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Provide a user friendly representation def to_s @@ -348,10 +361,10 @@ # @param [String] private_key The private_key # @param [Boolean] sandbox The sandbox # @param [String] api_key The api_key # @param [String] secret The secret # @return [CredentialInstance] Updated CredentialInstance - def update(friendly_name: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil, secret: nil) + def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) context.update( friendly_name: friendly_name, certificate: certificate, private_key: private_key, sandbox: sandbox, \ No newline at end of file