Sha256: 27962443ae7442403e2656240b5c948795d59017806023c26bd246efa4034321
Contents?: true
Size: 1.29 KB
Versions: 14
Compression:
Stored size: 1.29 KB
Contents
module Ecoportal module API class GraphQL module Logic class QueryConnection < Ecoportal::API::GraphQL::Logic::Query accepted_params :searchConf, :after, :before, :first, :last include Enumerable def each(connection_block: nil, **kargs, &block) return to_enum(:each, **kargs, connection_block: connection_block) unless block cursor = nil; results = 0 loop do kargs.update(after: cursor) if cursor connection = query(**kargs, &connection_block) #total = connection.totalCount pageInfo = connection.pageInfo connection.nodes.each do |item| yield item end break unless cursor = pageInfo.endCursor end end def response_class return connection_class if respond_to?(:connection_class) @response_class ||= self.class.new_class( item_class, inherits: Ecoportal::API::GraphQL::Logic::Connection, namespace: "Ecoportal::API::GraphQL::Connection" ) do |klass| klass.item_class = item_class end end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems