lib/twilio-ruby/rest/api/v2010/account/call/notification.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/api/v2010/account/call/notification.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -41,11 +41,11 @@ # @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(log: nil, message_date_before: nil, message_date: nil, message_date_after: nil, limit: nil, page_size: nil) + def list(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil) self.stream( log: log, message_date_before: message_date_before, message_date: message_date, message_date_after: message_date_after, @@ -67,11 +67,11 @@ # @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(log: nil, message_date_before: nil, message_date: nil, message_date_after: nil, limit: nil, page_size: nil) + def stream(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( log: log, message_date_before: message_date_before, @@ -118,29 +118,42 @@ # @param [Time] message_date_after: The message_date # @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 NotificationInstance - def page(log: nil, message_date_before: nil, message_date: nil, message_date_after: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'Log' => log, 'MessageDate<' => Twilio.serialize_iso8601(message_date_before), 'MessageDate' => Twilio.serialize_iso8601(message_date), 'MessageDate>' => Twilio.serialize_iso8601(message_date_after), 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return NotificationPage.new(@version, response, @solution) + NotificationPage.new(@version, response, @solution) end ## + # Retrieve a single page of NotificationInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of NotificationInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + NotificationPage.new(@version, response, @solution) + end + + ## # Provide a user friendly representation def to_s '#<Twilio.Api.V2010.NotificationList>' end end @@ -164,11 +177,11 @@ ## # Build an instance of NotificationInstance # @param [Hash] payload Payload response from the API # @return [NotificationInstance] NotificationInstance def get_instance(payload) - return NotificationInstance.new( + NotificationInstance.new( @version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid], ) @@ -203,19 +216,19 @@ ## # Fetch a NotificationInstance # @return [NotificationInstance] Fetched NotificationInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return NotificationInstance.new( + NotificationInstance.new( @version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid], sid: @solution[:sid], @@ -224,10 +237,10 @@ ## # Deletes the NotificationInstance # @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 \ No newline at end of file