Class: Notion::List

Inherits:
Object
  • Object
show all
Defined in:
lib/notion-sdk-ruby/models/list.rb

Overview

The List object is an intermediate object that helps with pagination.

developers.notion.com/reference/pagination

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body) ⇒ List

Returns a new instance of List.



23
24
25
26
27
28
29
30
# File 'lib/notion-sdk-ruby/models/list.rb', line 23

def initialize(response_body)
  @data = response_body["results"].map do |d|
    get_model(d["object"]).new(d)
  end

  @next_cursor = response_body["next_cursor"]
  @has_more = response_body["has_more"]
end

Instance Attribute Details

#dataArray<Notion::User>, ... (readonly)

An array of endpoint-dependent objects

Returns:



11
12
13
# File 'lib/notion-sdk-ruby/models/list.rb', line 11

def data
  @data
end

#has_moreboolean (readonly)

When the response includes the end of the list, false. Otherwise, true.

Returns:

  • (boolean)


21
22
23
# File 'lib/notion-sdk-ruby/models/list.rb', line 21

def has_more
  @has_more
end

#next_cursornil, string (readonly)

Used to retrieve the next page of results by passing the value as the start_cursor parameter to the same endpoint.

Returns:

  • (nil)

    if has_more is true.

  • (string)

    if has_more is false.



17
18
19
# File 'lib/notion-sdk-ruby/models/list.rb', line 17

def next_cursor
  @next_cursor
end