lib/twilio-ruby/rest/trunking/v1/trunk.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/trunking/v1/trunk.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -29,27 +29,27 @@ # @param [String] disaster_recovery_url The disaster_recovery_url # @param [String] disaster_recovery_method The disaster_recovery_method # @param [String] recording The recording # @param [Boolean] secure The secure # @return [TrunkInstance] Newly created TrunkInstance - def create(friendly_name: nil, domain_name: nil, disaster_recovery_url: nil, disaster_recovery_method: nil, recording: nil, secure: nil) - data = { + def create(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'DomainName' => domain_name, 'DisasterRecoveryUrl' => disaster_recovery_url, 'DisasterRecoveryMethod' => disaster_recovery_method, 'Recording' => recording, 'Secure' => secure, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return TrunkInstance.new( + TrunkInstance.new( @version, payload, ) end @@ -119,25 +119,38 @@ # 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 TrunkInstance - 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 TrunkPage.new(@version, response, @solution) + TrunkPage.new(@version, response, @solution) end ## + # Retrieve a single page of TrunkInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of TrunkInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + TrunkPage.new(@version, response, @solution) + end + + ## # Provide a user friendly representation def to_s '#<Twilio.Trunking.V1.TrunkList>' end end @@ -159,11 +172,11 @@ ## # Build an instance of TrunkInstance # @param [Hash] payload Payload response from the API # @return [TrunkInstance] TrunkInstance def get_instance(payload) - return TrunkInstance.new( + TrunkInstance.new( @version, payload, ) end @@ -198,30 +211,30 @@ ## # Fetch a TrunkInstance # @return [TrunkInstance] Fetched TrunkInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return TrunkInstance.new( + TrunkInstance.new( @version, payload, sid: @solution[:sid], ) end ## # Deletes the TrunkInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Update the TrunkInstance # @param [String] friendly_name The friendly_name @@ -229,27 +242,27 @@ # @param [String] disaster_recovery_url The disaster_recovery_url # @param [String] disaster_recovery_method The disaster_recovery_method # @param [String] recording The recording # @param [Boolean] secure The secure # @return [TrunkInstance] Updated TrunkInstance - def update(friendly_name: nil, domain_name: nil, disaster_recovery_url: nil, disaster_recovery_method: nil, recording: nil, secure: nil) - data = { + def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'DomainName' => domain_name, 'DisasterRecoveryUrl' => disaster_recovery_url, 'DisasterRecoveryMethod' => disaster_recovery_method, 'Recording' => recording, 'Secure' => secure, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return TrunkInstance.new( + TrunkInstance.new( @version, payload, sid: @solution[:sid], ) end @@ -477,10 +490,10 @@ # @param [String] disaster_recovery_url The disaster_recovery_url # @param [String] disaster_recovery_method The disaster_recovery_method # @param [String] recording The recording # @param [Boolean] secure The secure # @return [TrunkInstance] Updated TrunkInstance - def update(friendly_name: nil, domain_name: nil, disaster_recovery_url: nil, disaster_recovery_method: nil, recording: nil, secure: nil) + def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset) context.update( friendly_name: friendly_name, domain_name: domain_name, disaster_recovery_url: disaster_recovery_url, disaster_recovery_method: disaster_recovery_method, \ No newline at end of file