Class: Notion::List

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body) ⇒ List

Returns a new instance of List.


5
6
7
8
9
10
11
12
# File 'lib/notion-sdk-ruby/models/list.rb', line 5

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

#dataObject (readonly)

Returns the value of attribute data.


3
4
5
# File 'lib/notion-sdk-ruby/models/list.rb', line 3

def data
  @data
end

#has_moreObject (readonly)

Returns the value of attribute has_more.


3
4
5
# File 'lib/notion-sdk-ruby/models/list.rb', line 3

def has_more
  @has_more
end

#next_cursorObject (readonly)

Returns the value of attribute next_cursor.


3
4
5
# File 'lib/notion-sdk-ruby/models/list.rb', line 3

def next_cursor
  @next_cursor
end

Instance Method Details

#get_model(object_name) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/notion-sdk-ruby/models/list.rb', line 14

def get_model(object_name)
  case object_name
  when "block"
    Block
  when "database"
    Database
  when "page"
    Page
  when "user"
    User
  end
end