Class: NotionRb::Api::Get
- Inherits:
-
Base
- Object
- Base
- NotionRb::Api::Get
show all
- Defined in:
- lib/notion_rb/api/get.rb
Constant Summary
Constants inherited
from Base
Base::API_BASE_URL, Base::BASE_URL, Base::REDEFINE_EXCEPTION, Base::S3_URL_PREFIX, Base::S3_URL_PREFIX_ENCODED, Base::SIGNED_URL_PREFIX
Instance Method Summary
collapse
Methods inherited from Base
#success?
Constructor Details
#initialize(_params) ⇒ Get
6
7
8
9
10
11
|
# File 'lib/notion_rb/api/get.rb', line 6
def initialize(_params)
super
@blocks = []
@data = {}
end
|
Instance Method Details
#blocks ⇒ Object
13
14
15
16
17
18
|
# File 'lib/notion_rb/api/get.rb', line 13
def blocks
return @blocks if @blocks.any?
call
@blocks
end
|
#call ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/notion_rb/api/get.rb', line 20
def call
body = JSON.parse(response.body)
@collection_rows = body.dig('result', 'blockIds')
data = body.dig('recordMap', 'block').merge(body.dig('recordMap', 'collection') || {})
data.values.each do |value|
convert_values(value.dig('value'))
end
end
|