lib/twilio-ruby/rest/monitor/v1/event.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/monitor/v1/event.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -36,11 +36,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(actor_sid: nil, event_type: nil, resource_sid: nil, source_ip_address: nil, start_date: nil, end_date: nil, limit: nil, page_size: nil) + def list(actor_sid: :unset, event_type: :unset, resource_sid: :unset, source_ip_address: :unset, start_date: :unset, end_date: :unset, limit: nil, page_size: nil) self.stream( actor_sid: actor_sid, event_type: event_type, resource_sid: resource_sid, source_ip_address: source_ip_address, @@ -66,11 +66,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(actor_sid: nil, event_type: nil, resource_sid: nil, source_ip_address: nil, start_date: nil, end_date: nil, limit: nil, page_size: nil) + def stream(actor_sid: :unset, event_type: :unset, resource_sid: :unset, source_ip_address: :unset, start_date: :unset, end_date: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( actor_sid: actor_sid, event_type: event_type, @@ -123,31 +123,44 @@ # @param [Date] end_date The end_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 EventInstance - def page(actor_sid: nil, event_type: nil, resource_sid: nil, source_ip_address: nil, start_date: nil, end_date: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(actor_sid: :unset, event_type: :unset, resource_sid: :unset, source_ip_address: :unset, start_date: :unset, end_date: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'ActorSid' => actor_sid, 'EventType' => event_type, 'ResourceSid' => resource_sid, 'SourceIpAddress' => source_ip_address, 'StartDate' => Twilio.serialize_iso8601(start_date), 'EndDate' => Twilio.serialize_iso8601(end_date), 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return EventPage.new(@version, response, @solution) + EventPage.new(@version, response, @solution) end ## + # Retrieve a single page of EventInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of EventInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + EventPage.new(@version, response, @solution) + end + + ## # Provide a user friendly representation def to_s '#<Twilio.Monitor.V1.EventList>' end end @@ -169,11 +182,11 @@ ## # Build an instance of EventInstance # @param [Hash] payload Payload response from the API # @return [EventInstance] EventInstance def get_instance(payload) - return EventInstance.new( + EventInstance.new( @version, payload, ) end @@ -202,18 +215,18 @@ ## # Fetch a EventInstance # @return [EventInstance] Fetched EventInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return EventInstance.new( + EventInstance.new( @version, payload, sid: @solution[:sid], ) end \ No newline at end of file