Class: Eco::API::UseCases::GraphQL::Helpers::Pages::Activities::Reader

Inherits:
Object
  • Object
show all
Includes:
Base::ConnectionReader
Defined in:
lib/eco/api/usecases/graphql/helpers/pages/activities.rb

Overview

Lazy activity-feed reader for a single page.

Constant Summary collapse

DEFAULT_SEARCH_CONF =
{ sorters: [{ direction: 'desc', key: 'updated_at' }] }.freeze

Constants included from Base::ConnectionReader

Base::ConnectionReader::DEFAULT_PAGE_SIZE

Instance Method Summary collapse

Methods included from Base::ConnectionReader

#each, #page_size, #page_size=, #to_a

Constructor Details

#initialize(graphql, page_id, search_conf: nil) ⇒ Reader

Returns a new instance of Reader.

Parameters:

  • graphql (Ecoportal::API::GraphQL)

    the active gem client.

  • page_id (String)

    the page id whose activities to read.

  • search_conf (Hash, nil) (defaults to: nil)

    a Search input hash (typically { sorters: [...] }). Defaults to the web feature's ordering: newest updates first.



17
18
19
20
21
# File 'lib/eco/api/usecases/graphql/helpers/pages/activities.rb', line 17

def initialize(graphql, page_id, search_conf: nil)
  @graphql     = graphql
  @page_id     = page_id
  @search_conf = search_conf || DEFAULT_SEARCH_CONF
end