Class: NotionRb::Operations::UpdateParent

Inherits:
Object
  • Object
show all
Defined in:
lib/notion_rb/operations/update_parent.rb

Constant Summary collapse

COMMAND_TYPE =
:update
OPERATION_NAME =
:update_parent
TABLE =
'block'
DEFAULT_PARENT_TABLE =
TABLE
DEFAULT_ALIVE_VALUE =
true

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, parent_id, opts = {}) ⇒ UpdateParent

Returns a new instance of UpdateParent.



14
15
16
17
18
19
# File 'lib/notion_rb/operations/update_parent.rb', line 14

def initialize(id, parent_id, opts = {})
  @id = id
  @parent_id = parent_id
  @parent_table = opts.fetch(:parent_table, DEFAULT_PARENT_TABLE)
  @alive = opts.fetch(:alive, DEFAULT_ALIVE_VALUE)
end

Instance Attribute Details

#aliveObject (readonly)

Returns the value of attribute alive.



12
13
14
# File 'lib/notion_rb/operations/update_parent.rb', line 12

def alive
  @alive
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/notion_rb/operations/update_parent.rb', line 12

def id
  @id
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



12
13
14
# File 'lib/notion_rb/operations/update_parent.rb', line 12

def parent_id
  @parent_id
end

#parent_tableObject (readonly)

Returns the value of attribute parent_table.



12
13
14
# File 'lib/notion_rb/operations/update_parent.rb', line 12

def parent_table
  @parent_table
end

Instance Method Details

#argsObject



32
33
34
35
36
37
38
# File 'lib/notion_rb/operations/update_parent.rb', line 32

def args
  {
    parent_id: parent_id,
    parent_table: parent_table,
    alive: alive
  }
end

#commandsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/notion_rb/operations/update_parent.rb', line 21

def commands
  [
    Commands::Factory.build(
      COMMAND_TYPE,
      id,
      args: args,
      table: TABLE
    )
  ]
end