Module: Utils::Notion::UpdateDbState
- Defined in:
- lib/bas/utils/notion/update_db_state.rb
Overview
This module is a Notion utility for sending update status to notion databases.
Class Method Summary collapse
- .body(data) ⇒ Object
- .build_params(data) ⇒ Object
-
.execute(data) ⇒ Object
Implements the request process logic to Notion.
Class Method Details
.body(data) ⇒ Object
40 41 42 |
# File 'lib/bas/utils/notion/update_db_state.rb', line 40 def self.body(data) { properties: { data[:property] => { select: { name: data[:state] } } } } end |
.build_params(data) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/bas/utils/notion/update_db_state.rb', line 31 def self.build_params(data) { endpoint: "pages/#{data[:page_id]}", secret: data[:secret], method: "patch", body: body(data) } end |
.execute(data) ⇒ Object
Implements the request process logic to Notion.
Params:
-
property
Name of the db property to be updated. -
page_id
Id of the page to be updated. -
state
State to be updated -
secret
Notion secret.
returns HTTParty::Response
25 26 27 28 29 |
# File 'lib/bas/utils/notion/update_db_state.rb', line 25 def self.execute(data) params = build_params(data) Utils::Notion::Request.execute(params) end |